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!

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 !

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

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