How to make an Anti-Auto-Clicker?

Localscript in StarterPlayerScripts

local MaximumClicksPerSecond = 15
local KickMessage = ""
local PrintClicksPerSecond = false




local Player = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local Clicks = 0
local function onInputBegan(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		Clicks += 1
	end
end
UserInputService.InputBegan:Connect(onInputBegan)
while wait(1) do
	if PrintClicksPerSecond then print("CPS: "..Clicks) end
	if Clicks >= MaximumClicksPerSecond then
		Player:Kick(KickMessage)
	end 
	Clicks = 0
end
5 Likes

That works but It’s only really useful depending on what u need it for, if it’s a grindy game someone autoclicking 14 cps for days straight would bypass that, if the game is about clicking as fast as possible then people who can legitimately click 15+ cps won’t have a good time

Branching off what axospheric said,

You could record the os.time() say 10 times, and then if the difference between each click each time then kick the player,

Click.rbxl (31.8 KB)

Added things I read from replies on the post, not sure if they are correctly done though

I know this script is not perfect but this is what I use when I decide to detect auto clickers.


local time1 = 0
local time2 = 0
local sus = 0




userinputservice.InputBegan:Connect(function(input, gameProcessedEvent)
	local inputType = input.UserInputType
	if inputType == Enum.UserInputType.MouseButton1 then 
		if gameProcessedEvent ~= true then
			
			print(time1,time2,sus)
			if time1 == time2 then
				time2 = time1
                                time1 = 0
				sus += 1
			else
				time2 = time1
                                time1 = 0
				if sus > 0 then
					sus -= 1
				end
				
			end
		
		end
	end
end)

while true do
	wait(.1)
	time1 += .1
	if sus >= 30 then
		game.Players.LocalPlayer:Kick("hi")
	end
end
2 Likes