Need help on how to make ammo deplete, just a finishing touch

Ok all I need is to know how to make my ammo go -1 everytime I press left mouse button

The rest seems to work so don’t worry about it

var Range : float = 250;

   var Force : float = 1000;

   var Ammo : int = 60;

   var BulletsPerClip : int = 5;

   var ReloadTime : float = 0.7;

   var BulletsLeft : int = 5;

   var ShootTimer : float = 0;

   var ShootCooler : float = 1;

   public var ShootAudio : AudioClip;

   public var ReloadAudio : AudioClip;

   public var ArmAudio : AudioClip;


function Start (){
   BulletsLeft = BulletsPerClip;
}

function Update () {
   if(Input.GetKeyDown( KeyCode.Mouse0 )){
       RayShoot ();
       
       if ( BulletsLeft	 > 0){
       
       audio. PlayOneShot (ShootAudio);
       
       }
   }

   if(Input.GetKeyDown( KeyCode.R )){
       Reload ();
   }
}
function RayShoot () {

   var Hit : RaycastHit;
   var DirectionRay = transform.TransformDirection( Vector3.forward );
   Debug.DrawRay( transform.position , DirectionRay * Range , Color.red );

   if ( BulletsLeft < 0 ){

      if(Physics.Raycast( transform.position , DirectionRay , Hit , Range )){

            if( Hit.rigidbody ){

            Hit.rigidbody.AddForceAtPosition( DirectionRay * Force , Hit.point );

            }

      }

      BulletsLeft = -1;

            
}

}

function Reload () {

while(BulletsLeft < BulletsPerClip)
{
    audio.PlayOneShot (ReloadAudio);
    yield WaitForSeconds( ReloadTime );
    BulletsLeft++;
}
audio.PlayOneShot (ArmAudio);

}

See your line

BulletsLeft = -1;

This will always set your current ammo to -1. You’re thinking of

BulletsLeft--;

or

BulletsLeft -= 1;

Also, see this line-

if ( BulletsLeft < 0 ){

This will return true if you have less than zero bullets. Fix it.

Also, “The rest seems to work so don’t worry about it”- If it’s already working, don’t post it. It’ll just cause confusion.