โ† Back to all scripts

Anti-Cheat Speed Detection

Detect and kick players moving faster than a configurable threshold.

SecurityIntermediateServerScriptService
anti-cheat-speed-detection.lua
-- Anti-Cheat: Speed Detection
local MAX_SPEED      = 100
local CHECK_INTERVAL = 1
local prevPos        = {}

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local root     = character:WaitForChild("HumanoidRootPart")
        local humanoid = character:WaitForChild("Humanoid")
        prevPos[player.UserId] = root.Position
        task.spawn(function()
            while character.Parent and humanoid.Health > 0 do
                task.wait(CHECK_INTERVAL)
                if not root.Parent then break end
                local dist = (root.Position - prevPos[player.UserId]).Magnitude
                if dist / CHECK_INTERVAL > MAX_SPEED then
                    player:Kick("Kicked: abnormal speed detected.")
                    return
                end
                prevPos[player.UserId] = root.Position
            end
            prevPos[player.UserId] = nil
        end)
    end)
end)
Something broken or not working?
๐Ÿ”ง Try the AI Script Fixer โ†’