Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a problem with my idle animation for punch tool?

Asked by
Rdumb1 4
5 years ago
Edited 5 years ago

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: ```lua 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.

0
this is a local script and the animations are inside the local script. Rdumb1 4 — 5y
0
and yes the animations appear for other players Rdumb1 4 — 5y
0
edit:- code block User#5423 17 — 5y
0
sometimes the punch animations stop when i walk too. Rdumb1 4 — 5y
View all comments (2 more)
0
still now answers? Rdumb1 4 — 5y
0
*no anwsers? Rdumb1 4 — 5y

Answer this question