Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is a debounce?

Can someone explain what a debounce is and how does it work?

1 answer

✓ Accepted answer

It's basically a variable that prevents an event from going on and on. Here's an example:

Say you want to give a player Money:

debounce = false --true or false, doesn't matter

script.Parent.Touched:connect(function(player) --The brick gets touched and calls the player
	if debounce == false then --Checks to see if it is false
		debounce  = true --Now no one can touch the brick until debounce = false
		--Code to give player Money
		wait(10) debounce = false --Waits 10 seconds before the brick can give money again.
	end
end)

I hope that I've answered your question :D.

2 comments

1

thanks

1

No problem. If you need any more help, don't be afraid to ask me on ROBLOX: fahmisack123

This discussion is preserved as it was. New answers, comments, and votes are closed.