'i cant play my animation after playing it once in play mode

i recently made a sword attack animation for my game, the animation it self is perfect but when i enter play mode and play the animation (by left clicking) it only plays once and when i press left click again it doesn't do anything, i want it to trigger the animation whenever i press left click while holding my sword

code:

public class animationactivation : MonoBehaviour

{

 public GameObject Sword;

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown("mouse 0"))
    {
        Sword.GetComponent<Animator>().Play("swing sword");
    }

   
   

}

}



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source