Bullets will not fire forwards

I have a Javascript that is meant to make a gun fire but does not make the bullets fly forwards, they just drop. can anyone help?

Script:

#pragma strict

var projectile : GameObject;
var fireRate : float;

private var nextSpawnTime : float;

function Start () {

nextSpawnTime = Time.time + fireRate;

}

function Update () {

// left-click was pressed, launch a projectile
if ((Input.GetButtonDown(“Fire1”)) && (Time.time > nextSpawnTime)) {

// Instantiate the projectile at the position and rotation of this transform

	Instantiate(projectile, transform.position, Quaternion.identity);                
	

	nextSpawnTime = Time.time + fireRate;
}

}

Assuming you are asking about a projectile that has a rigidbody, you have to add force to make your projectiles move. Plus you are not using the rotation of the transform. Try using these two lines instead of your Instantiate() line:

var go : GameObject = Instantiate(projectile, transform.position, transform.rotation); 
go.rigidbody.AddForce(go.transform.forward * 2000); 

This assumes that your projectile has a Rigidbody component.