Tool won't stop playing animation upon unequipping?
Hi, I'm having an issue with my script. So the script works entirely fine, besides the final part. To sort of explain the script, its designed to where when you equip the gun, it plays the draw animation, immediately followed by the LOOPED stance animation called Idle. When you fire the gun, it plays the fire animation. However, when you unequip the gun, the idle animation continues to play, and I can't get it to stop. Please let me know if you have a solution!
01 | local Tool = script.Parent |
06 | local AnimateValue = script.Parent.AnimateValue |
08 | Tool.Equipped:connect( function () |
09 | AnimateValue.Value = true |
10 | local Character = Tool.Parent |
11 | local Humanoid = Character.Humanoid |
13 | local AnimationTrack = Humanoid:LoadAnimation(draw) |
14 | local AnimationTrack 1 = Humanoid:LoadAnimation(idle) |
15 | if AnimateValue.Value = = true then |
18 | AnimationTrack 1 :Play() |
20 | if AnimationTrack 1. IsPlaying then |
21 | AnimationTrack 1 :Stop() |
28 | Tool.Unequipped:connect( function () |
29 | AnimateValue.Value = false |
35 | Tool.Activated:Connect( function () |
36 | local Character = Tool.Parent |
37 | local Humanoid = Character.Humanoid |
39 | local AnimationTrack = Humanoid:LoadAnimation(fire) |