Pressing three buttons

When I press the space bar, I set the variable “space” to “true”. But when I press the keys “A” and “W” and then press “space”, then the variable “space” is not set to “true”. What is the problem here?

Post the script to get it fixed.

1 Like

Looks fine. So how are you debugging this? How do you know the variable is not set?

1 Like

1

All I can confirm that this should and does work on my end, as expected.


Could you confirm this prints True if you hold just the Spacebar but prints False if you hold Spacebar and another key?

Is this the case? If it is:

Visit this place:

http://www.iljitsch.com/2020/keyboardtest/

And see if your keyboard can actually handle the 2 keys simultentously.

image

Above, I’m holding both A & Spacebar. There was a post recently where someone was using a very old keyboard and key rollover kicked in… Not saying that’s it but simply grasping at straws at this point.

1 Like

If I press the spacebar then the variable is set to true. If I don’t press the spacebar, then the variable is false. If I hold down “A” then press “Space” - then the variable is true. If I hold down “A” and “W” and press the spacebar, then the variable is not set to true.

This works fine as is. The script looks fine.

Double check the keyboard rollover tool I linked and do tell how it goes. Apart from that, what are the chances something else resets that variable?

1 Like

When following this link, I found out that when “A” and “W” are pressed, the space bar is not pressed. It turns out that my keyboard does not support pressing three keys. Will buying a new keyboard solve this problem?

Yes. You must be very unlucky, 99.98% of modern (after 2010) keyboards should have no problems with that.

1 Like

Thank you friend, you helped me a lot.