Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont this loaded animation play?

Asked by 5 years ago

There is no error when the tool is activated, but the animation wont play?

script.Parent.Activated:connect(function()
    local anim = script.Parent.Swing
    local loadedanim = script.Parent.Parent.Humanoid:LoadAnimation(anim)
    loadedanim:Play()
end)

1 answer

Log in to vote
0
Answered by 5 years ago

I don't understand why people keep on doing this but Humanoid is NOT a child that LocalPlayer has. You might not receive that error because something must have happened to your studio or you just didn't notice it/find it.

My recommendation is adding ".Character" before the ".Humanoid" part. I'm assuming you are using a local script in "StarterPlayerScripts".

local loadedanim = script.Parent.Parent.Character.Humanoid:LoadAnimation(anim)

This tells the computer to go the player's character and get the "Humanoid" child.

If you have any problems or questions please contact me. ;)

Ad

Answer this question