How to stop animation when tool is unequipped?
Asked by
4 years ago Edited 4 years ago
Im trying to make a animation play every time you equip a tool. It works when i equip it, but when i unequip it, the animation keeps on playing.
The error is: Humanoid is not a valid member of Backpack "Players.fireyfoxninja21.Backpack" - Server - Animation:17
Can anybody help figure out why this wont work?
(I used a normal script inside of a tool, with a handle.)
01 | local Tool = script.Parent |
02 | local Animation = Tool.Animation |
04 | Tool.Equipped:Connect( function () |
05 | local Player = Tool.Parent |
06 | local Humanoid = Player.Humanoid |
08 | local AnimationPlay = Humanoid:LoadAnimation(Animation) |
14 | Tool.Unequipped:Connect( function () |
16 | local Player = Tool.Parent |
17 | local Humanoid = Player.Humanoid |
19 | local AnimationPlay = Humanoid:LoadAnimation(Animation) |