#what is a heartbeat debounce
18 messages · Page 1 of 1 (latest)
That is not an official term
"Debounce" alone is, though
A debounce is a mechanism that regulates how often a function can be performed
It's essentially a cooldown
damn
** You are now Level 4! **
my friend gave me something
local rate = 1
local last = 0
local fire
fire = runservice.Heartbeat:Connect(function(dt)
last += dt
if last >= rate then
last -= rate
end
end)
this is what he means by that
is there a better way to do debounces than this?
For this scenario, that is the most optimal debounce implementation
thank you
Though, it would be better to set last to 0 than to subtract itself from itself
i told him that, he argued it was so no seconds could be wasted
wait
i mistyped it
sorry that was supposed to be last -= rate