It is super weird, but If I try to get string for spacebar, it doesn’t return.
If this is intentional then I think it is really stupid, and I have to make additional checks if returned string is “empty”.
it returns " "
why do u use this?
For keybinds specifcally to display them in UI.
can you send this part of script?
local x = Key ~= " " or "Space"
try this
local function getKeyCodeString(keyCode)
local keyCodeString = UserInputService:GetStringForKeyCode(keyCode)
return keyCodeString ~= " " and keyCodeString or keyCode.Name
end
I have the solution I just wanted to make post about this to raise awareness.
I wanted to make engine bug report about this, or feature request but I don’t have access to post there.
I should’ve clarified that, sorry!
local function getKeyCodeString(keyCode)
keyCode = keyCode ~= " " and keyCode or "Space"
local keyCodeString = game.UserInputService:GetStringForKeyCode(keyCode)
return keyCodeString
end
Hey, I’m just guessing but there is probably many more KeyCodes which return “empty” string so I think my original solution is just more future-proof.
I suggest transferring this post to the Bug-Support direct messages that go to the group. If the problem is indeed present and valid, they will post it on the appropriate forum page for you.
I would love to do that, but I don’t have access to post there.
Oh I see, I couldn’t see it :P, will transfer this now!
Couldn’t you just use Enum.Keycode.Name instead of the GetStringForKeycode() method?
Well, I could but for keycodes like SemiColon it is better to get the actual character.
