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
1 | local ReplicatedStorage = game:GetService( 'ReplicatedStorage' ) |
2 | local ClientRemote = ReplicatedStorage:WaitForChild( 'RemoteEvent1' ) |
3 | local Gui = script.Parent:WaitForChild( 'Frame' ) |
4 |
5 | function OpenGui() -- Function to fire. |
6 | Gui.Visible = true |
7 | end |
8 |
9 | ClientRemote.OnClientEvent:Connect(OpenGui) |
Here
01 | local time = 5 --// change to the time you want |
02 | local ReplicatedStorage = game:GetService( 'ReplicatedStorage' ) |
03 | local ClientRemote = ReplicatedStorage:WaitForChild( 'RemoteEvent1' ) |
04 | local Gui = script.Parent:WaitForChild( 'Frame' ) |
05 |
06 | function OpenGui() -- Function to fire. |
07 | Gui.Visible = true |
08 | wait(time) |
09 | Gui.Visible = false |
10 | end |
11 |
12 | ClientRemote.OnClientEvent:Connect(OpenGui) |
Try this
1 | Part.Touched:Connect( function () |
2 | YourGUIName.Visible = true |
3 | end ) |
4 |
5 | Part.TouchedEnded:Connect( function () |
6 | YourGUIName.Visible = false |
7 | end ) |
sorry if it doesnt work