Fire rate not working?

Fire rate not working?

 //Attach to empty object, in front of barrel
  var projectile : Rigidbody;
  var speed = 20;
  var fireRate = .5;
   var mySound : AudioClip;
 function OnCollisionEnter(collision : Collision) {
   if(collision.gameObject.tag =="Whatever")
        InvokeRepeating("Fire",1,0.3);
 }
function Fire()
{
audio.PlayOneShot(mySound);
	var instantiatedProjectile : Rigidbody = Instantiate(
 projectile, transform.position, transform.rotation );
	instantiatedProjectile.velocity =
 transform.TransformDirection( Vector3( 0, 0, speed ) );
	Physics.IgnoreCollision( instantiatedProjectile. collider,
 transform.root.collider );

  }

Erm … you are assigning but not using your fireRate variable in there :slight_smile:

Try InvokeRepeating(“Fire”,1,fireRate);