How to make a gun shoot.

Here’s my code:

public var bullet = Rigidbody;
public var speed : int = 10;
function Update () {
	if (Input.GetButtonDown("Fire1")) {
		var clone = Rigidbody;
		clone = Instantiate(clone: bullet, transform.position, transform.rotation);
		clone.velocity = transform.TransformDirection(Vector3(0,0,speed));
	}
}

The thing is that it’s saying there’s no instance for it.

I look at the proper syntax and it says “Instantiate(original: UnityEngine.Object…);”

The trouble is I don’t know what original means. I’ve been trying to put things in it’s place, no success.

Thanks.

public var bullet : Rigidbody;
public var speed : int = 10;
function Update () {
if (Input.GetButtonDown(“Fire1”)) {
var clone : Rigidbody;
clone = Instantiate(bullet, transform.position, transform.rotation) as Rigidbody;
clone.velocity = transform.TransformDirection(Vector3(0,0,speed));
}
}

try this, you shouldn’t have the clone equal to a component like the rigidybody and in the first parameter of Instantiate(), don’t try to declare a variable, just say what you are creating like this Instantiate(bullet), and in the, “as” statement that just makes it instantiate as a rigid body. If you don’t want that to happen, delete the “as rigidbody” part. Hope this helps and best of luck