Issues with replicating animations

I didn’t have this problem before, but for some reason (maybe due to an update, not sure) this has been happening for the last couple of days. Animations aren’t replicating correctly between clients.

  1. What do you want to achieve? I simply want the animations to play properly in every client, without being overwritten by running animation (or other default ones).

  2. What is the issue? https://gyazo.com/47969d883b7cc8957299b4746500c9f1 My main issue is that it either doesn’t play on other clients, or it does but it gets overriten by default animations.

  3. What solutions have you tried so far? I tried looking for a solution on DevForum and other servers, however I haven’t found anything useful yet. Initially I was playing the animations on the server; so I tried playing the animation on the client. Didn’t work either, so I tried playing the animation on every client through a remote event from the server.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

This is what I have so far:

-- (ServerSide)
    remote:FireAllClients(hum,anim)

-- (Script in StarterGui)
remote.OnClientEvent:Connect(function(hum,anim)
	local anim = hum:LoadAnimation(anim)
	anim.Priority = Enum.AnimationPriority.Action
	anim:Play()
end)
1 Like

I believe that for some reason that Player2 doesn’t see when Player1 turns, so when Player2 does the animation on the client it moves Player1 in the wrong direction. Why don’t you just do the animations on the server?

1 Like

Yeah playing the animation on the server was what I initially had, but it didn’t work.

Hello. Animations do not have to be replicated by you, as you can simply play it on the client and it is being replicated automatically. I suggest to always play them on the client, so you may have to less deal with Remote Events i.e use more precious network. Good luck :pray:

1 Like

So some things might fall into my mind. Its fully possible to do animations from client that replicates to the server.

  1. Have you made priority action in the animation by default?
  2. Preload the animation by doing preloadAsync.

Have you tried this?

--- Preloading Animations ----

-- I usually have a folder with my clientanimations

local ClientAnimations = game.ReplicatedStorage:WaitForChild("ClientAnimations")
local ContentProvider = game:GetService("ContentProvider")
local assets = {}
for i,v in pairs(ClientAnimations:GetChildren()) do
	table.insert(assets,v)
end
ContentProvider:PreloadAsync(assets)

-- make some paths to the animations
local Animations = {
	ChestAnim = ClientAnimations:WaitForChild("ChestAnim"),
	SpinMachine = ClientAnimations:WaitForChild("SpinMachine"),
       Dash = ClientAnimations:WaitForChild("Dash"),
}
-----------------------------

--- get the humanoid of the character 

local Humanoid = .....
local Track = Humanoid :LoadAnimation(Animations.Dash)
Track :Play()

Turns out I kinda fixed the issue by disabling the animate script while it’s playing the animation in question, I don’t really know if it’s the best choice tho, and I still don’t know why it happens.