local db = false --will control whether the player gets kicked or not
local function desiredAction() --desired action to debounce
if db then --did it too quickly
player:Kick("You did something too quickly.")
end
db = true
task.wait(1) --cooldown
db = false
end
Your code should not have a way to over click anything. After the 1st click, stall how fast it can be clicked again.
A basic outline …
local player = game.Players.LocalPlayer
local debounce = false
local function kickPlayer()
player:Kick("You were kicked for spamming.")
end
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if not debounce then
debounce = true
wait(0.5) -- may need some adjustment
debounce = false
else
kickPlayer()
end
end
end)
That is pretty much exactly the code I wrote, except you linked it up to the UserInputService. Since you replied to me, what are you criticising about my code? It should work fine when linked with the desired action.
Don’t use wait, it has throttling and can be inaccurate. task.wait is better.
You will undoubtedly have false positives unless you account for a clients network lag, which could be spoofed.
Say for example a player is shooting a gun, and whilest they do their wifi goes out for 3 seconds, for whatever reason, all of the shooting requests the player makes in those 3 seconds are queued up, and when the player is re-connected, theyre fired off all basically at the same.
The server now sees a player firing loads of remotes and kicks them out thinking its an exploiter.