You can connect that to an Unequipped event, storing the animation as a variable, then stopping it:
local hum -- Localizing variables(good practice)
local anim_feet -- Localizing variables(good practice)
local current -- Localizing variables(good practice)
local MouseConnection -- Making a variable so the 'Button1Down` connection is disconnected, or it will run when the tool is unequipped
script.Parent.Equipped:connect(function(m)
MouseConnection = m.Button1Down:connect(function() -- Setting the connection to a variable
hum = game.Players.LocalPlayer.Character.Humanoid
anim_feet = hum:LoadAnimation(script.Parent.Animation)
current = anim_feet
current:Play()
end)
end)
script.Parent.Unequipped:Connect(function()
current:Stop()
MouseConnection:Disconnect() -- Disconnecting the connection so it wont run when the tool is unequipped
end)