Replicate static mesh rotation

i have a cube inside my character that rotates towards the mouse location with this function

my player and the cube has replication enabled but currently the server is the only one replicating his rotation…
with this i mean that the clients get the rotation of the host, but they don’t get the rotation of the other clients

how do i solve this?

also the host is not getting the rotation of the clients

Replication always only happen from the server to the clients never from a client to a server. If you set a replicated variable client-side the server never knows about it because a client can’t replicate things on itself. What you have done is fine you just need to send the rotation through a RunOnServer event and also set it on the server. Then if the cube component is set to replicate and the Character it lives on is also set to replicate + replicate movement then the server will finish the replication back to the other clients.

so i can do this with a RunOnServer and a multicast(i could even disable the cube replication this way) but what about the send rate? if i send this rotation every client’s tick then wouldn’t that saturate the server? like what would happen if the client haves 600fps, it would be calling that function 600 times per second?

Yes you should not send the updates more often than needed however if you got the bandwidth it is the simplest way of doing it. If you want to do it a more bandwidth friendly way you would have the CPU predict the rotation between server updates. It quickly becomes very complicated as you can see in the CharacterMovementComponent that does a lot of work to make it as smooth as possible.

so what would be the best approach to set a fixed send rate for the rotation?

have a float variable that increases with deltaTime and when it reaches a number set it to 0 and send the data?

having an infinite while with a delay node?

use a timer?

You could use a looping “Set Timer By Event” node and have it send the RunOnServer RPC if there is any significant change since the last sent rotation. You could pause it when no movement is happening and immediately wake it up again (set + resume) when movement is detected.

And you can always lerp the rotation between its current rot and the rot received in the replicated variable or multicast. That way the rotation is happening smoothly on The clients even though the updates of where it should rotate to only happen every 1/4 second.