I have a tool and its got some animation and when you unequip the tool its supposed to stop the animation but it doesnt.
Heres the code, its inside a script not a local script
local CanAnimate = true
script.Parent.Equipped:Connect(function()
AttackAnimation = script.parent.parent.Humanoid:LoadAnimation(script.Parent.Handle.AttackAnimation)
IdleAnimation = script.parent.parent.Humanoid:LoadAnimation(script.Parent.Handle.IdleAnimation)
IdleAnimation:Play()
end)
script.Parent.Activated:Connect(function()
if CanAnimate == true then
AttackAnimation = script.parent.parent.Humanoid:LoadAnimation(script.Parent.Handle.AttackAnimation)
IdleAnimation = script.parent.parent.Humanoid:LoadAnimation(script.Parent.Handle.IdleAnimation)
CanAnimate = false
script.Parent.CanAttack.Value = true
IdleAnimation:Stop()
AttackAnimation:Play()
wait(1)
IdleAnimation:Play()
CanAnimate = true
end
end)
script.Parent.Unequipped:Connect(function()
IdleAnimation = script.parent.parent.parent.Character.Humanoid:LoadAnimation(script.Parent.Handle.IdleAnimation)
IdleAnimation:Stop()
end)
Thank you for your time, I know its messy with the all the ".parents" everywhere but thats because ive been experimenting trying to get it working. So far it doesnt error but it also doesnt stop the animation.
Thank you for your time :)

1 comment
Thanksss