Detection autoclicker v1

In this program we run a client part that will go to the server, basically when we click with our mouse we will ask the server to add +1 clicks, we do the same with the asynchronous function that aims to check (server) the number of cps per second

--client
if not game:IsLoaded() then game.Loaded:Wait() end

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Events = ReplicatedStorage.Events

local getClicksEvent = Events.GetClicksEvent
local callThreadEvent = Events.CallThreadEvent

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local function thread()
	callThreadEvent:FireServer()
end

local co = coroutine.create(thread)

coroutine.resume(co)

mouse.Button1Down:Connect(function()
	getClicksEvent:FireServer()
end)
--server
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Events = ReplicatedStorage.Events

local getClicksEvent = Events.GetClicksEvent
local callThreadEvent = Events.CallThreadEvent

local countClick = 0

local TIME_WAIT = 1

local function verifClickPlayer(player: Player)
	if countClick > 18 then
		player:Kick("You used autoclicker bro")
	end
end

local function updateClick(player: Player)
	while task.wait(TIME_WAIT) do
		verifClickPlayer(player)

		print(countClick / TIME_WAIT.."Your cps")

		countClick = 0
	end
end

callThreadEvent.OnServerEvent:Connect(function(player)
	updateClick(player)
end)

getClicksEvent.OnServerEvent:Connect(function(player: Player)
	countClick += 1

	print(countClick..": Clicks")
end)

if you want to give your opinion I am taker must I improve!

1 Like

Generally speaking, I wouldn’t kick a player if you’re checking for an AC on the server. Main reason is if a player gets a lag spike and their internet cuts for like 2-3 seconds, they can easily trigger the anti-AC, since once their connection becomes stable the remote will get spam fired in short succession all at once. Most of the time instead, if a player clicks too fast I’ll just drop their request (for example in a simulator game, if they click too fast they won’t get coins for their extra clicks). If you’re checking for AC for the sake of it, don’t. Exploiters can just remove the part of the code that fire’s the remote, so it’s just better to check on the client only.


Also from the looks of things, your current implementation would count the clicks from all players. You need to store that kind of stuff in a table. (Also I have no clue why you have the callThreadEvent remote)


-- client
local clickRemote = game.ReplicatedStorage.Remotes.Click

mouse.Button1Down:Connect(function()
    clickRemote:FireServer()
end
-- server
local clickRemote = game.ReplicatedStorage.Remotes.Click
local clicks = {}
local maxClicks = 18

clickRemote.OnServerEvent:Connect(function(player)
    clicks[player] = clicks[player] or 0
    clicks[player] += 1
    if clicks[player] > maxClicks then return end 
    -- otherwise do whatever code
end)

while true do
    for _, player in game.Players:GetPlayers() do
        clicks[player] = 0
    end
    task.wait(1)
end
1 Like

Why dont you add a cooldown instead of all of this?

its just a simple detection autoclicker !

1 Like

mb got confused its not community resources or anythin so got confused you needed help lol

I wonder how you manage to take into account the wifi etc… I can not ahahahaha!

no i don’t need help its just my code but i need somebody opinion

1 Like

Probs experienced and has happened to him once. Its good to cover all bases

1 Like

I read this thread some time ago but happened to stumble on it again! I have an (extreme)
idea for you.
On top of @kingerman88 's idea of client-side implementation, most autoclickers tend to have a nearly identical time in between clicks – And there are also people, albeit rare, that can have >50CPS (mostly people who drag click).
So maybe you could cache the time in between each click in a second, and if those clicks are over a certain threshold (let’s say >20 CPS), check if the time in between clicks is nearly identical (because floating point errors would throw you off (0.05 ≠ 0.051 for instance)). If the time between each click is too similar, kick or ban the player (or do whatever).

I know it’s a very ridiculous idea (and I have no clue how lag-intensive it may be) but it might be of use in a game that’s very CPS-intensive!

2 Likes

After I have seen this Post, I have made my own Anti-Auto Clicker.
I have put the File in my Github: OfficialValkyrie/Lua/main/Anti-Auto%20Clicker
You may use it if you want.
Took only 3 hours to code and to check if everything works fine.

1 Like

For me Detect Clicking Interval on client is better choice.
Also using RemoteEvent Isnt a Good Idea,. The Script Will Affect by Network Ping.

1 Like

what’re you doing this for? i feel like there’s a better alternative