Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
1
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
3 years ago

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:

Ad

Answer this question