You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I am trying to sync animations between the server and client
What is the issue? Include screenshots / videos if possible!
Even though the animation script (copied from the normal local animate script) and is converted into a server script isn’t syncing the animations from the server to client border. The NPC network ownership is the server.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried to redo the getting the animation script but it didn’t work.
The animation script has all the correct children from the previous animate script. No Errors as well
EDIT: When you view the NPC in server mode the animations are being played correctly
However, when you are the local player the NPC animations don’t sync i.e. don’t play.
EDIT 2: The IDLE animation sync successfully though
In converting it to a server script you didn’t change anything at all? It might be worth checking there isn’t anything about the local player or anything LocalScript specific.
It shouldn’t be. It’s likely to be an issue with network ownership.
Are you explicitly setting the network owner to nil? When the animation fails to play for the client, print GetNetworkOwner() of the npc’s root part on the client and check it is nil. Also confirm that GetNetworkOwnershipAuto() of the npc’s parts is also false.
Okay good. So the only other things I can think of to check:
How have you added your animations? Editing the list in the script or adding them as children to the script?
If children, is the allowCustomAnimations variable the thing that’s stopping your animations from being loaded?
Are the animations showing as playing when you call GetPlayingAnimationTracks from the client that isn’t seeing the animation?
If you want to upload a quick placefile with your NPCs and your script I’ll be happy to take a quick look. It might be something obvious when seeing the script and the hierarchy.
The problem is somewhere in the way the animate script is working with the NPC and interacting with your follow script.
My advice would be to make your own simple animation script as it’s relatively simple to do and just swap your animations based on your Humanoid state.
If I play the animation directly on the NPC using the server, it appears absolutely perfect on client, whereas when I let your scripts do it, the looping is jerky on the server and the client behaves as you’ve described.
I think doing it yourself, making use of AnimationPriority and making these looped animations loop as they should do will net a better result overall, as well as bypassing this issue that we can’t find the root of without digging really deeply into it.
No worries. If you ever did want to make your own, you’d listen to the event
StateChanged ( HumanoidStateType old , HumanoidStateType new ).
You’d transition out any animation relating to the old state (by calling Stop() on the tracks with a transition time) and you’d transition in any animation relating to the new state.