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

local ReplicatedStorage = game:GetService('ReplicatedStorage')
local ClientRemote = ReplicatedStorage:WaitForChild('RemoteEvent1')
local Gui = script.Parent:WaitForChild('Frame') 

function OpenGui() -- Function to fire.
    Gui.Visible = true
end

ClientRemote.OnClientEvent:Connect(OpenGui)

2 answers

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

Here

local time = 5 --// change to the time you want
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local ClientRemote = ReplicatedStorage:WaitForChild('RemoteEvent1')
local Gui = script.Parent:WaitForChild('Frame') 

function OpenGui() -- Function to fire.
Gui.Visible = true
wait(time)
Gui.Visible = false
end

ClientRemote.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

Part.Touched:Connect(function()
YourGUIName.Visible = true
end)

Part.TouchedEnded:Connect(function()
YourGUIName.Visible = false
end)

sorry if it doesnt work

Answer this question