Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local CHECK_INTERVAL = 2
- local MAX_DISTANCE_PER_5S = 100
- local function monitorPlayer(player)
- player.CharacterAdded:Connect(function(character)
- local hrp = character:WaitForChild("HumanoidRootPart")
- local positions = {}
- while character and hrp and hrp.Parent do
- table.insert(positions, {
- time = tick(),
- position = hrp.Position
- })
- for i = #positions, 1, -1 do
- if tick() - positions[i].time > 5 then
- table.remove(positions, i)
- end
- end
- if #positions >= 2 then
- local first = positions[1].position
- local last = positions[#positions].position
- local distance = (last - first).Magnitude
- if distance > MAX_DISTANCE_PER_5S then
- warn(player.Name .. " is moving too fast! Distance: " .. math.floor(distance))
- -- player:Kick("Speed hack detected.")
- end
- end
- wait(CHECK_INTERVAL)
- end
- end)
- end
- Players.PlayerAdded:Connect(monitorPlayer)
Advertisement
Add Comment
Please, Sign In to add comment