Problem with loading scripting

Hello! So I have this loading screen and it was working fine for a while now(like a month) but randomly it just crashed and randomly stops loading. Anyone know why?? Is it the task.wait()? Also when I disabled the gui chunks were loading very slowly. Anyone know why?


local ReplicatedFirst = game:GetService("ReplicatedFirst")
local ContentProvider = game:GetService("ContentProvider")
local TweenService = game:GetService("TweenService")
local Background = script.Parent:WaitForChild("Background")

ReplicatedFirst:RemoveDefaultLoadingScreen()
local assets = game.Workspace:GetDescendants()
script.Parent.Enabled = true

local Title = script.Parent:WaitForChild("Background").GameTitle

local sentance = ""

local textsay = "Game Developer Simulator"

local split = string.split(textsay, "")
script.Parent["Audio/keyboard typing"]:Play()
for i, v in pairs(split) do
	sentance = sentance..v
	Title.Text = sentance
	wait(0.05)
end
script.Parent["Audio/keyboard typing"]:Stop()





for i = 1, #assets do
	local asset = assets[i]
	local percentage = math.round(i / #assets * 100)
	ContentProvider:PreloadAsync({asset})
	Background:WaitForChild("DisplayPercentage").Text = percentage.."%"
	Background:WaitForChild("AssetsLoaded").Text = "Loading Assets: "..i.."/"..#assets
	TweenService:Create(Background.BarBackground.Bar, TweenInfo.new(0.2,Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Size = UDim2.fromScale(percentage/100, 1)}):Play()
	if i % 50 == 0 then
		task.wait()
	end
end
Background:WaitForChild("AssetsLoaded").Text = "Game loaded!"
wait(3)
local bg = script.Parent:WaitForChild("Background")

bg.BorderSizePixel = 5
bg:TweenSizeAndPosition(UDim2.new(0,0,0,0),UDim2.new(0.5,0,0.5,0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.25)
--bg:TweenSize(UDim2.new(0.01, 0.01), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.2)
bg.Position = UDim2.new(0, 0, 0, 0)
script["fast wind woosh sound effect"]:Play()
for i, v in pairs(script.Parent:GetDescendants()) do
	if v:IsA("Frame") then
		TweenService:Create(v, TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play()
	elseif v:IsA("TextLabel") then
		TweenService:Create(v, TweenInfo.new(0.5), {TextTransparency = 1}):Play()
	end
end
game.Players.LocalPlayer.PlayerGui.MoneyGui.Enabled = true
wait(1)
script.Parent.Enabled = false
1 Like

Can we see where the script is located in explorer? There isn’t much info here

its a script inside the players loading gui. local script btw also for some reason my roblox loads slow