so I've had this problem for days and I can't seem to figure out why the idle animation stops when I walk (and its looped) can anyone fix it please?
example of the problem: If i use the tool and without moving, it stops after a few seconds when I put the animation to loop, and when I walk, the idle animation stops too. I locked the legs and torso when creating the idle animation but it still stops when walking or waiting for a while.
code:
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local tool = script.Parent
local swingsound = tool:WaitForChild("Swing")
local canattack = tool:WaitForChild("CanAttack")
tool.Equipped:connect(function()
local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
idle:Play()
end)
tool.Activated:connect(function()
local choose = math.random(1,2)
canattack.Value = true
if choose == 1 then
local swing1animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch1)
swingsound:Play()
swing1animation:Play()
elseif choose == 2 then
local swing2animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch2)
swingsound:Play()
swing2animation:Play()
end
end)
tool.Deactivated:connect(function()
canattack.Value = false
end)
tool.Unequipped:connect(function()
local hum = char:WaitForChild("Humanoid")
for _,anim in pairs(hum:GetPlayingAnimationTracks()) do
anim:Stop()
end
end)
and you guys should remove this editing thing since its so hard to copy and paste the code into here.

6 comments
this is a local script and the animations are inside the local script.
and yes the animations appear for other players
edit:- code block
sometimes the punch animations stop when i walk too.
still now answers?
*no anwsers?