WalkSpeed does not replicates to Client

I had a Idea, if Players cheat and change their WalkSpeed on Client i could make a Loop in the Server to make the Walkspeed to 16 (I know that i have more Options, but i had this idea and wanted to try it).

game.Players.PlayerAdded:Connect(function(p)
	
	p.CharacterAdded:Connect(function(c)
		
		while task.wait() do
		
			c.Humanoid.WalkSpeed = 16
			
			end
		
	end)
	
end)

But why is this not working? I know that the Client WalkSpeed replicates to the Server but the Server Walkspeed also to the Client, so when i say c.Humanoid.WalkSpeed = 16, it should make the WalkSpeed to 16 all the Time, but why is this not working? When i call c.Humanoid.WalkSpeed = 16 without Loop it will work.

The walking speed does not replicate, only the position. You need to detect speed of the player through checking the amount of studs they travelled every second. @HeroGamerGabby 's solution is simpler. Clearly, I need to brush up on my API knowledge.

3 Likes

Uh, i don’t know but this doesn’t make any sense to me.

If you want to check if the player changes why don’t you just do.

You can change the Walkspeed to the server, but you can’t just continuosly change it.

If you want like to check if the player Speed is Bigger or Smaller than the original do this:

p.CharacterAdded:Connect(function(char)
      local Humanoid = char:WaitForChild("Humanoid")

      Humanoid.Running:Connect(function(speed)
              if speed > 16 then
                   p:Kick()    
              end
      end)
end)
3 Likes

I’m glad that my solution is clear! It’s not a problem i raccomend use the Roblox official API Engine, It’s new, simple and full of examples!!

This would not work, i dont clearly said it in the Text, the WalkSpeed of the Client dont replicates to the Server but the Position does. The Server can not detect if a higher WalkSpeed is there because WalkSpeed does not replicate to the Server, but from Server to Client work, but why dont it work with loops, i dont understand it, is there a Timeout when u can use WalkSpeed again?

Their code works. The speed parameter of the Humanoid.Running event is not the same as the walk speed. speed measures how much studs the humanoid has covered in the last second, using the position at the start of the second and then the position at the end of the second. It has no direct correlation to the walk speed.

As a side note, speed isn’t always equivalent to the walk speed, so instead of checking if speed > 16, check if speed > 17 since the speed could be something like 16.7 even though the player is not cheating.

Ah Thanks sorry i will test it, i thought the speed is connected to WalkSpeed

What would happen if the Player falls or drives a Vehicle? If the Vehicle drives 80 it would give approx 80 as a speed or?

If the player is in a vehicle, the Humanoid.Running event does not trigger. However, if the player gets out of the car, their speed will temporarily be equal to the car’s. You could ignore the player’s speed every time they are in a vehicle or if there is something else altering their speed.

Also, if you want to detect the player’s speed not just when they’re running, you can refer to this old, but still working topic:

Do note that this script will believe that the player is hacking if they are in a vehicle. The easiest way to overcome this is to have a boolean value called something like “ignoreSpeed” that you set to true if the player gets in a vehicle (or if something else is altering their speed). You would then modify the code of the topic above to only check for the speed if the “ignoreSpeed” variable is false.