The dashes at the beginning of the line define the whole line as a note which the script would skip upon execution. I’m not sure if you put those there when you were posting, but if they are included in the script you should remove them.
yes check if comment is intentional
if intentional, check if any of the animation is still playing by IsPlaying bool
some of the animation should be playing so you know what to stop
if not result in any anim playing,
the
¯\_(ツ)_/¯
local Animations = {
idle = Spirit:WaitForChild("HP"):LoadAnimation(Spirit:FindFirstChild("Animations"):FindFirstChild("Idle"));
pose = plr.Character:FindFirstChildOfClass("Humanoid"):LoadAnimation(Spirit:FindFirstChild("Animations"):FindFirstChild("Pose"));
spose = Spirit:WaitForChild("HP"):LoadAnimation(Spirit:FindFirstChild("Animations"):FindFirstChild("SPose"));
posel = plr.Character:FindFirstChildOfClass("Humanoid"):LoadAnimation(Spirit:FindFirstChild("Animations"):FindFirstChild("PoseLoop"));
sposel = Spirit:WaitForChild("HP"):LoadAnimation(Spirit:FindFirstChild("Animations"):FindFirstChild("SPoseLoop"))
}
I have also tried messing with Looped value of the animation but it also didn’t work.
It is intentional, sorry for not stating and confusing you.
After stopped, the IsPlaying bool is false but the animation continues to play.
Was it looped in the Animation Editor? I had a similar problem where I accidentally left the Looped property on in there and it wouldn’t stop, even if I called :Stop().
I tried manually disabling the Looped property through scripting though, also the animation is supposed to be looped.
- The first argument is simply the time roblox takes to interpolate from the playing animation’s pose to the default/next-in-priority animation’s next pose. Setting it to 0 simply means you wish for no interpolation and the character to instantly continue doing other animations. Passing in more than one argument does nothing at all.
-
0
is considered a successful execution (in OS processes, let’s ignore the fact that this has absolutely nothing to do with Lua). Which means it would be a return value after the function finished executing. How would passing the return code as an argument influence the function… to work successfully? -
Stop
is a void by Roblox definition. It won’t ever return anything and the only thing it can do to influence program execution is to throw an error. It does not have a return code, and it does not tell you if it worked successfully (unless it errors, in which case it didn’t).
Can you try doing print(Animations.pose1.IsPlaying)
right before and right after the Stop line?
This is what I did:
elseif posing == true and isAttacking == false then
print("s")
posing = false
print(Animations.posel.IsPlaying)
wait(0.5)
-- Animations.pose:Stop()
-- Animations.spose:Stop()
Animations.posel:Stop()
Animations.sposel:Stop()
print(Animations.posel.IsPlaying)
end
end
end)
This is the output:
The track you’re trying to stop isn’t playing anymore at that point. A different animation track is causing issues. You can try the same printing procedure with spose1
to verify that that is not the track either. Regardless, it would really help if you told us which of your 5 tracks is playing when it shouldn’t be.
One possible reason is that your Animation instances have the wrong IDs.
Sorry for not stating it obvious. After triggering the function, it checks if posing is false and isAttacking is false (These works fine), then afterwards it’ll play “pose” and “spose” then afterwards it play “posel” and “sposel” (l stands for loop).
If did correctly, the outcome will look like this:
(The first time I wasn’t including pictures because I didn’t want to leak, but now I understand it is needed.)
And now, pose and spose already ended so it wasn’t needed anymore, so the only animations I need to stop are “posel” and “sposel” which both are supposed to looped.
And now the posing variable is true, once triggered again the function will stops “posel” and “spsoel” which both didn’t stop and that’s how this topic was made.
That makes more sense. I wouldn’t know why your code segment doesn’t work then (except that 100% verify and double check that all animation IDs and variable names match).
One thing to note is that it’s not needed to have a pose entry and a pose loop animation if the pose loop animation is a single, still pose. You can call track:AdjustSpeed(0) to freeze the pose entry animation at any point in time, then either Stop or AdjustSpeed(1) to go out of pose.
I’ll have a try, thanks for your tips.
It still did not work, I absolutely have no idea why now.
How/when are you calling the function? It might execute too often in which case the wait()s can mess up the timing. Try commenting them out.
Edit: I should note this is a debug fix and will cause unwanted behavior. If this ends up being the actual issue, you will need a different code
You could maybe try waiting for the “pose” and “spose” animations to finish (With “animation.Ended:Wait()”) and :Stop() them before starting the “poseI” and “sposeI” animations. It looks like your idle loop animations never play and the character is just stuck in a position.
The function is called upon the player pressing G, I haven’t set a cooldown yet but I didn’t press them rapidly.
“pose” and “spose” are higher animation priority than posel and sposel so it’s completely fine to call these two way before pose and spose ends. Also pose and spose are just “roll in” animation for posel and sposel (Which isn’t looped of course) if you’ve seen the gif I’ve listed in a reply before yours.
I can attach a gif including the only “pose” and “spose” to show how it works, since English isn’t my native language I ended up making mistakes on my explanations so I’m sorry.
That gif would be helpful.
Acoording to this output the poseI animation has already stopped playing before you :Stop() it. Is this what you want?