I made this system for some guy a few months ago. It’s just something simple i did.
Make an afk detection system and if the user triggers it make them complete a captcha
Well in cases like these it helps to try and imagine how you would react in that situation. Say you missclick and the autoclick system detects it as an auto and you get kicked. You’re right that getting kicked isnt as bad, but it would still suck if you were in the zone then get kicked for something you didnt do. It would be confusing because you did nothing wrong but the game says “you auto” and might cause players to not return to your game.
However if you mean using an autoclicker to avoid the afk kicking system, im not sure thats possible. Its a game design flaw because you reward time spent in a game instead of players doing stuff like shooting or fighting.
what if a player isnt autoclicking and just happened to click that fast for whatever reason. Could be accidental, hardware malfunction, or even just fast fingers. Getting kicked would suck
Here, I wrote this in visual studio code soooo
local mouse = game.Players.LocalPlayer:GetMouse()
local lastPress = os.clock()
mouse.Button1Down:Connect(function()
local timeDelta = os.clock() - lastPress
print(timeDelta)
local cps = 1 / timeDelta
if cps >= 30 then -- limit number here
print("30 cps")
end
end)
if someone can click at a speed of 25 per second then they’re crazy.
i agree lol, they wouldn’t be human. But hey, gaming shouldn’t be exclusive to humans!
On a serious note, its very very unlikely but hey its definitely possible
Wow! These are great ideas! Thank you so much everyone. I would try them to see if they all work but, as you all know, Roblox is down.
Most autoclickers allow setting the interval manually, so doing as some answers suggest and checking if the player doesn’t click too much per second could’ve easly bypassed by setting the click interval to a bigger number.
I’d save the interval of the clicks, if for example 30 clicks share the exact same perfect interval then it’s most likely not a human. Then rather than kicking (to avoid kicking players by mistake) you can simply add a requirement like moving the character to be able to click again.
Otherwise you could simply make your AFK detection system account only for player movement and not for camera movement/clicks, so regardless of if they click or not they’ll be set AFK.
To detect if someone is AFK the best solution imo is to have an fire an event to the client requesting a response and then if the player clicks the prompt the client fires the server and the request is dropped.
There isn’t really a better method than that.
Yes, there are security issues with that but I am 100% certain it is the best method for detecting afkers. Alternatively you could have some mods in your game look out for robots and ban them.
When it comes to autoclickers you need to create a box and wiskers chart for the time between clicks. If the interquartile range is incredibly small (small deviation within ms) then it is most definitely an autoclicker. It will work for even slower auto click speeds.
In theory you could just check for range however you may run into false positives if the amount of clicks recorded is not large…
To detect a certain amount of clicks you could just make a script that updates every second, which sets a value to 0 and when the player clicks that value increments by 1, so basically:
local clicks = 0
local maxamount = "put your max clicks per second how much you want (as intvalue ofc)"
local plr = game:GetService("Players").LocalPlayer
local mouse = plr:GetMouse()
coroutine.wrap(function()
while wait(1)
if clicks >= maxamount then print("Autoclicker has been detected!") end
clicks = 0
end
end)()
mouse.Button1Down:Connect(function()
clicks += 1
end)
BUT
What if the player has an autoclicker that clicks every one second or at a long amount of time? It won’t be detected at all, so what I recommend is to make a script where it checks every second if the player has moved, if not, after an amount of time the player gets clicked for afk. (By the way I don’t know if the script works properly since I can’t test it out due to Roblox’s problems)
EDIT: I wrote “click” instead of “clicks” at line 9
Yes, this script above does detect if the user has a fast auto clicker, but It’s not friendly because it’s in a local script, and then it’s really hard to work around it, I suggest making a Remote Event called “OnClick” (You can name it whatever you want), and then whenever the player clicks it fires the event, and then on the server-side, you just check how much Remotes you got from the person if it didn’t exceed the “maxCPS” then continue with the script normally
Local script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("OnClick")
local textButton = "....." -- Im assuming you are pressing something, so it might be a text button
textButton.MouseButton1Click:Connect(function()
Remote:FireServer()
end)
Server Script:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("OnClick")
local CPS
local maxCPS = 25 -- Set this to anything you think an autoclicker makes
local playersFiredWhileLoop = {}
Remote.OnServerEvent:Connect(function(player)
if not player.CPS then
CPS = Instance.new("IntValue")
CPS.Name = "CPS"
CPS.Parent = player -- You can set it wherever
CPS.Value = 0
else
if not table.find(playersFiredWhileLoop, player.Name) then
table.insert(playersFiredWhileLoop, player.Name)
coroutine.wrap(function()
while true do
wait(1)
CPS.Value = 0
end
end)()
continue
end
if CPS.Value >= maxCPS then
print(string.format("%s is using an autoclicker!", player.Name))
else
-- Player is not using an autoclicker, and you can proceed with whatever you were doing for example:
player.leaderstats.Coins.Value += 1
end
end
end
end)
Players.PlayerRemoving:Connect(function(player)
if table.find(playersFiredWhileLoop, player.Name) then
table.remove(playersFiredWhileLoop, table.find(playersFiredWhileLoop, player.Name))
end
end)
I wrote this code in 1 shot, so if there are any errors please reply and I will try to help you as much as you can,
If you are confused about some parts feel free to reply as well because it is kinda long for just an auto clicker detection system.
I wouldn’t bother and instead try to design my game so that having an auto clicker isn’t that advantageous. But if you really need to make an autoclicker detector for whatever reason, then I would suggest instead of making a script that detects fast clicks, make a script that can detect very consistent clicks as it is very possible for a human to click as fast as an autoclicker but very unlikely that even for a few seconds it could click as consistently as an autoclicker. While it may be possible to make an autoclicker that emulates inconsistent clicks, most people would use an off the shelf all purpose autoclicker for autoclicking.
You just can make one cooldown on the player mouse if the player doesnt respect that cooldown then he get kick.
As some others have said, detecting and punishing auto-clicking should be less of a goal than building a gameplay loop that can’t benefit from it. Auto-clickers have options built into them to help avoid detection, and monitoring player movement to identify inactivity can also be spoofed with auto-key programs.
If you want to take the bleak capitalist approach to this issue, players idling in your experience only benefits you. It boosts engagement stats and improves premium payouts where applicable.
If the concern is balance-oriented, you could potentially lean into the issue and build some sort of “offline” system where users can still earn money or what have you when offline for some limited period of time, both disincentivizing “active” idling and bridging the progress gap between users who do idle and those who don’t.
I wouldn’t detect clicking, I would detect movement.
Maybe like checking every characters Humanoid.MoveDirection and checking if the magnitude is bigger than 1 each like 3 seconds.
If they aren’t moving, add to a counter and if that counter is bigger than, lets say, 40, the player is counted as afk.
local count = 0
local afk = false
while true do
task.wait(3)
if humanoid.WalkDirection.magnitude < 1 then
count+=1
if count > 40 then
print("Player is afk!")
afk = true
end
else
count = 0
afk = false
end
end
Well yes. That would work too.
But you may have a performance drop if there are a lot of players. Also, note that it wouldn’t really work for games where the players doesn’t really move a lot e.g. Border Games, Driving games RTS et cetera
However, that being said I would say if you don’t detect movement after a period of time that would be the time when you will want to check if the player by firing a remote event…that being said it still is exploitable.
Several things you need to factor in;
-
Is the speed human?
As jitterclicking is a thing and you would also check the cps on the server so its susceptible to lag i would allow a cps of up to 20-25 -
Are they consistent?
Machines are consistent, humans are not
If the player is maintaining the exact same cps for ~10 seconds in a row, they’re probably using an auto clicker -
Do they get tired?
When theyre on a “clicking spree”, so like above 8 cps for example, check if they get tired, personally I would look for at least 10% decrease in speed each minute if their “clicking spree” lasts for at least 2 minutes -
Are they AFK?
I would promt a GUI every once in a while that will ask of the player is still active but the location of it will be randomized so they cant leave the autoclicker on it and have a generated encrypted string that would send on the remote event back to the server in order to verify that it wasnt just an exploit simulating a remote event -
How long are they playing?
Honestly, its very unlikely someone will play a clicker game for 8 hours straight, if they do just kick them! They can always rejoin.
Uh, you could check the amount of clicks and the interval between each click. While it can be bypassed, you’ll need to install an executor or some other 3rd party software onto your system and 99& of people won’t do it.
a solution i can think of is having a GUI that appears randomly every time it pops up, it appears at random intervals but around a range good enough to not annoy the player.
the GUI can “spawn” in a random position within the player’s screen and they must respond to it or they get kicked.
if the GUI appears in random positions, it’d be harder for an autoclicker to locate where it’s going to appear