A new way to stop speed hackers?

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.

9 Likes

This is how most people detect speed hacking, so I wouldn’t call it new per se. Also, I might recommend using tick() instead of a storedTime value.

5 Likes

Clever way of doing it, but you should probably add leniency for laggy people aka fps < 10 or base the leniency on server/client ping.

ik a trick keep looping the speed script called 14 :slight_smile: so hackers try changing the speed and it become to 14.

2 Likes

Good system but I coded a anti speed hack system which took 2-3 lines of code if you are a simple lad you can use that way.

Really good, but what if you are trying to speed your character up. What would happen then, eh?

Impossible. Simply impossible. Need more proof. Don’t try and compare his to yours. Maybe you have more experience, but sometimes longer is better than shorter. Longer scripts (well yes they can have bugs) have more proof showing they stop hacking.

No, that was my first script that I ever wrote and I got it from a YouTube tutorial.

1 Like

Good script but I have a question, if you have an admin (Adonis HD, etc…) script installed and someone you gave admin changed their speed, would they also get detected by the script?

If I would add admin I won’t use a free model because they will get detected on there so I would make my own admin because I like having control over it.