UserInputService-related error: Invalid value for Enum KeyCode

This bug occurs at some point every time I try to seriously use UserInputService in any of my projects. It breaks my scripts, resulting in non-functionality and ruining my game. There is no way around it and it even breaks roblox’s CoreScripts.

Here’s my code:
ReplicatedStorage.Mouse lines 42, 43, 44

uis.InputBegan:connect(function(input) if input.KeyCode == mouse.ChatKey and mouse.Chatting == false and mouse.AutoChatDetectionEnabled then mouse.Chatting = true

Players.ArceusInator.PlayerGui.ChatGui.ChatClientScript lines 147, 148, 149

UIS.InputEnded:connect(function(input) if input.KeyCode.Name == 'Slash' then if Mouse.Chatting == false then

It would appear that simply accessing the KeyCode property invokes this error, though the occurrence of the invalid enum seems to be random as I can’t reliably repro the behavior. Please fix this ASAP.

2 Likes

Thanks for the info. I think this is related to not reflecting the entire KeyCode enum into Lua, I can fix this pretty easily I think.

.< daarn you comic sans!

Otherwise, I’ve not been getting these strange errors and I use Enum.KeyCode… In fact, I also use the same!

ArceusInator - So you get this error locally then? If so, what kind of keyboard are you using? What language do you have it set to, if any?

1 Like

I’m using a Razer Blackwidow and I haven’t changed it from factory settings. After some more testing it appears that the error occurs when you press the menu key and then click back inside of the window.

Ok cool, this is what I thought might happen. I’m making sure all enum values are now bound to lua, so its impossible to get this error. It does mean there will be some sort of odd values exposed, but no more crashing.