This is simply a problem with your logic. Pressing a key will trigger all keypress events during that frame. It's necessary to have some understanding of the underlying engine if you want to truly understand what you're doing. For example, the event sheet runs top to bottom, executing code. If you place the event where it gets sets from 1 to 2 before the event where it sets from 0 to 1, then it won't get set to 1, check if it's 1, then set it to 2. It will check if it's 1 (it's not), skip that event, then set it from 0 to 1, and the frame will end. Then, next time you press it ( on a different frame), it will set it from 1 to 2. However, if you want it to loop back to 0 (like, 0,1,2,0), then the problem still exists, and can't be fixed by code order. The true solution to this problem is to create a new variable (call it "lock"), and set it to one every time you change your counter. Then, only allow the counter to change if the lock hasn't been set by another event in the same frame. (on keypress AND if lock equals 0). Then at the end of the code, set lock back to zero to prepare it for the next frame. With this solution, only one event can ever fire in a frame, and the variables wont cascade from a single press. But here's an even better way, don't use two events at all! Simply set the value to: (value+1)%(maxvalue+1) , where max value is the highest number you want the counter to reach. This makes it so every press increments the value, and then it returns to 0. (0,1,2,3,4,...,maxvalue,0,1,2,3 etc)