if should be if not gameProcessed then
This is because it will only return as false when the player is typing on something or is not on the game.
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed then return end
if input.KeyCode == Enum.KeyCode.Left then
print("Left")
elseif input.KeyCode == Enum.KeyCode.Right then
print("Right")
elseif input.KeyCode == Enum.KeyCode.Up then
print("Up")
elseif input.KeyCode == Enum.KeyCode.Down then
print("Down")
end
end)