Shift to sprint not working when pressing numbers

I was working on an fps system when I noticed that pressing 2 or 4 stopped all movement when running

local userInput = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local sprintSpeed = 30 
local walkSpeed = 16 

userInput.InputBegan:Connect(function(IO, GPE)
	if not GPE then        
		local keycode = IO.KeyCode

		print(keycode)
		if keycode == Enum.KeyCode.LeftShift then 
			player.Character.Humanoid.WalkSpeed = sprintSpeed
		end
	end
end)

userInput.InputEnded:Connect(function(IO, GPE)
	if not GPE then
		local keycode = IO.KeyCode
		
		print(keycode)
		if keycode == Enum.KeyCode.LeftShift then
			player.Character.Humanoid.WalkSpeed = walkSpeed
		end
	end
end)

Using :IsKeyDown didn’t work either

My apologies if this is in the wrong category, I was not sure if it was an engine bug or an issue with my script

for this type of system i would recommend using ContextActionService since you can directly bind the shift key to a function rather than dealing with all keys with UserInputService

(then again i prefer using context action service for most of my key binds)

local cas = game:GetService("ContextActionService")
local plr = game:GetService("Players").LocalPlayer
local sprint = 30
local walk = 16

local function actionHandler(name,state,obj)
    if name == "Sprint" then
        if state == Enum.UserInputState.Begin then
             plr.Character.Humanoid.WalkSpeed = sprint
        elseif state == Enum.UserInputState.End then
             plr.Character.Humanoid.WalkSpeed = walk
        end
    end
end

cas:BindAction("Sprint",actionHandler,false,Enum.KeyCode.LeftShift) -- action name, function to bind, create mobile button, key to bind)