How do I detect if a player pressed a number?

I am currently trying to make a keyboard in roblox studio, i’ve got all of the normal keys working but for some reason I can’t detect when a player has pressed a button. Here’s the code:

	if input.KeyCode == Enum.KeyCode["1"] and not IsTyping then
		Q_KEY.BackgroundColor3 = Color3.fromRGB(168, 176, 22)
	end```

Thanks for reading :slight_smile:

For numbers, you neem to type them in letters like Enum.KeyCode.One ect.:

2 Likes

To make it easier you could also have a table or something,

local Keys = {
Enum.KeyCode.One = Color3.fromRGB(168, 176, 22),
Enum.KeyCode.Two = Color3.fromRGB(170, 180, 25),
---etc.
{

Q_KEY.BackgroundColor3 = Keys[input]
2 Likes