Punch Animation Doesn't Work And Others Do...

This is my script, javascript (I’m using mecanim):

if (Input.GetButton("Fire1"))
		{
			punch = true;
			if (punch == true)
			{
				animator.SetBool("Punch", true);
			}
			
				
		}

		if (Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.LeftShift))
		{
			sprint = true;
			if (sprint == true)
			{
				animator.SetBool("Sprint", true);
			}
		}
		
		if (Input.GetKey(KeyCode.W))
		{
			run = true;
			if (run == true)
			{
				animator.SetBool("Run", true);
			}
		}
		
		else
		{
			animator.SetBool("Run", false);
			animator.SetBool("Sprint", false);
			animator.SetBool("Punch", false);
		}

There’s nothing wrong with the variables, as they’re all fine. For some reason all the animations work except for the punch animation. The punch animation only works when I’m running… it’s not to do with “Fire1” either, I’ve checked and fire1 is the left mouse button. I’ve tried doing Input.GetMouseButtonDown(0) and the same thing happened as with fire1. Please can someone find a solution to this please!

when I click left click, punch does become true, but doesn’t play the animation.

Its not complicated, try this

if (Input.GetButton("Fire1"))
{
   punch = true;
   if (punch)
  {
      animator.SetBool("Punch", true);
      StartCoroutine(StopPunch(2.0)); 
  }
 
 
}

function StopPunch (waitTime : float) {
		
		yield WaitForSeconds (waitTime);
		animator.SetBool("Punch", false);
	}