So I have this heal part thing, but I would like a debounce on it. Any suggestions, or ideas??
script.Parent.Touched:connect(function(p) if p.Parent:FindFirstChild("Humanoid") then p.Parent.Humanoid.Health = 100 end end)
If I knew a basic debounce script, I could add this to GUI's and stuff like that, but I don't know how to. Any help?
I think I understand what you mean. I think it would be something like this,
local buttonPressed = false --Store whether the button is pressed in a local variable Workspace.Button.Touched:connect(function(hit) if not buttonPressed then -- Is it not pressed? buttonPressed = true -- Mark it as pressed, so that other handlers don't execute print("Button pressed") wait(1) print("Hi :D") -- Do Stuff buttonPressed = false -- Mark it as not pressed, so other handlers can execute again end end)
Hope this helps you!