Intro gui work

This commit is contained in:
2023-12-29 03:32:40 -05:00
parent 9bfcd65bac
commit 46f0389f9b
5 changed files with 67 additions and 40 deletions

View File

@@ -12,8 +12,8 @@ until GameIsLoaded
local HumanoidRPSettings = require(script:WaitForChild("HumanoidRootPart")) local HumanoidRPSettings = require(script:WaitForChild("HumanoidRootPart"))
local CameraModule = require(script:WaitForChild("Camera")) local CameraModule = require(script:WaitForChild("Camera"))
local CrouchModule = require(script:WaitForChild("Crouch")) local CrouchModule = require(script:WaitForChild("Crouch"))
local BindModule = require(ClientStorage:WaitForChild("KeyBinds"))
local HumanoidModule = require(script:WaitForChild("Humanoid")) local HumanoidModule = require(script:WaitForChild("Humanoid"))
local BindModule = require(ClientStorage:WaitForChild("KeyBinds"))
local Character = script.Parent local Character = script.Parent
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")

View File

@@ -21,6 +21,9 @@ local function CustomCoreGuiEnums(): CustomCoreGuiEnums
if CoreGuis.AllowEmotes then if CoreGuis.AllowEmotes then
table.remove(CoreElements, table.find(CoreElements, Enum.CoreGuiType.EmotesMenu)) table.remove(CoreElements, table.find(CoreElements, Enum.CoreGuiType.EmotesMenu))
end end
if CoreGuis.AllowPlayerList then
table.remove(CoreElements, table.find(CoreElements, Enum.CoreGuiType.PlayerList))
end
return CoreElements return CoreElements
end end

View File

@@ -15,8 +15,6 @@ local CameraSettings = require(ClientStorage:WaitForChild("Camera"))
local Player = Players.LocalPlayer local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui") local PlayerGui = Player:WaitForChild("PlayerGui")
CoreGuis:Off()
--We need to wait for the game to load before spamming functionality --We need to wait for the game to load before spamming functionality
repeat repeat
local GameIsLoaded = LoadCompleted:Invoke() local GameIsLoaded = LoadCompleted:Invoke()
@@ -45,6 +43,7 @@ local function CameraBinds()
end) end)
end end
CoreGuis:Off()
Camera:FirstPerson() Camera:FirstPerson()
Mouse:DisablePointer() Mouse:DisablePointer()
Crosshair:Enable() Crosshair:Enable()

View File

