shot delay in between bullets

hello everyone i am siting on the computer for a few hours and i cant get the Solution any way i need a script that i can control how many bullets i want to shoot this is the code that i have now:

var bullet : GameObject;
var GoodSpaceShip : GameObject;
function Start()
{
 
}
function Update()
{
   if(Input.GetMouseButton(0))
   {
      ray = Camera.main.ScreenPointToRay (Input.mousePosition);
      if(Physics.Raycast (ray, rayCastHit))
      {
         transform.position.x = rayCastHit.point.x;
         transform.position.y = rayCastHit.point.y;
         Instantiate(bullet, transform.position, transform.rotation);
      }
   }
}

please help me ASAP thank you!

This has many solutions online, you need a timer. Are you sure you have not spent hours watching some youtube videos instead of trying to figure that out?

if(Input.GetMouseButton(0)){
   if(timer > shotTimer)
   {
      ray = Camera.main.ScreenPointToRay (Input.mousePosition);
      if(Physics.Raycast (ray, rayCastHit))
      {
         transform.position.x = rayCastHit.point.x;
         transform.position.y = rayCastHit.point.y;
         Instantiate(bullet, transform.position, transform.rotation);
         shotTimer = 0;
      }
   }else{
       shotTimer += Time.deltaTime;
   }
}
if(Input.GetMouseButtonUp(0)){
   shotTimer = 0;
}