I have a problem. When i click on right mouse button animation does not play. Please help me

so i am making an open world game and the thing is when i click right mouse button, pistol animation should play but it does but however isaiming bool i checked

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FiringPistol : MonoBehaviour
{
public bool isAiming = false;
public GameObject thePlayer;

void Update()
{
    if (Input.GetMouseButton(1))
    {
        isAiming = true;
        thePlayer.GetComponent<Animation>().Play("Pistol");
    }
    else
    {
        isAiming = false;
        //thePlayer.GetComponent<Animation>().Play("Idle");
    }
}

}

After making a bool in the parameters write this script
If you want to learn more each this video
Url:2D Animation in Unity (Tutorial) - YouTube

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class FiringPistol : MonoBehaviour
{
    Public Animator animator; 

    Void update ()
    {
         If(input.getKeyDown(keyCoad.Mouse 1)
           {
                 animator.SetBool ("the name of your bool", true); 
           }

          If(input.getKeyUp(keyCoad.Mouse 1)
           {
                 animator.SetBool ("the name of your bool", false); 
           }
    }

}