This is a localscript in replicatedFirst.
Error:
ReplicatedFirst.CoreScript:4: attempt to index nil with 'Loading'
Script:
local player = game.Players.LocalPlayer local LoadGui = player.PlayerGui:FindFirstChild('LoadingGUI') LoadGui.Loading.Position = UDim2.new(0.5, 0, 0.5, 0) repeat wait() until player:IsDescendantOf(workspace) if player:IsDescendantOf(workspace) then LoadGui:TweenPosition(UDim2.new(10, 0, 0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5) end
I'm confused.
Line 4 is where the error is.
local player = game.Players.LocalPlayer local LoadGui = player.PlayerGui:FindFirstChild('LoadingGUI') LoadGui.Loading.Position = UDim2.new(0.5, 0, 0.5, 0) -- This Is The Error repeat wait() until player:IsDescendantOf(workspace) if player:IsDescendantOf(workspace) then LoadGui:TweenPosition(UDim2.new(10, 0, 0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5) end
Here is the solution. You need to wait for the asset to load in! I have also removed the default loading screen for you.
game.ReplicatedFirst:RemoveDefaultLoadingScreen() local player = game.Players.LocalPlayer local LoadGui = player.PlayerGui:WaitForChild('LoadingGUI') LoadGui:WaitForChild("Loading").Position = UDim2.new(0.5, 0, 0.5, 0) game.Loaded:Wait() LoadGui:TweenPosition(UDim2.new(10, 0, 0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5)