How do I make it stop the animation when it is unequipped? Please rewrite my script because it is messy, but you don't have too. Thanks for reading.
local animation = Instance.new('Animation')
local debounce = false
function onEquip()
script.Parent.Handle.UnsheathSound:Play()
end
function onActivate()
if not debounce then
debounce = true
script.Parent.Handle.SlashSound:Play()
animation.AnimationId = "http://www.roblox.com/asset/?id=129967390"
local player = game.Players.LocalPlayer.Character
local animTrack = player.Humanoid:LoadAnimation(animation)
animTrack:Play()
script.Parent.Handle.Script.Disabled = false
wait(0.5)
animTrack:Stop()
script.Parent.Handle.Script.Disabled = true
wait(0.5)
debounce = false
end
end
script.Parent.Equipped:connect(onEquip)
script.Parent.Activated:connect(onActivate)

3 comments
It doesn't stop the animation when unequipped...
Oh sorry, I meant the opposite
Ok one minute