I thought of this method earlier today. I guess i’ll explain it.
game.Players.PlayerAdded:Connect(function(plr)
local function CharacterAdded(Character)
local Humanoid=Character:WaitForChild("Humanoid")
local HRP=Character:WaitForChild("HumanoidRootPart")
local StoredTime=4 -- JULIUS NOVACHRONO!!!!!!!
wait()
local StartPos=HRP.Position
if plr.Parent and not Character.Parent then
repeat Character.AncestryChanged:wait() until Character.Parent
end
while Character.Parent and Humanoid.Health>0 do
local TimeElapsed=game:GetService("RunService").Heartbeat:wait()
local dist=(StartPos*Vector3.new(1,0,1)-HRP.Position*Vector3.new(1,0,1)).magnitude
StoredTime+=TimeElapsed
if StoredTime>4 then
StoredTime=4
end
local MaxSpeed=16
local ClientTime=dist/MaxSpeed
if not Character:FindFirstChild("TPExemption") then
Character.TPExemption:Remove()
StoredTime-=ClientTime
end
print(StoredTime)
if StoredTime<0 then
Humanoid.Health=0
end
StartPos=HRP.Position
end
end
local char=plr.Character or plr.CharacterAdded:wait()
spawn(function()
CharacterAdded(char)
end)
plr.CharacterAdded:Connect(CharacterAdded)
end)
StoredTime is essentially how much movement the player can do before the script kills them. For example, if I have 2 seconds of stored time and my expected walkspeed is 16, I can teleport 32 studs, but I will lose my 2 seconds of stored time.
StoredTime goes up by the amount of time that passes. So if I stand still, I will have 4 storedtime after 4 seconds. Exploiters can technically teleport by their precise amount of stored time, but they will lose it all and have to wait before moving quickly again. I let people store up to 4 seconds in case they are lagging and don’t update their position on the server for a while. When they do, they will appear to have suddenly teleported on the server.
Speed hacking is still technically possible with this, but as I said earlier, they’d have to budget their stored movement. If there were a speed hacker and a normal player racing toward a finish line, the normal player would basically always win because the hacker would have to be careful not to overshoot.
The good thing about this anti-exploit is it won’t ever misfire unless the player has a ton of ping or is truly exceeding the speed limit. You can input 16 walkspeed as the max, and be confident that an exploiter going 25 will eventually be stopped. You don’t have to inflate max walkspeed to adjust for lag.
Also, you might want to just teleport players instead of killing them. This is more forgiving in case of flings, and I’ll definitely do that but I heard there was an exploit that lets players circumvent being teleported by the server.
One last thing, 4 stored time is kind of a lot to exploit on so one thing I may do is cap storedtime at 1 after the character’s position significantly changes, since a character who just went from 0.3 > 0.6 probably isn’t going to go all the way to 1.4 because of a lag afterwards. Or maybe they will. I don’t know.