Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a GUI's visibility set to false after a certain amount of time?

Asked by
uhjos_h 19
3 years ago
Edited 3 years ago

I have currently tried to make a GUI that goes invisible after a certain amount of time: this is my code,

local guis = game.StarterGui.Menu.SideMenu

while true do
    wait (10)
    guis.Visible = false
    wait (10)
    guis.Visible = true
end

I am currently new to Roblox Scripting so please help me out lol.

0
Make sure you're using a LocalScript ScuffedAI 435 — 3y

2 answers

Log in to vote
2
Answered by
2_MMZ 1059 Moderation Voter
3 years ago

So here's what you'll need to do. First, if your script is a regular script, then change it to LocalScript, and insert that LocalScript into the target GUI.

Then, you must use a while true do which will make your script loop for eternity, you can even put a wait in there, so it waits every 10 seconds forever to change the GUI.

Next, identify your GUI properly with a good old script.Parent which will get the LocalScripts parent (What it's inside of).

Like this:

local guis = script.Parent

Then for the last touch. We must fix your script.

while true do
wait(10)
guis.Visible = false
wait(10)
guis.Visible = true
end

Hope this helped you!

0
You can try to make local function and in the call it Odoscementas 0 — 2y
Ad
Log in to vote
0
Answered by
CodeWon 181
3 years ago

I'm not sure but I would try this:

local guis = game.StarterGui.Menu.SideMenu

while wait(10) do
    guis.Visible = true
    wait(10)
    guis.Visible = false
end

Answer this question