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

How can I make the Gui invisible after certain time?

Asked by 6 years ago

I have a script where if you touch a block it will show a GUI, but the GUI stays on your screen and do not disappear, how can I fix this, or what script should I add and where?

Local script inside of a Gui

1local ReplicatedStorage = game:GetService('ReplicatedStorage')
2local ClientRemote = ReplicatedStorage:WaitForChild('RemoteEvent1')
3local Gui = script.Parent:WaitForChild('Frame')
4 
5function OpenGui() -- Function to fire.
6    Gui.Visible = true
7end
8 
9ClientRemote.OnClientEvent:Connect(OpenGui)

2 answers

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

Here

01local time = 5 --// change to the time you want
02local ReplicatedStorage = game:GetService('ReplicatedStorage')
03local ClientRemote = ReplicatedStorage:WaitForChild('RemoteEvent1')
04local Gui = script.Parent:WaitForChild('Frame')
05 
06function OpenGui() -- Function to fire.
07Gui.Visible = true
08wait(time)
09Gui.Visible = false
10end
11 
12ClientRemote.OnClientEvent:Connect(OpenGui)
0
You dont need "time" you can just do wait(5) and also this works but its timed, unless that's what you want Wad_dles 15 — 6y
0
^ Really i think he knows... Lol He's doing that so the guy can edit it easier namerplz 42 — 6y
0
Tysm! It work :D RainbowBeastYT 85 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Try this

1Part.Touched:Connect(function()
2YourGUIName.Visible = true
3end)
4 
5Part.TouchedEnded:Connect(function()
6YourGUIName.Visible = false
7end)

sorry if it doesnt work

Answer this question