When I load the game, the animations play and work properly.
But when I try to stop the animaitions it doesn't work.
local walkanim = script.Parent.Parent.Humanoid:LoadAnimation(script.Walk)
local idleanim = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
script.Parent.Equipped:Connect(function()
local mouse = game.Players.LocalPlayer:GetMouse()
local player = game.Players.LocalPlayer
local mouse = game.Players.LocalPlayer:GetMouse()
idleanim:Play()
mouse.KeyDown:connect(function(key)
if key == "w" then
walkanim:Play()
idleanim:Stop()
end
end)
mouse.KeyUp:connect(function(key2)
if key2 == "w" then
walkanim:Stop()
idleanim:Play()
end
end)
end)
script.Parent.Unequipped:Connect(function()
walkanim:Stop()
idleanim:Stop()
end)
Any help would be nice. Thanks!

1 comment
This works, but why does my idle animation not work when I re-equip the tool?