@@ -5,6 +5,9 @@
local RS = game:GetService("RunService") local RS = game:GetService("RunService")
local Storage = game:GetService("ReplicatedStorage") local Storage = game:GetService("ReplicatedStorage")
local LoadingFinished = Instance.new("BindableEvent")
local LoadingFun = true
local function GuiDependencies(IntroGui: ScreenGui): typeof(GuiDependencies) local function GuiDependencies(IntroGui: ScreenGui): typeof(GuiDependencies)
IntroGui.Enabled = true IntroGui.Enabled = true
@@ -32,6 +35,7 @@ local function GuiDependencies(IntroGui: ScreenGui): typeof(GuiDependencies)
ViewportCamera = ViewportCamera, ViewportCamera = ViewportCamera,
GL_Cube = GL_Cube, GL_Cube = GL_Cube,
FrameGradient = FrameGradient, FrameGradient = FrameGradient,
TextShadow = TextShadow,
ShadowGradient = ShadowGradient, ShadowGradient = ShadowGradient,
FrameworkText = FrameworkText, FrameworkText = FrameworkText,
SandboxText = SandboxText, SandboxText = SandboxText,
@@ -58,18 +62,10 @@ end
type Stepped = RBXScriptConnection type Stepped = RBXScriptConnection
local function GUI_LoadFinish(Stepped: Stepped, Gui: GUIs) local function GUI_LoadFinish(Stepped: Stepped, Gui: GUIs) --We can now access the framework
--We can now access the framework!
--Image if we had HTML and CSS... --Image if we had HTML and CSS...
local Tween = require(Storage:WaitForChild("Tween")) local Tween = require(Storage:WaitForChild("Tween"))
local Bind_Completed = Instance.new("BindableFunction")
Bind_Completed.Name = "LoadingComplete"
Bind_Completed.Parent = Storage:WaitForChild("Client")
Bind_Completed.OnInvoke = function()
return game:IsLoaded() --or just returning a static true
end
local EaseStyle = Enum.EasingStyle.Linear local EaseStyle = Enum.EasingStyle.Linear
local FrameTween_Constructor = Tween.constructor(TweenInfo.new(1, EaseStyle), Gui.Frame, { local FrameTween_Constructor = Tween.constructor(TweenInfo.new(1, EaseStyle), Gui.Frame, {
@@ -86,22 +82,30 @@ local function GUI_LoadFinish(Stepped: Stepped, Gui: GUIs)
DeveloperTween_Constructor:Start() DeveloperTween_Constructor:Start()
local ViewportTween = ViewportFrame_Constructor:Start() --The longest tween local ViewportTween = ViewportFrame_Constructor:Start() --The longest tween
--Text deleting effect
task.spawn(function() task.spawn(function()
local Promise_60 = 1/60
local rhpid_text_len = #Gui.FrameworkText
local sandbox_text_len = #Gui.SandboxText.Text local sandbox_text_len = #Gui.SandboxText.Text
for i = 1, sandbox_text_len do --"A sandbox experience" has the longest text for i = sandbox_text_len, 1, -1 do --"A sandbox experience" has the longest text
Gui.SandboxText.Text = Gui.SandboxText.Text:sub(rhpid_text_len) local rhpid_text_len = #Gui.FrameworkText.Text
task.wait(Promise_60)
Gui.SandboxText.Text = Gui.SandboxText.Text:sub(1,i-1)
if rhpid_text_len ~= 0 then
Gui.FrameworkText.Text = Gui.FrameworkText.Text:sub(1,i-1)
Gui.TextShadow.Text = Gui.FrameworkText.Text --heh hack
end
task.wait(.05)
end end
end) end)
ViewportTween.Completed:Wait() ViewportTween.Completed:Wait()
Stepped:Disconnect() Stepped:Disconnect()
Gui.IntroGui:Destroy() --We dont need the intro gui anymore Gui.IntroGui:Destroy() --We dont need the intro gui anymore
end end
return function(IntroGui: ScreenGui, load_elapse_start: number) type LoadFinishedSignal = RBXScriptSignal
return function(IntroGui: ScreenGui, load_elapse_start: number): LoadFinishedSignal
local Gui = GuiDependencies(IntroGui) local Gui = GuiDependencies(IntroGui)
local CubeSides = GL_Sides(Gui.GL_Cube) local CubeSides = GL_Sides(Gui.GL_Cube)
@@ -135,10 +139,17 @@ return function(IntroGui: ScreenGui, load_elapse_start: number)
if not game:IsLoaded() then if not game:IsLoaded() then
game.Loaded:Wait() game.Loaded:Wait()
end end
local load_elapse = os.clock()-load_elapse_start local load_elapse = os.clock()-load_elapse_start
--artifical wait but only if you dont take longer than 3 seconds to load the actual game (let me have my fun), if LoadingFun then
task.wait(math.max(0, 3-load_elapse)) task.wait(math.max(0, 3-load_elapse)) --Only if you take longer than or exactly 3 seconds to load
end
LoadingFinished:Fire()
print(load_elapse)
GUI_LoadFinish(Stepped, Gui) GUI_LoadFinish(Stepped, Gui)
end) end)
return LoadingFinished.Event
end end

View File

@@ -3,32 +3,46 @@ local load_elapse_start = os.clock()
local ReplicatedFirst = game:GetService("ReplicatedFirst") local ReplicatedFirst = game:GetService("ReplicatedFirst")
local Players = game:GetService("Players") local Players = game:GetService("Players")
local Storage = game:GetService("ReplicatedStorage") local Storage = game:GetService("ReplicatedStorage")
local RS = game:GetService("RunService")
local RunIntroGui = require(script:WaitForChild("IntroGui")) local DisabledInStudio = RS:IsStudio()
local IntroGui = nil
local Player = Players.LocalPlayer
if not Player then
repeat
Player = Players.LocalPlayer
task.wait()
until Player
end
local PlayerGui = Player:WaitForChild("PlayerGui")
local IntroGui = PlayerGui:WaitForChild("rhpidframework_intro", 10)
if IntroGui then
--Let the magic begin
RunIntroGui(IntroGui, load_elapse_start)
else
warn("Waited 10 seconds for the intro gui without success")
local function LoadedBind()
local Bind_Completed = Instance.new("BindableFunction") local Bind_Completed = Instance.new("BindableFunction")
Bind_Completed.Name = "LoadingComplete" Bind_Completed.Name = "LoadingComplete"
Bind_Completed.Parent = Storage:WaitForChild("Client") Bind_Completed.Parent = Storage:WaitForChild("Client")
Bind_Completed.OnInvoke = function() Bind_Completed.OnInvoke = function()
return game:IsLoaded() --or just returning a static true return game:IsLoaded()
end end
end end
local function LoadingIntroGUI()
local RunIntroGui = require(script:WaitForChild("IntroGui"))
local Player = Players.LocalPlayer
if not Player then
repeat
Player = Players.LocalPlayer
task.wait()
until Player
end
local PlayerGui = Player:WaitForChild("PlayerGui")
IntroGui = PlayerGui:WaitForChild("rhpidframework_intro", 10)
if IntroGui then
--Let the magic begin
RunIntroGui(IntroGui, load_elapse_start)
else
warn("Waited 10 seconds for the intro gui without success")
end
end
if not DisabledInStudio then
LoadingIntroGUI()
end
LoadedBind()
ReplicatedFirst:RemoveDefaultLoadingScreen() ReplicatedFirst:RemoveDefaultLoadingScreen()