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

How do I prevent animations from playing over another animation?

Asked by 6 years ago
local function LightAttack(actionName, inputState)
    if crouch == true then
        while wait(.5) do
            if script.Parent.HumanoidRootPart.Orientation.Y == 0 then
                if leftValue == 1 then
                    if inputState == Enum.UserInputState.Begin then
                        animtrack236:Play()
                    end
                end
            end
        end
    elseif inputState == Enum.UserInputState.Begin then
        if script.Parent.HumanoidRootPart.Orientation.Y == 0 then
            if leftValue == 1 then
                animTrack5A:Play()
            else
                animTrack5A:Play()
            end

So I'm trying to get a specific animation (animtrack236) to play when down, left, and an attack button is pressed. Right now that animation does play, but several other animations seem to impede it, such as another normal attack animation (animtrack5A) that occasionally plays at or before 236 does, and a crouching animation that plays when I press down, thus making the animation either come after 5A, or not appear at all. Furthermore, after I input the button sequence, if I keep holding down left, 236 will keep on playing until I let go, despite it not being a looping animation. I've tried adjusting the weights, adding in more code to not do the special when I'm not pressing the attack button, and others, but nothing I've tried so far seems to work. Both 236 and 5A are Action, while the crouching animation is Idle. Does anyone know what I can do to prevent 5A and the crouching animation from playing when only 236 should be playing?

0
Change the priority in the crouching animation to either Core or Idle and set the combo animation's priority as Action. You may also want to stop all playing tracks or put a wait time equal to the tracks length after it's play code. Meltdown81 309 — 6y
0
Thanks, but I've already checked and said that the crouch is Idle, and 5A and 236 are Action. I've also tried to put in both a stop command for both and a wait time, but neither of them solve the problem, as I still have 5A playing over 236, and 236 still tries to play over and over when I hold down left. NikoReiesu 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Meltdown81 already posted this as a comment, but I'll also repost it here because it's technically an answer.

"Change the priority in the crouching animation to either Core or Idle and set the combo animation's priority as Action. You may also want to stop all playing tracks or put a wait time equal to the tracks length after it's play code."

Basically what you have to do is go into the animation editor, and click Edit > Set Priority and then to the desired priority.

Ad

Answer this question