I might be wrong but I don’t think the Animation is being loaded upon compile and only when called. You need to ensure the animation you are loading is the same variable you use to stop it.
Try loading the animation within the first if statement, store it as a variable and call that same variable in the else if statement for stopping it.
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 ¯\_(ツ)_/¯
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().
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).
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.