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!