Loading UI error

So i’m making my own loading screen and I made a script to do that.

Here is the script

local mainFrame = script.Parent.LoadingUi.MainFrame -- making a variable for the frame
local loadingFrame = mainFrame.LoadingFrame -- making a varible for loading Frame

script.Parent:RemoveDefaultLoadingScreen() -- this removes the default loading screen

repeat 
	
	loadingFrame.Text = "Loading." -- don't look this i'm a noob scripter so.
	wait(0.5)
	loadingFrame.Text = "Loading.."
	wait(0.5)
	loadingFrame.Text = "Loading..."
	
until
game:IsLoaded() -- repeating until game is loaded 

But I don’t why why my game does not replicate the loading Gui first.
Instead it shows this

Here is my explorer too.

explorer 2

Can anyone tell me if it is a scripting error or is it due to my slow internet?

1 Like

You haven’t set the gui to PlayerGui…

3 Likes

Hey there!

If I were you, I’d place the GUI into the script first. After that, I’d change up the script a little bit so that you set the GUI’s parent to PlayerGui (as @FlashFlame_Roblox said).

script.Parent:RemoveDefaultLoadingScreen()

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local interface = script.LoadingUi
local loadingFrame = interface.MainFrame.LoadingFrame

script.LoadingUi.Parent = playerGui

repeat
	loadingFrame.Text = "Loading."
	wait(0.5)
	loadingFrame.Text = "Loading.."
	wait(0.5)
	loadingFrame.Text = "Loading..."
	wait(0.5)
until game:IsLoaded()
3 Likes

Remember to mark the post as answer if what the post said works!

1 Like