Simple bullet script

I am trying to make a simple bullet script that will spawn in a bullet(the bullet itself will have the script that does damage), but I am getting an error.

using UnityEngine;
using System.Collections;

public class shooting : MonoBehaviour {

public float bulletSpeed = 10;



void Fire() 
{
Rigidbody bulletClone = (Rigidbody) Instantiate(bullet, transform.position, transform.rotation);
bulletClone.velocity = transform.forward * bulletSpeed;

// You can also acccess other components / scripts of the clone
//rocketClone.GetComponent<MyRocketScript>().DoSomething();
}


// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
	if (Input.GetButtonDown("Fire1"))
		Fire(); 

}

}

it is telling be that bullet does not exist in this context; there is a bullet in my prefabs, so I am not really sure what is going on.

‘bullet does not exists in the current context’, because you don’t have a ‘bullet’ variable. You need a variable to reference the prefab. Easiest way is to make a public variable so you can drag and drop the prefab onto your scripted object’s ‘shooting’ component in the inspector:

using UnityEngine; 
using System.Collections;

public class shooting : MonoBehaviour 
{
	public float bulletSpeed = 10;
	public Rigidbody bullet;
	
	
	void Fire()
	{
		Rigidbody bulletClone = (Rigidbody) Instantiate(bullet, transform.position, transform.rotation);
		bulletClone.velocity = transform.forward * bulletSpeed;
	}

	void Update () 
	{
		if (Input.GetButtonDown("Fire1"))
			Fire();
	}
}