Changing the value of a variable

i’ve been working on a game for a couple of days, and there’s one part i’m stuck at.
i’m trying to have it so that when you push <space> the value of the shields (variable is shiphealth) goes down one, and one of the lights turns off… i’m not sure how to do this, i tried entering:
[AS]on (keyPress <space>) {
shiphealth = shiphealth-1
but it does some erratic movements of the lights…
the fla is attached
plz help
thanks :slight_smile:

Maybe this helps?

thanks, but i still don’t understand why the lights don’t work? i have them set to go to specific frames if the shiphealth variable equals certain things, and if not, it should loop back and keep checking, but it still just goes down two, stops for a couple of presses, and then goes up one
could someone help me w/ this?

Where are those actions set?

in the shields symbol

can anyone else try to help me?
thanks again