Prefab Instantiate is null. Spawning Prefabs?

I have this issue where my gun shoots using raycast and the particles that appear is basically just a simple detonator (cloud of smoke), the detonator (cloud of smoke) will destroy itself once it hits a collider (to prevent it to hit again anywhere else), but if it destroys itself, then it cannot be used again!

So my issue is I can shoot my weapon once, and it will work perfectly fine, and show the particles/cloud of smoke, however if i shoot it again, it wont show the particles/cloud of smoke because its been destroyed.

I get this error which I understand: NullReferenceException: The prefab you want to instantiate is null.

I know it means that the script cannot access the prefab because its destroyed, my question is how do I spawn another one after its destroyed?

This is the script for the actual detonator

// The reference to the explosion prefab
var explosion : GameObject;

function OnCollisionEnter (collision : Collision) { 

   // Instantiate explosion at the impact point and rotate the explosion 
   // so that the y-axis faces along the surface normal 
   var contact : ContactPoint = collision.contacts[0]; 
   var rotation = Quaternion.FromToRotation(Vector3.up, contact.normal); 
    Instantiate (explosion, contact.point, rotation); 
   //variable for your particle prefab that you created and saved as a prefab. 
//drag that particle prefab here in the inspector 

// And kill our selves 
  Kill ();    
}

function Kill () {
	// Stop emitting particles in any children
	var emitter : ParticleEmitter= GetComponentInChildren(ParticleEmitter);
	if (emitter)
	emitter.emit = false;

	// Detach children - We do this to detach the trail rendererer which should be set up to auto destruct
	transform.DetachChildren();
		
	// Destroy the projectile
	Destroy(gameObject);
}

Thanks in advance.

you must assign instantiate to a temp variable and use that to do the rest of your work - instantiate copies w/e the 1st field you give it and returns that copy

Yeah i used this line Instantiate(hitParticles);
in the Fire function, and thats when I started getting the error, am I using instantiate correctly? I took a look at the rocket launcher script too, and it used instantiate too, but im not sure why it doesnt work with my gun script.

Anyone know what im doing wrong?

Yeah I read that documentation, but the problem is my gun does not use a projectile it uses raycasting (like the machine gun in the fps tutorial).

So clone = Instantiate(projectile, transform.position, transform.rotation); doesnt seem to really work because it uses position, rotation, and transform, but all im using is raycast, so how do I implement instantiate using raycasts?

Yeah I have all that stuff implemented into my script, but for some reason the Hitparticles doesnt appear…

The only reason I decided to use raycast instead of projectiles is because when i shoot my gun, some times it shoots right thru a wall, sometimes it doesnt, If anyone knows a fix for that, then my problem would be solved.