Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

KeyDown event for numbers?

Okay so I have a script that currently just prints a key when you press it, really simple. The problem is when I press any number key it wont print anything. How exactly would I get the number key pressed?

the code(in startergui)

mouse = game.Players.LocalPlayer:GetMouse()

mouse.keyDown:connect(function(key)
	print(key)
end)

1 answer

✓ Accepted answer

The numbers aren't available because they are used by the Backpack by default, for switching tools.

While it may not work for your particular case, one solution is to disable the default Backpack GUI.

You'll then be able to use the number keys.

game.StarterGui:SetCoreGuiEnabled(
	Enum.CoreGuiType.Backpack, false
)
-- 2 or "Backpack" should also work for type

SetCoreGuiEnabled

This discussion is preserved as it was. New answers, comments, and votes are closed.