This is how I’d do it. I tried commenting each section to explain what it does in each of those bits. I didn’t test this, but it should:
Constantly regenerate your jetpack energy while it’s not being used, up to a maximum of 100.
Pressing space bar stops the regeneration, starts draining the energy, “adds movement”
then when it runs out of energy - disables everything, triggers a cooldown, turns the regeneration back on.
Releasing space bar turns on the regeneration, stops the energy drain, stops adding movement and turns off cooldown after a 10 second delay.
You should also remember that it’s dependant on framerate currently, so to get around that you should use delta time to affect any float values you’re adding or subtracting to make sure it does the same thing regardless of framerate. And that with a high framerate the values that I’ve clamped it at will only take around a second to drain from full to empty.