Loading screen working in studio, but not in actual game

Hi, so basically i made this loading screen, and it just gets stuck loading forever and im not sure why.
Explorer:
Screenshot 2023-07-01 165248
Code (In localscript):

local ReplicatedStorage = game:GetService('ReplicatedStorage') -- useless
local ReplicatedFirst = game:GetService('ReplicatedFirst') -- get replicatedfirst
local ContentProvider = game:GetService("ContentProvider") -- get contentprovider in this video it will help to load assets of the games

local Assets = game:GetDescendants() -- this get all the descendants of the game means all children of children etc.. so all assets.

local UI1 = script.LoadingScreen:Clone() -- it clone the GUI that is in the script so i can copy later for the loading

local Player = game.Players.LocalPlayer -- it get the local player the one playing
local PlayerGui = Player:WaitForChild("PlayerGui") -- it his GUI so i can put the loading in here

ReplicatedFirst:RemoveDefaultLoadingScreen() -- i forget to add this, it remove default loading of roblox

repeat wait() until game:IsLoaded() -- wait til loads because sometimes it makes mistakes.

game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false) -- disables the roblox gui while in menu/loading screen

UI1.Parent = PlayerGui -- it put the gui into playergui so he can see it

--// spinner tween
local TweenService = game:GetService("TweenService")
local Spinner = UI1.Main.Spinner
local tweenInfo = TweenInfo.new(
	1, -- The time the tween takes to complete
	Enum.EasingStyle.Linear, -- The tween style in this case it is Linear
	Enum.EasingDirection.Out, -- EasingDirection
	-1, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
	false, -- Reverse?
	0 -- Delay
)
local Tween = TweenService:Create(Spinner, tweenInfo, {Rotation = 360})
Tween:Play()

for i = 1, #Assets do -- from index 1 to the last asset number, it does
	local asset = Assets[i] -- here is to get the current asset loading
	ContentProvider:PreloadAsync({asset}) -- load the asset into the game
	UI1.Main.RemainingAssets.Text = "Loading: "..asset.Name.." "..i.." | "..#Assets.."" -- show his name and the current progress
end

wait(1)

Tween:Pause()
Spinner.Visible = false
UI1.Main.RemainingAssets.Visible = false
UI1.Main.LoadingAssets.Visible = false
UI1.Main.Loaded.Visible = true

wait(1)
local Time = 2
local TweenInf = TweenInfo.new(
	Time, -- The time the tween takes to complete
	Enum.EasingStyle.Quint, -- The tween style in this case it is Linear
	Enum.EasingDirection.Out, -- EasingDirection
	0, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
	false, -- Reverse?
	0 -- Delay
)
local TweenOff = TweenService:Create(UI1.Main, TweenInf, {
	Position = UDim2.new(0, 0, -1, 0)
})
game.Players.LocalPlayer.PlayerScripts.ShowMainMenu:Fire()
TweenOff:Play()
TweenOff.Completed:Connect(function()
	UI1:Destroy()
end)

(MY GAME USES CHARACTERAUTOLOADS OFF, AND IT SAYS ITS TRYING TO LOAD STARTERPLAYER SO IT COULD BE RELATED, BUT I DONT KNOW HOW TO FIX THAT OTHER THANK TURNING CHARACTERAUTOLOADS OFF)
Thanks for your help in advance.

1 Like

Bump. I still need help with this.

2 Likes

Spam print statements so you can see where it gets stuck

1 Like

It just started working when I tested an autorevocery file… Maybe something got corrupted?

2 Likes

nevermind it stopped working AGAIN!!!

it is saying its failing to load StarterPlayer so imma try just revmoving everything from starterplayer and se what happens.

2 Likes

Fixed it! It was an animation in a tool failing to load.

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