InputChanged KeyCode Unknown

userInputService.InputChanged:Connect(function(i,g)
	if not g then
		print(i.KeyCode)
	end
end)

Output:

Enum.KeyCode.Unknown

I only have this issue with InputChanged and nothing else. It says the KeyCode is unknown no matter what key I press. Is Roblox bugged right now, or am I doing something wrong here?

It seems to work with controls that are non-binary (triggers or joysticks on a controller), but that’s it. Is that the only purpose of the InputChanged event?

This might be your solution? KeyCode displaying as "Unknown" - #12 by HammyLammyYT

InputChanged it’s usually used for MouseMovement, controller keys or UserInputType. For keyboard-related input you should use InputBegan and InputEnded events.

2 Likes

I see, that’s a bit annoying. It should work with all input types and use 0/1 for the value for binary input like it does with the controller module.

Thanks for confirming anyways. I’m currently writing a module that adds or replaces a lot of Roblox’s default things to work the way I’d prefer them to. I guess InputChanged is added to that list.

1 Like

Thank you for your response, but that doesn’t have anything to do with what I’m doing.

I just had this issue, also! There is no info on the wiki which states that input changed doesn’t work with keyboard so I was very confused. I will use InputBegan also, but it’s still unfortunate that it does not work with InputChanged.

1 Like

The Roblox Docs say it should work with keyboard input. But this is obviously not the case.