mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
Intro gui work
This commit is contained in:
@@ -12,8 +12,8 @@ until GameIsLoaded
|
||||
local HumanoidRPSettings = require(script:WaitForChild("HumanoidRootPart"))
|
||||
local CameraModule = require(script:WaitForChild("Camera"))
|
||||
local CrouchModule = require(script:WaitForChild("Crouch"))
|
||||
local BindModule = require(ClientStorage:WaitForChild("KeyBinds"))
|
||||
local HumanoidModule = require(script:WaitForChild("Humanoid"))
|
||||
local BindModule = require(ClientStorage:WaitForChild("KeyBinds"))
|
||||
|
||||
local Character = script.Parent
|
||||
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
|
||||
|
||||
@@ -21,6 +21,9 @@ local function CustomCoreGuiEnums(): CustomCoreGuiEnums
|
||||
if CoreGuis.AllowEmotes then
|
||||
table.remove(CoreElements, table.find(CoreElements, Enum.CoreGuiType.EmotesMenu))
|
||||
end
|
||||
if CoreGuis.AllowPlayerList then
|
||||
table.remove(CoreElements, table.find(CoreElements, Enum.CoreGuiType.PlayerList))
|
||||
end
|
||||
return CoreElements
|
||||
end
|
||||
|
||||
|
||||
@@ -15,8 +15,6 @@ local CameraSettings = require(ClientStorage:WaitForChild("Camera"))
|
||||
local Player = Players.LocalPlayer
|
||||
local PlayerGui = Player:WaitForChild("PlayerGui")
|
||||
|
||||
CoreGuis:Off()
|
||||
|
||||
--We need to wait for the game to load before spamming functionality
|
||||
repeat
|
||||
local GameIsLoaded = LoadCompleted:Invoke()
|
||||
@@ -45,6 +43,7 @@ local function CameraBinds()
|
||||
end)
|
||||
end
|
||||
|
||||
CoreGuis:Off()
|
||||
Camera:FirstPerson()
|
||||
Mouse:DisablePointer()
|
||||
Crosshair:Enable()
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
local RS = game:GetService("RunService")
|
||||
local Storage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local LoadingFinished = Instance.new("BindableEvent")
|
||||
local LoadingFun = true
|
||||
|
||||
local function GuiDependencies(IntroGui: ScreenGui): typeof(GuiDependencies)
|
||||
IntroGui.Enabled = true
|
||||
|
||||
@@ -32,6 +35,7 @@ local function GuiDependencies(IntroGui: ScreenGui): typeof(GuiDependencies)
|
||||
ViewportCamera = ViewportCamera,
|
||||
GL_Cube = GL_Cube,
|
||||
FrameGradient = FrameGradient,
|
||||
TextShadow = TextShadow,
|
||||
ShadowGradient = ShadowGradient,
|
||||
FrameworkText = FrameworkText,
|
||||
SandboxText = SandboxText,
|
||||
@@ -58,18 +62,10 @@ end
|
||||
|
||||
type Stepped = RBXScriptConnection
|
||||
|
||||
local function GUI_LoadFinish(Stepped: Stepped, Gui: GUIs)
|
||||
--We can now access the framework!
|
||||
local function GUI_LoadFinish(Stepped: Stepped, Gui: GUIs) --We can now access the framework
|
||||
--Image if we had HTML and CSS...
|
||||
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 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()
|
||||
local ViewportTween = ViewportFrame_Constructor:Start() --The longest tween
|
||||
|
||||
--Text deleting effect
|
||||
task.spawn(function()
|
||||
local Promise_60 = 1/60
|
||||
local rhpid_text_len = #Gui.FrameworkText
|
||||
local sandbox_text_len = #Gui.SandboxText.Text
|
||||
|
||||
for i = 1, sandbox_text_len do --"A sandbox experience" has the longest text
|
||||
Gui.SandboxText.Text = Gui.SandboxText.Text:sub(rhpid_text_len)
|
||||
task.wait(Promise_60)
|
||||
for i = sandbox_text_len, 1, -1 do --"A sandbox experience" has the longest text
|
||||
local rhpid_text_len = #Gui.FrameworkText.Text
|
||||
|
||||
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)
|
||||
|
||||
ViewportTween.Completed:Wait()
|
||||
Stepped:Disconnect()
|
||||
Gui.IntroGui:Destroy() --We dont need the intro gui anymore
|
||||
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 CubeSides = GL_Sides(Gui.GL_Cube)
|
||||
@@ -135,10 +139,17 @@ return function(IntroGui: ScreenGui, load_elapse_start: number)
|
||||
if not game:IsLoaded() then
|
||||
game.Loaded:Wait()
|
||||
end
|
||||
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),
|
||||
task.wait(math.max(0, 3-load_elapse))
|
||||
|
||||
local load_elapse = os.clock()-load_elapse_start
|
||||
if LoadingFun then
|
||||
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)
|
||||
end)
|
||||
|
||||
return LoadingFinished.Event
|
||||
end
|
||||
@@ -3,32 +3,46 @@ local load_elapse_start = os.clock()
|
||||
local ReplicatedFirst = game:GetService("ReplicatedFirst")
|
||||
local Players = game:GetService("Players")
|
||||
local Storage = game:GetService("ReplicatedStorage")
|
||||
local RS = game:GetService("RunService")
|
||||
|
||||
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")
|
||||
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 DisabledInStudio = RS:IsStudio()
|
||||
local IntroGui = nil
|
||||
|
||||
local function LoadedBind()
|
||||
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
|
||||
return game:IsLoaded()
|
||||
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()
|
||||
Reference in New Issue
Block a user