Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why will this tool not play the animation?

I want an animation to play if I have equipped it, can you fix this script?

local Tool = script.Parent

Tool.Equipped:Connect(function(mouse, player)
    print("A tool was equipped")
	game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
end)

1 comment

0

Make sure your animation priority is set to action for it to work. If you set it to another priority, it may take longer for the animation to work. Plus make sure to loop your animation, or freeze it if that is what you are going for with the "Equipped" event.

1 answer

✓ Accepted answer

You need to load the Animation id instead of the animation instance itself.

For example:

local Tool = script.Parent

Tool.Equipped:Connect(function(mouse, player)
    print("A tool was equipped")
    local animationId = script.Parent.Animation.AnimationId
    
    		 
    game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(animationId)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.