Multiplayer networking - Setting character movement variable twice?


I’ve been in the process of creating a multiplayer game and decided to create a new project from scratch to see if I could fix a few things. One of these things being my player sprinting logic. The original way I had it set up was like this:

-> Left Shift Pressed -> run on server event called -> MaxWalkSpeed set from there.

Now this worked perfect from the server’s view, the server was able to see the client speed go up and down as it should. However, on the client side there was a very laggy and glitchy movement that just looked bad.

After searching the internet all day, I’ve put together what now works perfect on both the server and client and I have a few questions that maybe someone can help me out with.

  1. From what I’ve learned about networking, is this a good approach considering that the MaxWalkSpeed gets set twice?
  2. If so, should I be setting all of my replicated variables like this?

Thank you for any help!

  • Edit - The timeline takes the value from 200 to 600 smoothly and the variable IsSprinting is replicated

Try something like this:
Create variable isSprinting? and set it to RepNotify
Create event “SprintTimeline” (normal event), and put your Timeline and MaxWalkSpeed
Create event “Sprint” and set it Server (reliable) -> set IsSprinting? to true
In RepNotify function just call “SprintTimeline”
when you press the sprint button call “Sprint” (server) event

Thank you that worked great!!