How would I write this javascript?

I need to use an if statement to see if an animation is animating or not. The idea is after the animation “RightArmAction” it would perform a few lines of code and the code is only executed after the animation is finished animating. How could I do this in javascript?

I think you need to use isPlaying

You don’t necessarily have to tie the code to the animation at all; if you know how long the animation is you can just say (assume RightArmAction takes a second and a half-)

Invoke ("DoSomething", 1.5);

If RightArmAction can be triggered multiple times in the middle of already playing it, this won’t work. (I imagine the arm action as swinging a sword hacking and slashing waves of undead minions, and then as soon as you stop mashing the button for a couple seconds, you sheath it?)

In this case, you could have a boolean that goes true and a timer that resets to zero each time you press the attack button, and if the boolean is true and the timer is greater than the attack time, the boolean goes false and the other function is called.