Fps game gun reloading problem

I’m making a FPS game, but reloading won’t work! I’m writing it with JavaScript
Can anyone help?

Code:

public var BulletPrefab : Transform;
public var BulletSpeed : float = 6000;
public var GunMuzzle : Transform;
public var ClipSize : float = 30;
public var Clip : float = 30;
public var ReloadTime : float = 2.0;
  
function Update ()
{
	if (Input.GetButtonDown("Fire1"))
	{
		if (!BulletPrefab | !BulletSpeed )
		{
			Debug.Log("[shoot] Undefined Variables");
		}
		else
		{
			if (Clip >0)
			{
				var BulletSpawn = Instantiate (BulletPrefab,GunMuzzle.transform.position,Quaternion.identity);
				BulletSpawn.rigidbody.AddForce(transform.forward * BulletSpeed );
				Clip -= 1;
			}
		}
	}
}

if (Clip < 1 )
{
	Debug.Log("Reloading");
	yield WaitForSeconds (ReloadTime);
	Clip = ClipSize;
}

you cant have a yield in an update function. What you can do is use a while loop in your start function.

function Start()
{
     while(true)
     {
          while(!Reloading) yield;
          Debug.Log("reloading");
          yield WaitForSeconds(ReloadTime);
          Clip = ClipSize;
          Reloading = false;
     }
}
  
function Update()
{
     if(Input.GetButtonDown("Fire1"))
     {
            Reloading = true;
     }
}

please remember that you will get a much faster answer if you ask your question in a way that does not give people a hard time ot figure out what the problem is.