Welcome To AntiClick
Hello developers! I have made an easily editable, basic, yet effective anti auto-clicker script.
How it works
AntiClick uses A Strike-Based system, by Detecting a Players Click Pattern, If they are recursive, It will trigger, However, After your desired (7.5 by default) Seconds, The strike gets removed.
Source
Here is the code:
Source
--!nolint
--!native
--!nonstrict
-- dupewastaken 2024
local InputService = game:GetService("UserInputService")
local LastTap
local LastFormattedTap
local player = game.Players.LocalPlayer
local StrikeRemoveTime = 7.5 -- // Change this to how long the player needs to wait before the strike is removed
local Accuracy = 3 -- // Change this depending on how many decimal places it uses, However, Keep in mind that the higher this number is, The harder it is to detect, But if it's lower, False positives are more common
local MaxStrikes = 5 -- // Change this to how many times the player can tap before geting Kicked
local ClickTiming = {}
local function Insert(): ()
local Strike = table.insert(ClickTiming, #ClickTiming + 1 or 1)
if #ClickTiming >= 5 then
player:Kick("Abnormal Clicking Patterns, Feel free to rejoin")
end;
task.wait(StrikeRemoveTime)
table.remove(ClickTiming, Strike)
print("🟥 Strike Removing")
return;
end;
local function Process(Input: InputObject): ()
if Input.UserInputType ~= Enum.UserInputType.MouseButton1 and Input.UserInputType ~= Enum.UserInputType.MouseButton2 and Input.UserInputType ~= Enum.UserInputType.Touch then return end
local CurrentTick = tick()
if not LastTap and not LastFormattedTap then
LastTap = tick()
LastFormattedTap = tonumber(string.format("%." .. (Accuracy) .. "f", CurrentTick-LastTap))
return;
end;
local FormattedTap = tonumber(string.format("%." .. (Accuracy) .. "f", CurrentTick-LastTap))
if LastFormattedTap ~= FormattedTap then
print("✅ This click pattern is chill")
else
print("🟠 Due to abnormal autoclicking patterns, A strike has been added to the table. Will clear in 15 seconds")
task.spawn(Insert)
end
LastFormattedTap = FormattedTap
LastTap = tick()
return;
end;
InputService.InputBegan:Connect(Process)
The source is also available on GitHub.
Additional Info
Here is how you can edit it, It is described via comments, But I can go more into depth here:
StrikeRemoveTime: How long it takes for the strike to be removed, Basic concept
Accuracy: This is how many decimal places the timings for the patterns use, The lower the value is, The more times false-positives occur, The higher, False positives happen a lot less, However actual detection is harder, 3 is a perfect median in this case, Due to the chance of false positives happening being very slim, Even if they do occur, they will be removed after a slight amount of time.
MaxStrikes: How many strikes can occur before kicking the player, 5 is yet again a perfect median, The chance of 5 separate false positives occurring are near 0, Even if you are spam clicking and a false positive somehow does occur, You wont be immediately kicked.
Proof of concept
As you can see, as I enable my autoclicker, It starts detecting, And after 5 strikes, It kicks the player!
Final Thoughts
This is a very useful tool if you don’t want a player to spam click, Say you have a clicker game, But people are abusing autoclickers and ruining a hypothetical economy, You could use this tool to prevent that.
Let me know your thoughts and if I should improve!
- Useful
- Not Useful
- Cool but I probably won’t use it
0 voters
(PS: Sorry if this post is formatted horribly, this is my first formatted post ahah.)