How do I use my particle prefab on collision with my brick?

Im new to programming so this is most likely a noob question but I was wondering how I would make my particle prefab run once it collides with a brick. I have found other sources online of how to do this but none of them seem to work for me. Does anyone know how I would do this?

private var score : int=0;
var guiScore : GUIText;

 var blue : Texture;

 var isBlue : boolean = false; 
 
 var brickPieces : GameObject;
 
function Start () {
guiScore.text="Score: 0";
}

function OnCollisionEnter(col : Collision){

if(col.collider.name == "Brick3"){
Destroy(col.gameObject);

//I want the brick to explode showing my particles here

brickPieces(col.gameObject);
score += 10;
guiScore.text= "Score: " + score;
renderer.material.mainTexture = blue;
isBlue = true;

}

Is the GameObject variable called brickPieces your particle system? It’s hard to tell for sure.

If that’s the case, you can make accessing the particle system a little easier by changing that variable from being GameObject to being ParticleSystem. Then, when it comes time to start showing particles, you can use this:

brickParticles.Play();

This method will just need you to have the particle system’s “Play On Awake” checkbox to be unticked in the Inspector, so it doesn’t start playing the moment the scene starts / its GameObject activates.