Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why are esc, shift, control, option keyboard input all numbers in Roblox?

So I Was messing around with keybinds today and could not find out why one of my keybind is not working until I printed everything, it printed that shift is 0, control is 2, right option is 3, left option is 4, which I assume that esc is 1. But why is this happening and how to differentiate numbers and those other keys?

1 answer

✓ Accepted answer

We would need more context to your situation.

I'm assuming you're referring to the KeyCode enums you get from InputBegan/Ended? In that case, these numbers do not correspond with the values assigned to the enums that represent the keys in the KeyCode Enum Reference

Here are the enums you enquire and their values:

  • Left Shift: Enum.KeyCode.LeftShift. Value: 304
  • Right Shift: Enum.KeyCode.RightShift. Value: 303
  • Left Control: Enum.KeyCode.LeftControl. Value: 306
  • Right Control: Enum.KeyCode.RightControl. Value: 305

Unfortunately, after some testing, the Escape (esc) key is not detectable via InputBegan/Ended. Generally, you shouldn't use the Escape key as a keybind, but if your intentions are to do something when the roblox menu opens and closes, you can use the following events:

This discussion is preserved as it was. New answers, comments, and votes are closed.