Displaying the same difference of character position on both clients?

I’m making something where someone is racing someone and when they press W their speed goes up by 1. And the character is being moved by a bodyvelocity with velocity Vector3.new(speed, 0, 0). The velocity update is being done by the server. But I also need to check the distance of the two characters on Stepped on the client and on Stepped on the server for every instant. However, they report different things regarding the positions of the characters. For example, the server can report <10 studs of difference but one client can say >10 studs and the other client <10 studs and the difference is significant (>= 2 studs).

EDIT: also, I have a textlabel on the client’s screen displaying the exact distance between you and the other player too. I unfortunately can’t constantly send a remoteevent from the server to the client telling them the distance (obv cause of rate limit). This is the main problem I guess. I need both clients to display the same difference of studs that the server has.

How do I make it the same? Is there a way to synchronize the positions of the characters? Something else?

1 Like

This is due to the delay caused by replication between client and server.
Each client will see an accurate depiction of their own position, but all other players will appear slightly behind where they actually are (according to the server). This means that if two players are side by side, both players will think they are ahead.

The only solution I can think of for this would be to only check on the server (since the server should be validating the results of the race anyway), and then telling the clients the result through a RemoteEvent.

1 Like

I’ve thought of that, but I have a textlabel on the client’s screen displaying the exact distance between you and the other player too. I unfortunately can’t constantly send a remoteevent from the server to the client telling them the distance (obv cause of rate limit).

1 Like

Clarified some things up, bump

Bumping this again. If it’s impossible, then here’s a (potentially) easier question because I have no other alternative. Say I remove the textlabel that displays difference of studs on the client, can someone tell me how to potentially avoid rate limit spam when crossing a certain distance? Say, if server finds >=10 studs of difference, a warning event gets fired to the client. It then clears once you get <10 studs of difference. But obviously you can cross and uncross this many many times in like a second which will cause too much remotes being spammed. And, again, since I want unity I will have to rely on the server and not have the warning (dist check) be implemented on the client IF we were to go along this way.

If there is a way to do the original thing as I mentioned in my original post then that would be better.