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

Punching animation stops when I move (sometimes) and idle animation stops when I move all the time?

Asked by
Rdumb1 4
5 years ago
Edited by User#5423 5 years ago

I always have this problem and sorry if I reposted this (I'm impatient).

problem: idle animation for punching tool stops (its looped) when I walk or jump. punching animations stop sometimes when the character idle animation (not the punching tool idle) plays.

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") local deb = false local cooldown = 1.3

tool.Equipped:connect(function() local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle) idle:Play() end)

tool.Activated:connect(function() if deb == true then return end deb = true 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() wait(cooldown) deb = false elseif choose == 2 then local swing2animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch2) swingsound:Play() swing2animation:Play() wait(cooldown) deb = false 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) ```

0
For starters put this in a code block, next what priority do you have the animation set as? XX_Doggoa 24 — 5y
0
Well the idle animation is looped, the punch animations aren't. Rdumb1 4 — 5y
0
animation length for all of them is 1 Rdumb1 4 — 5y
0
when you upload the animation set its priority to "Action" and for extra measures, you can set it via the script, ex. swing1animation.Priority = Enum.AnimationPriority.Action SerpentineKing 3885 — 5y
View all comments (5 more)
0
the idle animation? Rdumb1 4 — 5y
0
oh, thanks! Rdumb1 4 — 5y
0
Edit:- code block User#5423 17 — 5y
0
Please do not repost questions. They will be moderated as a duplicate. User#5423 17 — 5y
0
well when I reset and use the tool, and unequipped it, the idle animation just stays there. Rdumb1 4 — 5y

Answer this question