Am I doing this wrong?

So basically what I am doing right now is animating players on the server.
And I am assuming this will cause lag on the server.

So should I put this on the client or server?
Assuming client,

1 Like

Animating players should be done on the client because the client has network ownership of the player. It also just relieves the server of a job to do, so would possibly help out the server with lag.

2 Likes

Roblox animates on the server, because if a player is running around, everyone needs to see it.

If your animations require that every client connected to the server needs to see them, then you have no choice but to animate on the server. That is the only way the animations will replicate to all clients connected to the server. If the animations are private to the player and do not require the other clients to see them, then it is prudent to farm the animations out to the local client. This will prevent unnecessary workload on the server which is the root cause of lag.

2 Likes

This is inaccurate information. Animations loaded onto the player’s character from the client-side currently automatically replicate to other clients. It’s not recommendable that you play animations on the server directly. If possible, you should never do visuals on the server-side.

4 Likes

The information has been misinterpreted or more accurately under explained by myself. All visuals should be generated entirely client side, ALL visuals. The control system to manage the replication of visuals should be done on the server, i.e. a client request a visual from the server and the server replicates the visual to all clients.

If I was to do animation on the client, How would I go about using animation events?

AnimationEvents can be used on the client and the server. Every AnimationTrack has an method called GetMarkerReachedSignal. GetMarkerReachedSignal returns a RBXScriptSignal that fires every time an event with the given name has been reached.

These markers are automatically replicated to the server. Hope that helps you :slightly_smiling_face: