make explosion work

public var explosionPrefab : Transform;

var beep : AudioClip;

function OnCollisionEnter(col: Collision){

if (col.gameObject.tag == “Player”){

Destroy(col.gameObject);

audio.PlayOneShot(beep);

}

}

how can i make the “explosionPrefab” work after the object is destroyed after collision

First you should declare explosionPrefab as gameobject, and set the particle to be “One shot”

public var explosionPrefab : GameObject;
var beep : AudioClip;

function OnCollisionEnter(col: Collision){
if (col.gameObject.tag == "Player"){
  Instantiate(explosionPrefab,col.gameObject.transform.position);//trigger explosion
  Destroy(col.gameObject);
  audio.PlayOneShot(beep);
}
}

var explosionPrefab:Transform;
var beep : AudioClip;

function OnCollisionEnter(col: Collision){
if (col.gameObject.tag == "Player"){
  Instantiate(explosionPrefab,transform.position, transform.rotation);
  audio.PlayOneShot(beep);
  Destroy(col.gameObject);

}
}