Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

(SOLVED) How do I make a GUI delay after a player joins a game?

I created a terms and agreement GUI and I wanted it to show up after 5-10 seconds after a player (or me) joins. I took a wild guess while attempting to make it work, but it didn't. Here's my wild wild guess:

while true do
	script.Parent.Parent.Visible = false
	wait(12)
	script.Parent.Parent.Visible = true
end

Apparently, the local script is inside the Frame of the ScreenGUI.

2 answers

You're using a while loop with no break between true and false, this means that the gui is changing it back to false before it is even noticable that is is visible to the human eye.

try doing it without the loop

frame = script.Parent.Parent --what you want to be visible
frame.Visible = false
wait(12)
frame.Visible = true

5 comments

0

So apparently, this pops up when I tested my place with your suggestion: 03:54:51.416 - Something unexpectedly tried to set the parent of Rules and Terms to NULL while trying to set the parent of Rules and Terms. Current parent is PlayerGui.

0

Is there anything else in the script? because my code isnt editing the parent of anything.

0

Well, this is all I've gotten inside this tree: http://prntscr.com/3yxb6z

0

i see 2 scripts

0

ShowGUIOnce makes the GUI not appear the second time you die and respawn. Delay is the script that is supposed to make the GUI show up, and I think that's where most of the problems are occuring.

Okay, somehow I solved my own question, haha. Marolex's suggestion didn't work for some reason. Marolex's suggestion

frame = script.Parent.Parent --what you want to be visible
frame.Visible = false
wait(12)
frame.Visible = true

I then got an error when I was testing: 03:54:51.416 - Something unexpectedly tried to set the parent of Rules and Terms to NULL while trying to set the parent of Rules and Terms. Current parent is PlayerGui.

I knew right away that something HAS to be the parent of "Rules and Terms". This is it:

frame = script.Parent.Frame --what you want to be visible
frame.Visible = false
wait(12)
frame.Visible = true

frame = script.Parent.Parent was defining itself and caused a nil to occur. frame = script.Parent.Frame was defining the frame to appear.

This discussion is preserved as it was. New answers, comments, and votes are closed.