'GetStringForKeyCode' returing an empty string

I was trying to get a keybind module going for my game which would handle basically get the correct input type for the users specified input device making my life easier but then when it tries to convert a ‘KeyCode’ longer then a single character(‘LeftShift’ or ‘LeftControl’) it can’t and returns an empty string.
Here a screen-shot of the command ran on the console
image

I’ve had to go with a function that convert it for me

image
I was wonder if this is a roblox bug or because of the different keyborads it can’t return a string for these ‘KeyCodes’.

What do you want it to return for these keys? It doesn’t make sense. EnumItems have a Name property, which you can use to fallback to if UserInputService:GetStringForKeyCode returns an empty string.

1 Like

return the string version of their KeyCode

Then yes, the Name property should be used as a fallback.

1 Like

Oh i didn’t know enumitems have .Name

1 Like

didn’t show in my autofill but thanks