(javascript) Activating an emitter through script

Hello, I have a particle emmiter in my scene called “confetti” and I’m trying to get it to activate when the player walks into a trigger. The script I’m trying to use is:

public var confettiEmmiter : GameObject = GameObject.Find("confetti");
    
    function OnTriggerEnter (other : Collider)
    {
    	if(other.tag == "Player")    
        confettiEmitter.particleEmitter.emit = true;
     
    }

I’d like this one emmitter to go off when the player enters the trigger, but I keep getting an error that says "Unknown Identifier ‘confettiEmmitter’. What am I doing wrong?

Are you using the new particle system? Shuriken?

It gets handled differently than the old commands. Check out this thread:

Here’s some code to get you going :slight_smile:

 public var confettiEmitter : ParticleSystem;

 function Start() {
      confettiEmitter = GameObject.Find("Confetti").GetComponent(ParticleSystem);
 }

 function OnTriggerEnter (other : Collider) {
      if(other.tag == "Player") {
           confettiEmitter.Emit(30); //emits 30 particles
      }
 }