Starting on 8th July, we are receiving some Client side errors about invalid enum KeyCode
Some errors comes from our scripts such as
local function onInputBegan(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or -- AT THIS LINE
input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D or
input.KeyCode == Enum.KeyCode.Up or input.KeyCode == Enum.KeyCode.Left or
input.KeyCode == Enum.KeyCode.Down or input.KeyCode == Enum.KeyCode.Right then
pressKeys[input.KeyCode] = true;
remoteEvent_InputChange:FireServer(1)
end
end
end
I believe this is quite innocent looking. The error seems to come from whenever we access input.KeyCode
We can also see from the screenshot below, that some of these errors are coming from the roblox internal as well
local function onInputBegan(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard then
local key = input.KeyCode
-- Check key is valid and not Unknown
if key and key ~= Enum.KeyCode.Unknown then
if key == Enum.KeyCode.W or key == Enum.KeyCode.A or
key == Enum.KeyCode.S or key == Enum.KeyCode.D or
key == Enum.KeyCode.Up or key == Enum.KeyCode.Left or
key == Enum.KeyCode.Down or key == Enum.KeyCode.Right then
pressKeys[key] = true
remoteEvent_InputChange:FireServer(1)
end
end
end
end
Are you able to reproduce this error locally? Secondly, are you sure this has only happened starting on the 8th and not from before? Could you confirm when your first report was? Thanks
if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or -- AT THIS LINE
This error most likely occurs when input.KeyCode itself is an “invalid enum KeyCode.” When Luau tries to compare this invalid value to a valid Enum.KeyCode.W, it throws the error.