How to require a key-up event before continuing

I could be wrong but, I think the first instance of this needs moved up to the setup area.

 int spacesAllowed = 1;