turn on off particle system

Hello
i am trying to turn on and off a particle system i created.
I attached it to a prefab.

The code I am using is as follows

public ParticleSystem waterGun;

void Update () {
    if(Input.GetKey(KeyCode.W)){
        waterGun.enableEmission = true;
    }else if(Input.GetKeyUp(KeyCode.W)){
        waterGun.enableEmission = false;
    }
}

I want the particle system to play in front of the fps when a key is held down and stop playing when it is pressed.

Any help is appreciated
Thanking You

i am fairly new in Unity but i think this is the code you’re looking for:

  public ParticleSystem waterGun;
     
    void Update () {
        if(Input.GetKey(KeyCode.W)){
            waterGun.emit = true;
        }else if(Input.GetKeyUp(KeyCode.W)){
            waterGun.emit = false;
        }
    }