I am having an issue with the animations replicating on other clients OUTSIDE of studio.
In studio, it works fine with LocalTest and 2 clients, and even TeamTest with 4+ clients, the animations replicate just fine. But as soon as it’s published, the animation is only playing on the client that the pet is welded to.
Weld is done to the RootPart of the rig, anywhere else and the animation does not play on the rig in Studio.
What do you want to achieve?
Animations replicating on all clients.
What is the issue?
The pet animates for the player it’s welded to, but it does not play for anyone else.
What solutions have you tried so far?
I have tried playing the animations only on the client, while the duck is created by the server and parented to the Character of the client.
I have tried playing the animations only on the server.
I have tried playing the animations on the client, and then replicating to all the other clients via FireAllClients (filtering out the calling client).
I have tried setting network owner to the player when the pet is a Child of the Character.
Ensured none of the parts were massless in the Rig.
No parts are anchored in the Rig.
One interesting thing is, if you leave and join, other player’s pets will start to animate just fine.
The code itself is just loading the animation and playing it, whether it’s done on the server, the client, or all clients, it only plays for the Player the Pet is welded to.
--PetServer is a table/module.
---SERVER FUNCTION
PetServer.IdleAnim = Duck.AnimationController:LoadAnimation(PetServer.Assets.Animations.DuckIdle)
PetServer.IdleAnim:Play()
I’ve had this problem in the past and the problem turned out to be the speed of replication being different than when the animation was played. If the mount is being loaded and the animation is being played at the same time, it doesn’t replicate the animation for some reason. You can either wait some arbitrary amount of time before playing the animation or wait for the mount to fully load on each client the animation is replicated to before playing it.
The server creates the Pet and then loads the animation on an AnimationController in the pet. The animation does not play until Animator is a child of AnimationController. I tried adding a wait before loading any animations, or playing them, while the animation is being loaded and played from the server as you mentioned.
This did not resolve it however. I tried also firing to all clients once the animator has loaded (with and without the server playing the animation(s)), and then on the clients waiting for Animator to be a child of the AnimationController, and then loading the animation (tried on the AnimationController as well as the Animator instance), and playing it. This also did not work.
The replication thing makes sense, but for my case where the player equips the pet, the player equipping it will always see the animation, while the others will not. This is true even when there are 5+ people in the server, the player equipping it sees the pet animations but the others do not. This part doesn’t make sense to me as the server is loading and playing the animation, the clients are not doing anything (in some tests) yet still only the equipping player gets the animation.
Could you confirm if you Welded your mount or maybe used Motor6D? I am tempted to just do Motor6D animations at this point.
I don’t remember if I used Motor6D or a Weld, but I can definitely understand how using a Weld could cause issues. Roblox animations were created with the intent of Motor6D replication, I don’t think Welds replicate the same way.
It seems the welds were the cause, as soon as I removed the weld and used an alternate method (AlignPosition as a quick test) it worked immediately as expected. So it does in fact seem the weld is the cause, even though Team Test/Local Server test does not produce the issue we see in Multiplayer.