Simple Anti-Speed check script I made. In my game there’s no teleportation or other things that would change the players position. My concern is if the players ping is super high. It might cause a false check, is it possible to reduce that false positive or check the ping of the player?
local Players = game:GetService("Players")
local CHECK_INTERVAL = 1
local MAX_DISTANCE_PER_TICK = 30
local function monitorPlayer(player)
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local lastPosition = hrp.Position
while player and player.Parent and character.Parent do
task.wait(CHECK_INTERVAL)
local currentPosition = hrp.Position
local distanceMoved = (currentPosition - lastPosition).Magnitude
if distanceMoved > MAX_DISTANCE_PER_TICK then
warn(player.Name .. " detected for speed hacking! Moved " .. distanceMoved .. " studs in " .. CHECK_INTERVAL .. "s.")
character:BreakJoints() -- Kill player
break
end
lastPosition = currentPosition
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
coroutine.wrap(function()
monitorPlayer(player)
end)()
end)
end)