I want to convert a KeyCode to character
Example:
Enum.KeyCode.Asterisk
into
*
I tried making a table and a code to replace but I just don’t want to make a full table of every possible character
Please help me
I want to convert a KeyCode to character
Example:
Enum.KeyCode.Asterisk
into
*
I tried making a table and a code to replace but I just don’t want to make a full table of every possible character
Please help me
One option is that…key codes have value properties and ones that can be represented as characters have values corresponding to valid ASCII codes. Here’s an example:
local function keyCodeToString(keyCode)
if keyCode.Value < 127 and keyCode.Value > 33 then --// excluding space (32) character
return string.char(keyCode.Value)
else
return keyCode.Name --// just return keycode name if not within range
end
end
Or another option is if this is more intended for displaying something to users/players, GetStringForKeyCode also exists.
thank you for helping me!
I didn’t know that existed