Pressing Mouse2 and then Mouse1 in exactly the same frame causes InputBegan not to fire

Using the following script, which is in StarterPlayer:

local function f(actionName, inputState, inputObject)
	print("ContextActionService", inputState)
end

game:GetService("ContextActionService"):BindAction("mouse1", f, false, Enum.UserInputType.MouseButton1)

local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		print("UserInputService", input.UserInputState)
	end
end)

UserInputService.InputEnded:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		print("UserInputService", input.UserInputState)
	end
end)

Pressing Mouse2 and then Mouse1 in exactly the same frame makes InputBegan not fire. In the following screenshot, you can see that InputEnded fired twice in a row.

image

This is annoying because I use ContextActionService for my game, and players tend to press right click and left click at the same time when they want to aim and shoot.

EDIT: Mouse1 doesn’t appear when I poll UserInputService:GetMouseButtonsPressed() every frame, either, even though it’s clearly pressed.

2 Likes