Script That Shows A GUI After The Game Loads

Hello! So I want to make a script where if the loading screen is done, it shows the GUI the script it in, and if the loading screen is not done, it doesn’t show the GUI the script is in. I could not find any topic about this, so it would be extremely helpful if you could show me/give me a link to a tutorial on how to do it! Thanks in advance!

@EmbatTheHybrid and @adrrob1002 helped me a lot! My goal did not quite get met today, but I will eventually figure it out. Big thanks again to everyone who helped me try to make this goal a reality! -@ItsKoolPlayz

2 Likes

Would game:IsLoaded() and the game.Loaded event be what you’re looking for?

3 Likes
if not game:IsLoaded() then
  game.Loaded:Wait()
end

-- Show the GUI
1 Like

Would a script like this work for that?

local DonateGUI = script.Parent(“DonateGUI”)

local IsLoaded = game.IsLoaded()

if game.IsLoaded = false then

DonateGUI = false

elseif

game.IsLoaded = true then

DonateGUI.Visible = true

end

Idk how to script that good, so idk if this is a good script…

1 Like

I believe you’d have to wait for the game to load first, make it Invisible by default, and then just use waht the official documentation gives as an example

if not game:IsLoaded() then
    game.Loaded:Wait()
end

This will yield till the game loads, afterwards, just make the gui appear

And your code wouldn’t work eitherways since IsLoaded has brackets at the end, game:IsLoaded()

Here:

local DonateGUI = script.Parent
if not game:IsLoaded() then -- If the game isn't loaded yet,
  game.Loaded:Wait()        -- then wait for it to load
end

DonateGUI.Visible = true -- Make the GUI visible
wait(5) -- Keep the GUI open for 5 seconds
DonateGUI.Visible = false -- Make the GUI invisible

This should work, keep us updated.

OHHHH! That makes more sense. I will test both them out!

1 Like

Also just to see if this would help if it doesn’t work, put the Localscript in ReplicatedFirst

Yeah, I am going to try that out.

2 Likes

None of them worked… :thinking: I don’t know what happened, but it’s something… I tried all of the scripts, put the script in ReplicatedFirst, and it’s a local script. Would anyone like me to add a video?

What’s the code you have right now?

Yours, and its not working. Do I need to add something to that script?

Did you remember to add the code to enable the gui? All mine does is jsut wait for the game to load if it’s not loaded

OOPS, Nope! I will go do that right now! Would it just be

local DonateGUI = game.StarterGui(DonateGUI)

if game.IsLoaded = true then
DonateGUI.Visible = true
end

I don’t know how to script too much, but I do know a few things.

That will not work, something like this should perhaps

local players = game:GetSerivce("Players")
local plr = players.LocalPlayer
local plrgui = plr:WaitForChild("PlayerGui")

if not game:IsLoaded() then
    game.Loaded:Wait()
end

plrgui.DonateGUI.Enabled = true

Where DonateGUI is your screengui

1 Like

Ok, I will try this out! I am confident it will work, but I will update you if it doesn’t!

1 Like

That script didn’t work… Correct me if I’m wrong, but the script should still be in ReplicatedFirst?

Yes, it should still be in ReplicatedFirst, make sure DonateGUI is a screengui or else it’ll error!

local DonateGUI = script.Parent
if not game:IsLoaded() then -- If the game isn't loaded yet,
  game.Loaded:Wait()        -- then wait for it to load
end

DonateGUI.Visible = true -- Make the GUI visible
wait(5) -- Keep the GUI open for 5 seconds
DonateGUI.Visible = false -- Make the GUI invisible

Put that code inside of your GUI, like the image shows:
image

Ok, I will try that! The downside of this is that my computer is not the best, so when I try to run the game Roblox Studio crashes. So, print’s are not going to be useful at finding the fix!