O keycode for some reason not functioning

I’m trying to play around with UserInputService

The problem is that for some reason the O key specifically doesn’t seem to work, i have this code in a local script and i don’t think it’s my keyboard’s fault since i can type with O

		if input.KeyCode == Enum.KeyCode.O then

But when i switch it to something like L then it works

Full code:

local UserInputService = game:GetService("UserInputService")
local points = 0

print(points)
if UserInputService.KeyboardEnabled then
	UserInputService.InputBegan:Connect(function(input, gameProssesedEvent)
		print(input)
		if input.KeyCode == Enum.KeyCode.O then
			print(tostring(1))
		elseif input.KeyCode == Enum.KeyCode.P then
			print(tostring(2))
		end
	end)
end
1 Like

Are you sure it’s O and not 0? Also, you don’t need to convert numbers to strings.

O key is binded to the key to zoom out.

No it’s definitely O since if it was 0 then it would appear in Number color

Ah. Then maybe it’s @dmksa123’s solution.

Is there some sort of workaround if somebody wanted something to happen when a player clicks O?

probably, try not using,

it should work without it. Correct me if I am wrong.

Yeah, it works without it. I’ve never even heard of KeyboardEnabled.

1 Like

No it didn’t

And i accidently clicked the solution button

Use ContextActionService to do that.

ok then try removing that second argument. idk what that is but might just work without it.

gameProcessedEvent

Disabling I and O keys to zoom the camera in and out What I found on the devforum.

1 Like

I’t certainly exists
Ekrānuzņēmums 2021-07-13 230025

I’m pretty sure that KeyboardEnabled is to check if the client has a keyboard

oh I think ik why it aint working. you are trying to bind it to an already binded key. O zooms out the user’s camera

I know. I was just saying that I’ve never heard of it.

I don’t know if it’s outdated or what but they don’t seem to work for me