Problem with detecting number key pressed

The local script

-- game variables
local userInputService = game:GetService("UserInputService")
local RepStorarge = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

-- Other variables
local SubRootPart = workspace.Submarine.RootPart

userInputService.InputBegan:connect(function(inputObject, gameProcessedEvent)
	if gameProcessedEvent then
		if inputObject.KeyCode == Enum.KeyCode.One then
			print("z")
		end
	end
end)

Z is not printing, however it works with letter keys on the keyboard but not with number keys.

Why doesn’t it work with, “Z” then?

What? I don’t know, that’s why I’m posting this in scripting support?
Z doesn’t print when the number one key is pressed, not the keycode z

I’m sorry, I was a bit confused before, are you on a Laptop?

If you are, then pressing 1 won’t do anything because I think it only registers the Number Pad 1Keyboard_LI

I am using a laptop.
Is there anyway to solve this?

Oh, that’s the problem then. You can fix it by changing 1 to One.

No thats not the problem, I just tested it out with the numpad on my keyboard, it still doesnt work.

Oh wait, no. That won’t work. Nevermind.

It is not a problem that it would only register the Number Pad 1 (Enum.KeyCode.KeypadOne). It has there another keycode for that.

The problem is

if gameProcessedEvent then

Because you have disabled the backpack.

Oh, you tried it with a keyboard?

No I just looked on the list of KeyCodes. InputObject | Documentation - Roblox Creator Hub

Yeah, you’re right. I didn’t know there was a separate KeyCode for KeyPadOne.