I am working on a game where you kill npc’s using swords, However a exploiter can fire the attack event 1000 times in a second and instant kill a npc, I am wanting to limit how many times they can send the event and if they send it for instance 20 times in a second then it will auto kick them. OR if you have any other better way of detecting this, That would help as well.
Make a InUse = {} table on attack add them to the list and before the event is fired check if there already in the list if they are return else do attack at the end of the attack remove them from the table
There are a-lot better ways of doing this but I like this method, fast,simple,clean
Sure there is a better way, But this did the job. Thanks!
: D
Nice, if needed i could leave you sample code?
No need, Here is what i did.
local WAIT = 0.1
local Cooldown = {}
local plr = plrthatisattacking
if table.find(Cooldown, plr.Name) then
plr:Kick("Attacking to fast.")
return
else
table.insert(Cooldown, plr.Name)
coroutine.wrap(function()
wait(WAIT)
table.remove(Cooldown, Cooldown[plr.Name])
end)()
end
This is good, make sure you add a client cooldown, just so normal players dont get kicked if they spam to much.
I did, It waits for the animation to be completed then allows them to attack again.Which the animation is way longer than 0.1 so shouldn’t have any issues.

Nice, hope it helped!
#BlockedBy30CharNeeded
Instead, use benchmarking. This is just my personal advice and the method BugleBoy provided is sufficient enough.
WAIT = 0.1
cooldowns = {}
------------------------
if (cooldowns[plr] and os.clock() - cooldowns[plr] < WAIT) then
return
end
cooldowns[plr] = os.clock()
-- do action
Hmm i see why this is better, Even tho they are the same thing, Ill use your method instead.
This works, very well.
I have done something like this before.