Animation not playing when tool activated

The title says it all! This script below is a script in a tool

local Anim = script:WaitForChild("Animation")
local Hum = script.Parent.Parent.Parent:WaitForChild("Humanoid")
local Dance = Hum:LoadAnimation(Anim)
script.Parent.Activated:Connect(function()
    Dance:Play()
end)
1 Like

Is the animation priority set to action?

I used moon suite, so I don’t know if I have to do that…

Set the animation priority to whatever it fits.
More information: AnimationTrack
Dance.Priority = (whatever you want.)
I should also mention that it is much recommended to use FindFirstChildWhichIsA than FindFirstChild in humanoids’ case.

is the animation priority to Action? If not then export it again and set it to Action.

You don’t have to do that, you can directly set the priority via the animation’s property.

1 Like

Yeah it already is at ‘action’

You can also set it in the script.

1 Like

What do I do now? (30 charsssss)

Are you sure the character is the same as the animation? (R6 - R6 / R15-R15)

Still doesn’t work though…

it’s supposed to be a LocalScript.

The way you should get your humanoid properly is with the LocalPlayer and not script.Parent.Parent… etc.
tool.Activated does not run on server scripts so yeah, must be that your mistake.

local anim = script:WaitForChild("Animation")
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local hum = char.Humanoid
local Dance = hum:LoadAnimation(anim)

script.Parent.Activated:Connect(function()
    Dance:Play()
end)
3 Likes

Is the humanoid path correct?
Did you try to print once the tool activated?

Why are there so many parents? If it is just the Character you want, and the script IS inside a tool, do this:

local Hum = script.Parent.Parent:WaitForChild("Humanoid")

Or you can try FindFirstChildWhichIsA(‘Humanoid’)

1 Like

How can you make the animation show for everyone in the server then?

Depending on if the player has fully loaded or not, WaitForChild is more efficient, since it waits for the Humanoid to load.

Nice suggestion though, both work.

Just play it on the client, it will show.

The client already replicates to the server when playing animations from what I have seen and been taught.

1 Like

I agree, let’s not forget that also WaitForChild can also wait for another object with the same name you provided.

1 Like