Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is Debounce?

Asked by 10 years ago

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

1 answer

Log in to vote
1
Answered by 10 years ago

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)
Ad

Answer this question