Will animations loaded and played on the server replicate to the client?

Basically, If I can have the animation be played on the server I can avoid some latency.

Currently the server realizes an event, fires a remote at the client, and the client plays the animation. But that has a factor of latency to it. Not only will it take time for the animation to be seen by all players, it also has the double lag of communicating to the client it needs to play the animation.

It would also help me organize my code since I would be able to cut out a local script from current architecture.

Anything that happens on the server replicates to the client as far as I am aware, so the answer to your question is yes.

However, you will still encounter latency if you play the animation on the server, as the replication process takes time. What you should do instead is handle all the animation on the client. Local changes to the character model, such as with animations, are replicated to the server - this being one of the few exceptions to the rule. This would be the best way to eliminate latency for the player who is being animated.

1 Like

So, animation replication is faster from client to client, then server to client?

Anything ran on a localscript has no latency to the client that ran it (So if I ran a localscript on my machine I would see it run without any latency), but If the animation replicated from one machine to another machine then the machine on the other end (not my machine) will have latency. And iirc animations done in a localscript do replicate to other clients.

Also I am pretty sure replication does not work that way either. It instead goes from: client -> server ->> All clients

1 Like

So then if I wanted to normalize latency between all devices I would load and play on the server?

The reason I want to play the animation on the server is because the animation happens after an action that needs to be verified by the server. I could avoid some latency by just having one section of replication rather than two, if you follow me.

You can’t just make the latency for all devices the same… Imagine if me, and you were playing a roblox game, and you were in for example Europe, and I was in america, our latency would be depending on how far away we are from the roblox servers, and what is happening in the game.

You can play the animation on the server… I don’t see why not (I have tried it, and I have failed) but you will have less latency because the will animation replicate (If being played on the server) from server to all clients, rather than one client -> server -> all clients

1 Like

Anything on server will replicate yes. You can let a client handle the animation and go via the server then to everyone else. You can also play all animation on each client.

It’s not that I want to normalize latency (since that’s of course impossible), I just want to reduce the amount of obstacles animation replication has. But thanks I’ll test it out!

Just play the animation on the server, and you should be good :).

Playing animations on a client will automatically replicate it to other players. Just remember that what a client does, gets replicated to the other players through the server, so there will be delays because of this.
Creating a system for this is possible to do, but Roblox has already done it for you.

1 Like

Yes, they 100% will. I have played animations on the server and it works the exact same.

This depends very heavily. Clients require network ownership to have any authority over replication and in that regard it’s only physics replication. Clients are only capable of replicating animations because of the Animator object that the server creates in the Humanoid. Without it, animations played by the client will not replicate.