UserInputService half the time not detecting 'O' key presses?

Very odd issue here. I literally have this:

userInputService.InputBegan:Connect(function(input)
print(input.KeyCode)
end

Sometimes when Studio starts, it works for O. Other times, nothing happens when I press O. I’ve yet to experience this issue occurring in an actual server.

Engine bug I’m guessing, as usual. But, I don’t really know.

Thanks for any help

1 Like

Have you considered using ContextActionService as an alternative?

1 Like

I assume all other keys do work? And does this error also occur in roblox player?

1 Like

It seemingly does. It prints other inputs I press, but not O consistently. Sometimes it works in Studio, other times it doesn’t.

Never had an issue with this in a live game yet, from my knowledge.

Very, very weird behavior

1 Like

Very odd as well as we cannot say that the “O” key might be intersecting with any roblox keybinds by default. :thinking:

This is definately a bug that will have to be looked info, perhaps try contacting support.

2 Likes

In the past, the O and I was assigned for zooming out and in, most likely to accommodate the laptop users. You could test if Enum.KeyCode.I also experience the same issue or not. If it doesn’t, it’s probably just that key that is overridden by something such as the use of ContextActionService(don’t know if key presses have certain priorities).

1 Like

I just tested, and that does appear to be what’s happening.

It’s weird though, because it does seem to work in live servers, and it’s pretty much 50-50 when I test in Studio, no clue why.

I’ve tried using ContextActionService in the past to override existing key strokes, but I had no success, maybe I wasn’t doing it correctly?

I’ve also experienced issues with the O and I keys in the past, I believe that it’s just a bug that needs patching.

1 Like

Try running this function once on ContextActionService:

Find the relevant action that relates to both I and O, unbind those actions if they exist and if you can.

If they don’t exist there, it’s probably hard-coded? I’ve never seen UserInputService override before though.

2 Likes

Arent you supposed to put

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

end
1 Like

The piece of code in the OP will print any time UserInputService captures input from an input device, so it should print any time input is passed. The issue OP is facing is that when they press O it’s not getting registered by UserInputService so there’s no print available.

Your if statement would only cause the subsequent instruction to execute if the KeyCode is O but that’s not the root of the problem here. OP expects a print when O is pressed and it doesn’t happen; they aren’t trying to make a system that only invokes when O is pressed.

2 Likes

I figured it out. It doesn’t register O because O is one of the keybinds used for the roblox zoom in and zoom out feature.