jump on enemy cause particle effect in c#

All i want to do is every time my character jumps on an enemy it is destroyed and the particle effect plays.
ive made a particle effect but i just want it played when the enemy is destroyed.

this is the code i have for my particle. it is a child of a cube object.
how do i do that?

private ParticleSystem stars;
{
void OnTriggerStay(Collider other) 
{

		Destroy(this.gameObject);
		 PlayParticles()

			
}

}
}

update needs to be Update

OK then set it to “Play On Awake” and Instantiate it with OnCollisionEnter or OnTriggerEnter depending on how your Colliders are Setup. The script that Instantiates the GameObject with the Particle System on it should be attached to the GameObject (your Player Object or whatever collides with the Enemy) that collides with the Enemy. It could look like this:

public class FxOnCollision : MonoBehaviour{
 public GameObject FX;
 void OnCollisionEnter(Collision collision){
  if(collision.gameObject.tag == "Enemy")
   GameObject o=Instantiate(FX,collision.transform.Position,Quaternion.identity);
   Destroy(o,3f);
 }
}

you Need to attach your Particle System Prefab to FX in Inspector and your Enemies should have a Tag called “Enemy” then it should work.

I might be wrong but try to swap the position of PlayParticles() and Destroy:

   void OnTriggerStay(Collider other)  {

     PlayParticles()
     Destroy(this.gameObject);
          }

I have noticed that you cannot make something perform something else if it is destroyed. Make it play the particles and then destroy the object.

It might help!