Problem with shooting script

okay, so i’ve created a script that has no errors in it. But the problem is that it does NOT do what i want it to do! I want it to shoot out a bullet( in this case a cube) out of the gun. but noting happens when i press left click.

var BulletPrefab:Transform;
var force : float = 2000;
function Update ()

{var bullet = Instantiate(BulletPrefab,
bullet.rigidbody.AddForce(bullet.transform.forward * force);

as i said, there are no errors which makes it unable to copy and use. it just doesn’t do what i want it to do.

Your script works fine for me. Make sure you are not receiving any error messages in the Console window. Look in the hierarchy after each press of the mouse button. Is there a new bullet listed? If the bullet is listed, select it to see it position and rotation. Are the game object associated with “spawnPoint” and “AK-47M” creating something that is visible to the camera?

Change if(Input.GetMouseButtonDown(0)) to if(Input.GetMouseButtonDown("Fire1"))

I’ve never seen numbers used unless like the numerical values. The script works for me.