Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Whats the math for 16 walkspeed according to position?

So Im trying to make a anti exploit and if their walkspeed is just above 16 I will teleport them back to the position but I dnt know the math for 16 walkspeed I heard its studs per second

so for example since u cant see walkspeed on the server

Player walks 20 studs per second then I teleport them back

1 comment

0

Probably a good idea to make it higher due to people with bad internet which makes them look teleporting to the server

1 answer

Here is a script that will print warnings when players travel faster than their WalkSpeed.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		-- wait for character to be inserted into Workspace
		character.AncestryChanged:wait()
		
		local lastPosition = character.HumanoidRootPart.Position
		
		while character.HumanoidRootPart:IsDescendantOf(game) do
			local actualTime = wait(1)
			local expectedMaxDistance =
				character.Humanoid.WalkSpeed * actualTime
			local actualDistance =
				(character.HumanoidRootPart.Position - lastPosition)
				.magnitude
			local actualSpeed =
				actualDistance / actualTime
			
			lastPosition = character.HumanoidRootPart.Position
			
			if actualSpeed > character.Humanoid.WalkSpeed then
				print(player.Name.." might be using hax! They traveled at "
					..actualSpeed.." studs/second, but their WalkSpeed is "
					..character.Humanoid.WalkSpeed..".")
			end
		end
	end)
end)

Note that this doesn't account for falling, network rubberbanding, inaccuracies in the Roblox engine regarding character speed, changes in position due to spawning, etc. Tracking a player's speed should only be one small heuristic used alongside other methods to determine if hacks are being used!

This discussion is preserved as it was. New answers, comments, and votes are closed.