#How do I add latency per m1 so I can´t spam it
26 messages · Page 1 of 1 (latest)
Add a debounce
Preferably server
Sorry, my spelling is all over the place
No worries
when you say add a debounce do you mean in a specific location or just under the previous server code?
A debounce is just a check to see if the code is still running
Debounce is just a boolean. It gets put to false after the cooldown so the function can fire again
Just make sure all players have their own function (use playeradded
i did one and it works for a gun in the local script but its not debounce ```local fireRate = 0.1
local currentTime = tick()
local interval = tick() - currentTime
if(interval >= fireRate) then
--Fire weapon
currentTime = tick()
end```
Same concept, different name
oh i dont even know whats debounce i will look into it
A debounce normally is
local debounce = false
local function Attack()
if debounce then return end
debounce = true
blabla
task.wait(cooldownTime)
debounce = false
end
So if debounce == true it will stop the function, not doing the actual attack
Just make sure you don’t set the debounce back to false before the cooldown timer is done