I am working on an anti-cheat and I want to know if a player keeps repeating the same action for a few seconds.
How can I calculate how long is a player doing an action? (Example: If a player is jumping for 5 seconds without stopping, or without touching the floor, the script will kill him) Thanks.
This is a basic Anti-Cheat that covers basically everything, including health changes, jump changes, and speed changes.
Make this a SCRIPT and put it into PLAYERSCRIPTS
local Player = script.Parent local Human = Player.Character:FindFirstChild("Humanoid") Human.Changed:Connect(function() if Human.WalkSpeed > 16 then Player:Kick("Caught speed walking") elseif Human.JumpPower > 50 then Player:Kick("Caught changing jump power") elseif Human.Health > 100 then Player:Kick("Caught changing health") end wait(1) end
And also, here is the script you requested: It stops a player from jumping more than once in five seconds. Put this one in PlayerScripts and make it a normal Script
local Player = script.Parent local Human = Player.Character:FindFirstChild("Humanoid") Human.Changed:Connect(function() if Human.Jump = true then Human.JumpPower = 0 wait(5) Human.JumpPower = 50 end end
Hope this helps!