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!
local Tool = script.Parent
local fire = Tool.Fire
local draw = Tool.Draw
local idle = Tool.Idle
local AnimateValue = script.Parent.AnimateValue
Tool.Equipped:connect(function()
AnimateValue.Value = true
local Character = Tool.Parent
local Humanoid = Character.Humanoid
local AnimationTrack = Humanoid:LoadAnimation(draw)
local AnimationTrack1 = Humanoid:LoadAnimation(idle)
if AnimateValue.Value == true then
AnimationTrack:Play()
wait(.5)
AnimationTrack1:Play()
else
if AnimationTrack1.IsPlaying then
AnimationTrack1:Stop()
end
end
end)
Tool.Unequipped:connect(function()
AnimateValue.Value = false
end)
Tool.Activated:Connect(function()
local Character = Tool.Parent
local Humanoid = Character.Humanoid
local AnimationTrack = Humanoid:LoadAnimation(fire)
AnimationTrack:Play()
end)

1 comment
Thank you so much!