I want to create an script that kicks someone if they press too quickly in a short time

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Create an script that kicks someone if they press quickly in 1 second

  2. What is the issue? I see no other people asking the same question.

  3. What solutions have you tried so far? like what i’ve said before, nobody else is asking for it

I would be glad if someone could help me with this

1 Like

You could add something like a debounce system.

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
3 Likes

You can also use a rate limiter module that uses tick() to measure clicks per second.

I also recommend not kicking as you may get false positives but its up to you.

2 Likes

the idea is that i have a paint tool item, but with auto clickers you can paint quickly, no wait period to paint again

1 Like

i should try to figure out how to slow the speed between paint

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.

Odd way of putting that… just looking to help.
Is that not what you asked for?

I guess I did use wait() … I agree with the task.wait().
That’s what I get for hamming out a reply too fast.

This is something I would never do anyways.

1 Like

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.

1 Like

i don’t know if it works or not