So i made a loading screen. And i turn off CharacterAutoLoads
so that the character doesn’t load during the loading screen and the title screen. The thing is the code doesn’t run past the print(3.5)
and i honestly have no idea why.
--||Services
local Content_Provider = game:GetService("ContentProvider")
local Replicated_Storage = game:GetService("ReplicatedStorage")
local Sound_Service = game:GetService("SoundService")
local Tween_Service = game:GetService("TweenService")
local Players = game:GetService("Players")
--||Variables & Sounds
local Player = Players.LocalPlayer
local Player_Module = require(Player.PlayerScripts:WaitForChild("PlayerModule"))
local Loading_Screen = script:WaitForChild("Loading_Screen"):Clone()
local Player_GUI = Player.PlayerGui
local Main_GUI = Player_GUI:WaitForChild("Main_GUI")
Loading_Screen.Parent = Main_GUI
print(1)
local Controls = Player_Module:GetControls()
print(2)
------------------------------------------------------------------------------
local Modules_Folder = Replicated_Storage:WaitForChild("FLDR_Modules")
local LoadMaps_Folder = Replicated_Storage:WaitForChild("FLDR_Maps")
------------------------------------------------------------------------------
print(3)
local Booleans = require(Modules_Folder.Bools_Module)
print(3.5)
local Functions = require(Modules_Folder.Functions_Module)
local Assets_Text = Loading_Screen:FindFirstChild("Assets_Text")
print(4)
local Skip_Button = Loading_Screen:FindFirstChild("Skip_Button")
print(5)
local Title_Screen = Main_GUI:WaitForChild("Title_Screen")
print(6)
local VPF_Birdo = Main_GUI.VPF_Birdo
local VPF_Roblox = Main_GUI.VPF_Roblox
local TweenTrans_Info = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
local TweenTrans_1 = Tween_Service:Create(Skip_Button, TweenTrans_Info, {Transparency = 0})
local TweenTrans_2 = Tween_Service:Create(Skip_Button, TweenTrans_Info, {Transparency = 1})
------------------------------------------------------------------------------
local GRP_UI = Sound_Service:WaitForChild("GRP_UI")
print(7)
local Loading_SFX = GRP_UI.SFX_Loading
local UIHover_SFX = GRP_UI.SFX_UIHover
local UISelect_SFX = GRP_UI.SFX_UISelect
local Sparkle_SFX = GRP_UI.SFX_Sparkle
------------------------------------------------------------------------------
local Skipped = false
------------------------------------------------------------------------------
Controls:Disable()
--||Function
repeat
task.wait()
until game:IsLoaded()
------------------------------------------------------------------------------
local Assets = game:GetDescendants()
local Max_Assets = #Assets
------------------------------------------------------------------------------
Skip_Button.MouseEnter:Connect(function()
local Tween_Button = Tween_Service:Create(Skip_Button, TweenInfo.new(0.125, Enum.EasingStyle.Linear, Enum.EasingDirection.In), {Size = UDim2.new(0, 220, 0, 70)})
UIHover_SFX:Play()
Tween_Button:Play()
end)
------------------------------------------------------------------------------
Skip_Button.MouseLeave:Connect(function()
local Tween_Button = Tween_Service:Create(Skip_Button, TweenInfo.new(0.125, Enum.EasingStyle.Linear, Enum.EasingDirection.In), {Size = UDim2.new(0, 200, 0, 50)})
Tween_Button:Play()
end)
------------------------------------------------------------------------------
function onSkipped()
Skipped = true
Skip_Button.Interactable = false
local Tween_Button1 = Tween_Service:Create(Skip_Button, TweenInfo.new(0.125, Enum.EasingStyle.Linear, Enum.EasingDirection.In), {Size = UDim2.new(0, 190, 0, 40)})
local Tween_Button2 = Tween_Service:Create(Skip_Button, TweenInfo.new(0.125, Enum.EasingStyle.Linear, Enum.EasingDirection.In), {Size = UDim2.new(0, 200, 0, 50)})
UISelect_SFX:Play()
Tween_Button1:Play()
task.wait(0.125)
Tween_Button2:Play()
Functions:FadeSound(Loading_SFX, 1, 0)
Booleans.Game.SkippedLoad = true
TweenTrans_2:Play()
task.wait(1)
Skip_Button.Visible = false
end
------------------------------------------------------------------------------
Skip_Button.MouseButton1Click:Connect(onSkipped)
Skip_Button.TouchTap:Connect(onSkipped)
------------------------------------------------------------------------------
for i, Asset in Assets do
Content_Provider:PreloadAsync({Asset})
Assets_Text.Text = "Assets loaded : ".. i.."/"..Max_Assets
if Skipped and Booleans.Game.SkippedLoad == true then
Skipped = false
Booleans.Game.SkippedLoad = false
Booleans.Game.Loaded = true
Functions:IrisTransition_In()
task.wait(2)
Sparkle_SFX.Playing = true
if Main_GUI:FindFirstChild("Loading_Screen") then
Main_GUI:FindFirstChild("Loading_Screen"):Destroy()
end
VPF_Birdo.Visible = true
local Tween_VPF_Info = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
local Tween_VPF_Birdo1 = Tween_Service:Create(VPF_Birdo, Tween_VPF_Info, {ImageTransparency = 0})
local Tween_VPF_Birdo2 = Tween_Service:Create(VPF_Birdo, Tween_VPF_Info, {ImageTransparency = 1})
local Tween_VPF_Roblox1 = Tween_Service:Create(VPF_Roblox, Tween_VPF_Info, {ImageTransparency = 0})
local Tween_VPF_Roblox2 = Tween_Service:Create(VPF_Roblox, Tween_VPF_Info, {ImageTransparency = 1})
Tween_VPF_Birdo1:Play()
task.wait(1.95)
Tween_VPF_Birdo2:Play()
task.wait(0.5)
VPF_Roblox.Visible = true
Tween_VPF_Roblox1:Play()
task.wait(1.95)
Tween_VPF_Roblox2:Play()
task.wait(0.5)
VPF_Birdo.Visible = false
VPF_Roblox.Visible = false
Title_Screen.Visible = true
Title_Screen.Interactable = true
Sparkle_SFX.Playing = false
task.wait(1)
workspace:WaitForChild("Floor"):Destroy()
Functions:IrisTransition_Out()
Functions:FadeSound(Loading_SFX, 1, 1)
end
if i >= 1000 then
Skip_Button.Visible = true
TweenTrans_1:Play()
task.wait(1)
if not Skipped then
Skip_Button.Interactable = true
end
end
end
------------------------------------------------------------------------------