How do I get this string value?

So what im wondering is how would I get the value of LeftShift from its KeyCode (the keycode for Lshift is 304)
What I tried works with letters but not with things like shift and control.

1 Like

inputObject.KeyCode is an EnumItem and all EnumItems have a property “Name” which indicates the associated name. Doing inputObject.KeyCode.Name will allow you to compare the input with a name.

You can also optionally compare an EnumItem with another EnumItem such as inputObject.KeyCode == Enum.KeyCode.LeftShift

2 Likes

Probably would’ve been a good idea to look at Enum documentation first. :slightly_smiling_face:

Using the above’s feedback (putting it into code form), essentially, this:

local name, value = inputObject.KeyCode.Name, inputObject.KeyCode.Value
if value > 96 and value < 123 or value == 304 or value == 306 then
    button.Text = name
1 Like