What is the best way to replicate player movements to the server or other players?

Basically what I’m asking what is the best way to replicate this to the server:

I’ve tried replicating it directly to the server and it ends up laggy for other players. I’ve also tried replicating it only to players clients, it works but starts to lag with multiple players or has a bit of a delay.

Whats a good what to do this and be smooth as some of the front page games that also do this?

What I do is, I do the calculations on the original player then replicate the C0’s to the server every 0.2 seconds when mouse movement is done. The server then fires all clients with the C0’s and on the client I check how far away the player who fired is, if he’s closer than 300 studs I lerp their current Motor6D C0 value to the newest one for it to look smooth.

2 Likes

Replicate camera position and the position it’s aiming towards on a loop (every 0.2 to 0.5 seconds), have localscripts modifying the visual elements based off these inputs.
If it’s laggy it’s because it is too heavy on processing and could be optimized/ could use shortcuts. It should really only lag from a “my computer struggles processing it” standpoint, not a “server can’t keep up with requests” sort of way.

I explain a solution here: Replicate Motor6D

2 Likes

What we do at https://www.roblox.com/games/186847702/Update-Temple-of-Memories for head turning (thanks @Flubberlutsch for the maths) is to just send over the pitch and yaw (two numbers calculated using the camera and head properties) over at a rate of 0.1 seconds, then tweening it for other clients.

1 Like