Make an animation play in its entirety when mouse button is pressed?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pokemonleafgreen

I have an animation from a top-down two-dimensional perspective where the character swings a sword. I want this animation to have to play in its entirety before it can play again,
how can i do that?
The code i have right now to trigger the animation is:

if Input.is_action_just_pressed("LMB"):
    $Player.play("sword")
:bust_in_silhouette: Reply From: jgodfrey

How about this?

if Input.is_action_just_pressed("LMB"):
    if !$Player.is_playing():
        $Player.play("sword")