UIS InputBegan runs twice

There is a bug where if you press “Left Shift” and 2 other buttons, then let go of “Left Shift”, the button you pressed last will trigger an InputBegan event.

local UserInputService = game:GetService("UserInputService")
 
local function onInputBegan(input,gameProcessed)
	if input.UserInputType == Enum.UserInputType.Keyboard then
		print("A key is being pushed down! Key:",input.KeyCode)
	end
end

local function onInputEnded(input,gameProcessed)
	if input.UserInputType == Enum.UserInputType.Keyboard then
		print("A key was unpressed! Key:",input.KeyCode)
	end
end
 
UserInputService.InputBegan:Connect(onInputBegan)
 
UserInputService.InputEnded:Connect(onInputEnded)

To replicate this, put this code in a localscript, run a play solo session, press down on “Left Shift” and then press any two buttons, e.g. “F” and “G”. When you let go of “Left Shift” while still holding down on the other two buttons it will trigger an InputBegan event with the key “G”.
Here is what the output looks like:

image

This seems to only happen in studio.

8 Likes

I’m having the same issue, but I can’t find how to fix it.