Loading screen stuck

The loading screen is working fine in studio, but stuck when just joining the game


Haven’t found a solution to this…
My code: (the script is in ReplicatedFirst and the loading gui is in ReplicatedFirst aswell)

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
local replicatedStorage = game:GetService("ReplicatedStorage")
local replicatedFirst = game:GetService("ReplicatedFirst")
replicatedFirst:RemoveDefaultLoadingScreen()
local contentProvider = game:GetService("ContentProvider")
local assets = game:GetDescendants()
local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local loadingGui = replicatedFirst.LoadingGui:Clone()
loadingGui.Parent = playerGui
repeat 
	task.wait() 
until game:IsLoaded()
for i = 1, #assets do
	local asset = assets[i]
	contentProvider:PreloadAsync({asset})
	loadingGui.LoadingText.Text = "Loading assets: ["..i.."/"..#assets.."]"
end
repeat
	task.wait()
	loadingGui.Frame.BackgroundTransparency += .02
	loadingGui.LoadingText.TextTransparency += .02
until loadingGui.Frame.BackgroundTransparency == 1 and loadingGui.LoadingText.TextTransparency == 1
loadingGui:Destroy()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
script:Destroy()

Any help is appreciated!

Are their any errors in the output? I’m guessing it is getting stuck at the PreloadAsync() step

There are no errors in the output.

Try calling the callback function of PreloadAsync and print the AssetFetchStatus

Uhh… How do I do that? Kinda new to this preloading thing

The second param of preloadAsync is a function which gets called when it attempts to load it. The function has two parameters first one is the id of the asset and the second one is the assetFetchStatus which we want to know

Okay, got it… Here’s everything it printed out in console:



image
image

Where does it get stuck? charr

gets stuck like this

Apparently the issue just fixed itself today. Wow. Didn’t change anything but now everything is working perfectly

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.