Button Particle Emission

I have this, i want particles to emit when i press space, and to stop when i realease.

function FixedUpdate() {

if (Input.GetKeyDown ("space")) {
particleEmitter.emit = true;

if Input.GetKeyUp ("space")) {
particleEmitter.emit = false;

but it comes up with errors. What am i doing wrong?

You're missing a parenthesis in the second `if` statement. Also, don't use GetKeyDown or GetKeyUp in FixedUpdate, because those events are only true during the one frame that they're activated, and FixedUpdate doesn't run every frame. Only use FixedUpdate for physics.