Very simple anti speedhacks in serverside

like a millions of people, think magnitude is the only way to detect if the player is speedhacking or not, well they were wrong, somehow humanoid.Running could expose the client walkspeed so we dont need the friggin magnitude anymore, just insert a script in serverscriptservice
and write this

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
	local oldpos
	char.Humanoid.Running:Connect(function(spped)
		if (spped > char.Humanoid.WalkSpeed+5) then
			char:SetPrimaryPartCFrame(CFrame.new(oldpos))
		else
			oldpos = char.HumanoidRootPart.Position
		end
end)
	end)
end)

tell me if you bypassed it

BTW, this dosent detect teleports, just walkspeed so if you want teleport then yes, use magnitude instead.

4 Likes

The player’s walkspeed can change even when they don’t modify it themselves or the server doesn’t modify it. One example of when it can change is when you jump out of a seat which can sometimes fling you slightly which increases the walkspeed. Therefore, this detection is not as reliable as you think it is.

but thats less likely to happen. atleast better than getting false kicked for falling off a building.

It isn’t less likely to happen as if you try to jump out of a seat, there are many times you may be flung and that’s just one of the many reasons. Also, when did I say you should kick the player? For speed-related hacks, you should take server glitches/client lag or game mechanics into account and just move the player back (when intended) instead of kicking them.

better idea, so if that happens that guy will 1. not get flinged 2. be at the same place

well, thanks for suggesting, ill change the punishment to changing the player to old pos.

Also, humanoid.Running only detects when the player actually runs so that means that the player can just speed hack when climbing, swimming, etc, without the server detecting it with your method.

(also jumping while running can make the anti-cheat unreliable as it can make the player’s walkspeed increase)

well then connect that function to these events

Oh, and jumping while running, swimming, or climbing will fire the anti-cheat which is not intended.

well you can add another check to see if they do it multiple times to reset their walk speed and if it doesn’t fix them reset them or something (you can also reset their velocity when you teleport them back)

1 Like

I would suggest you add +5 like

spped > plr.Character.Humanoid.WalkSpeed +5

I use something similar before and Running don’t always return the right speed it can be a little more up or little more down

Fair, thanks for suggesting that.

I’ve literally never seen or heard of Walk Speed increasing when getting out of a seat, as far as I know unless the seat is poorly designed you shouldn’t be flung nor have increased speed. Sometimes on rare occasions you may be flung but I don’t think your walk speed changes.

(Also i think I know a bypass to this method, something called “Tpwalk” by a popular admin script called infinite yeild)

i love you. This works. just that I can continue to go for a few seconds before I back to my oldpos

But when you stop walking it should teleport you back( if you got detected by the script )

Here’s a video:

Here’s the placefile:
Proof.rbxl (34.2 KB)

It happens when you press space right before hitting the seat.

1 Like

I updated the script so it shouldn’t kick you anymore.

Interesting, I was never aware of that.

I made it more aggressive:

game.Players.PlayerAdded:Connect(function(plr)
	local Running = false
plr.CharacterAdded:Connect(function(Character)
	local oldpos
	local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
	if Humanoid then
	Humanoid.Running:Connect(function(spped)
	
		Running = true
		task.spawn(function()
			game:GetService("RunService").Heartbeat:Connect(function()
				if (spped > plr.Character.Humanoid.WalkSpeed + 5) and Running == true then
					Character:SetPrimaryPartCFrame(CFrame.new(oldpos))
				else
					oldpos = Character.HumanoidRootPart.Position
				end
				task.wait()
			
			end)
		end)
		if spped == 0 then
			Running = false
		end
		end)
		end
		end)
end)

1 Like

cool

And a good idea as humanoid.running does not run always or just runs when the running stops.

Yeah, thats why there’s the variable. So that it’s more aggressive. Way more accurate and easier than magnitude changing.