You can write your topic however you want, but you need to answer these questions:
-
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. -
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. -
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)