How to make sure that the user presses a key only once in a scene

Like pressing space would give you a speed boost. But I dont want the user to use it again for the level.
A piece of code would help me for my Star Wars game.
Thank you,For example, pressing space would give your vehicle a boost. But I want that boost to be only accessible once for a level or maybe twice for another level. How do i do that?
I tried attaching a count variable which increments once when Input.GetKeyDown(space) is true. But when space is pressed again, count becomes 2, space is no more functional… But that doesnt seem to work… It’d be very helpful if somebody can provide me a peice of code for it.
I want that for my Star Wars game XD.

Try to use bool variables.

private bool isPressed = false;

if(Input.GetKeyDown(KeyCode.Space) & & isPressed == false) {
isPressed =true ;
// do all the stuff
}