Reposted due to no answers being posted on the last question I asked. So I have a script that is supposed to make a GUI pop up if a player sits on a chair. It works fine. However, I only want the GUI to pop up every twenty seconds, so if a player jumps on the chair or sits multiple times during those twenty seconds it does not pop up. This is my code:
local debounce = true
local Part = game.Workspace.PC.Seat
Part.Touched:Connect(function(hit)
if hit.Parent == game.Players.LocalPlayer.Character then
game.Players.LocalPlayer.PlayerGui.VideoGui.Frame.Visible = true
debounce = false
wait(20)
debounce = true
end
end)

1 comment
It works, thank you!