How would i get players speed on the server if its being changed on the client?

I have a script that plays footsteps when the player is walking and i want to make it so it plays faster when the player is sprinting and it works fine on the client, but it doesnt work on the server because the walkspeed is being changed by a local script. technically i could just keep it on the client, but i want other people to be able to hear the footsteps as well

You can send the speed to the server anytime it changes using a RemoteEvent.

1 Like

yeah but i feel like that wouldnt be optimal because of the client-server delay

What would not be optimal about it?

You can’t do anything about the client-server delay no matter how you decide to get this information, so don’t worry too much about it.

Wait for the speed to be changed on the client side and once its changed fire a remote event and include the speed as a argument. And on the server wait for it to be fired. Once it’s fired you can get the argument that has the speed. Then you can check if the speed is greater than the whitelisted speed and if it is you can kick them.