How to set fire rate to raycast script

Hi Guys!
This is the script I use for Ray Cast shooting in my Unity fps.
Somebody please tell me how to add a fire rate to this script.

var Effect : Transform;
var TheDammage = 100;

function Update () {
	
	var hit : RaycastHit;
	var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
	
	if (Input.GetMouseButtonDown(0))
	{
		if (Physics.Raycast (ray, hit, 100))
		{
			var particleClone = Instantiate(Effect, hit.point, Quaternion.LookRotation(hit.normal));
			Destroy(particleClone.gameObject, 2);
			hit.transform.SendMessage("ApplyDammage", TheDammage, SendMessageOptions.DontRequireReceiver);
		}
	}
	
}

You could add some Kind of timer to it like this:

var Effect : Transform;
 var TheDammage = 100;


 var lastShot : float;
var fireRate :float =0.5f;
 
 function Update () {
     
     var hit : RaycastHit;
     var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
     
     if (Input.GetMouseButtonDown(0) && Time.time>=lastShot+fireRate)
     {
         if (Physics.Raycast (ray, hit, 100))
         {
             lastShot=Time.time;
             var particleClone = Instantiate(Effect, hit.point, Quaternion.LookRotation(hit.normal));
             Destroy(particleClone.gameObject, 2);
             hit.transform.SendMessage("ApplyDammage", TheDammage, SendMessageOptions.DontRequireReceiver);
         }
     }
     
 }

I’m not sure about the Syntax here because I prefer to write my code in c# but what it does is simple:
you remember the time your last shot happens with lastShot and with the condition in your if Statement you ensure that the next shot won’t be sooner than the last shot + fireRate in seconds.