My Animation Will Not Replicate

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I am trying to get my tool animation to work as intended, it is supposed to play when the player equips the tool.

  2. What is the issue?
    If I put the code inside of a server script, then the animation will not replicate to clients. And if I try to put the code into a local script, then the animation will play for the player holding the tool, but not for other clients.

  3. What solutions have you tried so far?
    I tried putting the code below into both, server and local scripts. For both solutions, it never showed the animation to other clients.

This is what it looks like when I try to put it into a server script
Client:


Server:



Here is what it looks like when I put it into a local script
Client:

Server:


(For some reason, it works on a dummy.)




Here is the code I am using:

local Shovel = script.Parent
local ShovelHoldingAnim = script:WaitForChild("ShovelHoldingAnim")

local function onEquipped()
	local humanoid = Shovel.Parent:FindFirstChild("Humanoid")
	local animator = humanoid:FindFirstChild("Animator")

	animTrack = animator:LoadAnimation(ShovelHoldingAnim)
	animTrack.Priority = Enum.AnimationPriority.Action
	animTrack:Play()
end

local function onUnequipped()
	animTrack:Stop()
end

Shovel.Equipped:Connect(onEquipped)
Shovel.Unequipped:Connect(onUnequipped)
2 Likes

Have you tried using a RemoteEvent yet?

No. I will try that right now, also shouldn’t an animator automatically replicate?

Well, I’m not sure why it won’t replicate. I’m honestly not too advanced with animations myself, but when working with them on my own, RemoteEvents seem to work well for me.
Another thing is that my animations seem to look quite different on a dummy, from a player. Did you make the animation with a dummy or a player character?

Yeah animations played on the client should replicate to other clients, this is quite weird.

So… I found out why it wasn’t working. The animation was not working because I had to update the animation’s priority on both, the server AND the client. :expressionless:

1 Like