#How do I add latency per m1 so I can´t spam it

26 messages · Page 1 of 1 (latest)

north monolith
#

I´d like some scripting help on how I can add m1 delay so you can´t spam the left mouse button and do infinite damage

north monolith
#

where?

#

in the server script or client?

glossy schooner
#

Sorry, my spelling is all over the place

north monolith
#

No worries

#

when you say add a debounce do you mean in a specific location or just under the previous server code?

glossy schooner
#

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

north monolith
#

oh alr

#

ill try it out and come back if i run into a problem

kindred hazel
#

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```

north monolith
#

ohhh

#

that makes a lot of sense

glossy schooner
kindred hazel
glossy schooner
#

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

north monolith
#

hey

#

I tried adding a latency but it screwed up the orientation of the m1s

#

I can send the server script where i tried adding a timer per m1