Hello.
The reason as to why your animation is looping is either, you set the wrong animation priority, or, you haven't told it to stop the animation when you unqeuipped your tool. This is very simple to do with the .Unequipped
function. This function will call anytime the tool is unequipped. From there, we can tell the tool to stop the animation. I also reccomend to Load the animation before you activate the tool, and also use the Humanoid.Animator instead of just the humanoid, as that is deprecated.
Here is an example with your script:
01 | local Tool = script.Parent |
02 | local ToolAnimation = Tool.Animation |
04 | local Character = Tool.Parent |
05 | local Humanoid = Character.Humanoid |
07 | local Animation = Humanoid.Animator:LoadAnimation(ToolAnimation) |
09 | Tool.Activated:Connect( function () |
13 | Tool.Unequipped:Connect( function () |
Hope this helps!