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)
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)
Try this
Part.Touched:Connect(function() YourGUIName.Visible = true end) Part.TouchedEnded:Connect(function() YourGUIName.Visible = false end)
sorry if it doesnt work