I’ve been thinking more about client replication with a project I’m working on and stumbled upon the fact that animations played from the client on the same player (Players.LocalPlayer) will automatically replicate to other clients.
To demonstrate this, I did the following in a Baseplate template with an R15 dummy and 2 players:
From Player1’s client (LocalScript + check that Players.LocalPlayer.Name == Player1):
Run a dance animation on Player1
Run a dance animation on Player2
Run a dance animation on the dummy
The result:
On Player1’s client, all players are dancing
On Player2’s client, only Player1 is dancing
Conclusions:
An animation played from a player’s client on the same player will automatically replicate to other players
An animation played from a player’s client on a different player (or NPC) will not replicate to other players
My Questions:
Where does this automatic replication occur?
Can this automatic replication be turned off?
Does automatic replication exist only for animations? If not, what is the complete list of client actions that will replicate automatically?
Review this documentation guide to learn about why there is an automatic replication for animations.
For your example, I’m guessing the animation is in the games files, therefore loaded in every client. And since the client has Network Ownership of it’s avatar, playing the animation on their avatar will automatically replicate this to the server. You can avoid this by locally loading the animation using InsertService. For example, in a local script, use:
hey thanks for the response Tyler - I have some more follow up questions but am testing some theories initially myself.
I think I understand what you mean with your solution - basically if the animation ID only exists in one client, then when the automatic client replication occurs the other clients won’t have the animation ID and effectively it wont play (i.e. the replication will still happen, but this is a little hack to prevent the other clients from having the data to play the animation).
However upon trying this:
I get the following error: InsertService cannot be used to load assets from the client
Could you clarify your proposed solution when you can? Thanks in advance.