NullReferenceException: Object reference not set to an instance of an object

Hi guys, this is my first post so apologies if I post anything not the way it’s supposed to. I’m just starting to use Unity so I’m not able to debug everything on my own. I’m trying to instantiate a bullet when I left mouse click, and when it’s instantiated a force is applied to it. This issue I’m having is as it says in the title, is that an Object reference is not set to an instance of an object. Here’s my code:

using UnityEngine;
using System.Collections;

public class Shoot : MonoBehaviour 
{
	//bool shoot = false;
	public Transform prefabBullet;
	public float shootForce;
	GameObject instanceBullet;

	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
		if (Input.GetMouseButtonDown(0))
		{
			instanceBullet = Instantiate(prefabBullet, transform.position, Quaternion.identity) as GameObject;
			instanceBullet.rigidbody.AddForce(transform.forward * shootForce);
		}
	}
}

In the scene the bullet is initiated, it just doesn’t have any force applied to it. They just keep spawning on my player and stack up. If anyone could help that would be much appreciated.

You probably have not set prefabBullet in the editor.
If you have then make sure what it is set to has a rigid body component.

This is the best I can do without the entire error message.

Figured it out. Everything does need to be of type transform. But also when I was checking to see if instanceBullet did have a rigidbody, I was using != instead of ==. So changing it to instanceBullet.rigidbody == null was the answer we were looking for.