Help with pet animation replicating to other people

Hi, :wave: i’m salty and I built a custom NPC (a pet) rigged perfectly and I’m using an animation controller doing :LoadAnimation() on the server to load the animations like the wiki says to do if you’re working with a non-character model.

The anims show to everyone but when I load them and play them on the client it doesn’t replicate to other people. Please help me I’ve been looking at other posts and reading trying to find (even scoured scriptingHelpers) nothing I’ve seen has helped me with this. Just to summarize I want to figure out how to play animations from the client and still have them replicate to other players.

EDIT** there are 2 solutions to this problem, 1 is to parent the pet model to your character that way the animations will replicate. The other is to make a remoteEvent to signal to the server whenever you want to play the animation and use :FireAllClients().

1 Like

Kinda a ducktape solution here:

  • Every RenderStepped fire the pet’s PrimaryPart CFrame to the Server via a RemoteEvent
  • OnServerEvent SetPrimaryPartCFrame the pet, the given CFrame.

What’s the problem with Playing the animations on the server though?

2 Likes

Have you tried putting the pet model as a child of your character model? Kind of a hack but it might work.

1 Like

From the sounds of it, your trying to display whats happening from the client, onto the server, but I haven’t heard (or read) the use of a remote event to transfer the information to the server… :wink:

1 Like

If it plays for the individual client that loads it, you could have a remote event (don’t use a remote function) that listens for an Animation Play Request, then play said animation on the target pet, ignore the original client but have other clients listen to this. this method also allows you to filter out specific request ids rather then allowing anyone(an exploiter) to fire the remote event.

Original Players Pet - > Remote Event - > Verify by server - >Remote Event → send back to other players - > otherplayers load/play on each client

However, loading from the client should indeed work and replicate no problem I do this all the time. Is the pet a non-humanoid, that could be an issue, actually. Try parenting the pet to the character (server side) this is likely the issue. The character model replicates animations as it has network ownership of its self. A client cannot run an animation on something that it doesn’t have network ownership of and have it replicate that would be a be exploit waiting to happen.

" If an Animator is a descendant of a Humanoid or AnimationController in a Player’s Character then animations started on that Player’s client will be replicated to the server and other clients.

If the Animator is not a descendant of a player character, its animations must be loaded and started on the server to replicate."

1 Like

I don’t think that would be very good on the performance, probably even a timeout

this worked, thanks! but i’m getting some weird effect now when I jump and the pet is behind me (moving around obstacles) my character bolts forward for some reason is it cause the pet physics or something?

Well, I know that welding anything to the player causes strange results. Perhaps you have some colliders enabled on the pet, that are causing this.

well the pet is like the ones in adopt me, they’re their own character and my system now is I send a remote signal to the server every time I want to play the pet animation for other people to see, it :FireClient() every player but the player that sent the signal (player who sent signal’s anims play locally)

That’s what you want tho.

I think someone already mentioned, but you wan to to use your client to send a signal to the server, the server should then return a signal to each client, signaling your pet to animate.

Ultimately, you could just call the animation from the server, and use a remote to contact all players on the server, including yourself.

well then your perception of your pet wouldn’t be as smooth. Playing the anims locally are always smoother… it’s like firing a projectile you want the client to see the effects immediately, not .3 seconds later

I’m not 100% sure about this, but I’m like 35% sure. If you give yourself NetworkOwnership of the animal/npc, you can just play an animation on the client, and it’ll automatically replicate to other clients because you’ve ownership over it.

1 Like

I did try this already and the animations don’t show for other people, I even looped through every instance of the BasePart class in descendants and set network ownership but still no luck