I’m implementing console support for my game, however I’m having a problem with the button A. I’m using an Xbox One controller, and Enum.KeyCode.ButtonA
to detect the input, however it doesn’t fire. Is this a bug or does it happen to others as well? The character jumps so it’s not my controller’s button not working.
Edit: Note that I’ve tried both on Studio and on the normal Roblox client, same result. Not being detected in both.
There are certain KeyCodes that fall under ‘GameProcessedEvents’, such as ButtonA, F, and a few others.
If you’re filtering out GPE input, make sure to put an exception to ButtonA, or any other key you use that’s considered GPE.
I do it like this myself;
local gpeWhitelist = {
Enum.KeyCode.ButtonA;
Enum.KeyCode.F;
}
function Input(io,gpe)
local iKey = io.KeyCode;
local iState = io.UserInputState;
local iType = io.UserInputType;
local whitelisted = table.find(gpeWhitelist,iKey)
-- print("key",iKey,"state",iState,"type",iType,"whitelisted",whitelisted,"gpe",gpe)
if (gpe and whitelisted == nil) then-- print("INPUT BLOCKED",gpe,iKey,iState,iType)
return
end
end
UserInputService.InputBegan:Connect(Input)
UserInputService.InputChanged:Connect(Input)
UserInputService.InputEnded:Connect(Input)
3 Likes
Now it works fine, thanks. I didn’t know about it so thanks for letting me know that too.