Ad
Log in to vote
0

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

Asked by
SkyFume 10
2 months ago
Edited 2 months 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 441 — 2mo

2 answers

Log in to vote
2
Answered by
2_MMZ 837 Moderation Voter
2 months 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!

Ad
Log in to vote
0
Answered by
CodeWon 121
2 months 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