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

What is Debounce?

I'm not sure what debounce is. I've seen it in many scripts but I don't understand it.

1 answer

✓ Accepted answer

Debounce is a way to make sure functions, or other things involved in a script, only happen once, or when they are supposed to.

For example, an on Brick Hit script. The script will keep relapsing through, as the player stands on it, so one way to make sure it only fires once is a debounce.

debounce = false

randomlinehere:connect(function (random)
	if not debounce then -- aka "if debounce == false then"
		debounce = true
		-- Script here
	end	
end)

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