What is the Mouse.Button1Down equivalent to UserInputService?

What is the Mouse.Button1Down equivalent to UserInputService?
The article here: Mouse | Documentation - Roblox Creator Hub tells the reader to, “Note, developers are recommended to use UserInputService instead of the Mouse object in new work.” But, the article fails to actually tell you how.

What solutions have you tried so far?
I’ve looked into ContextActionService and of course UserInputService but, I failed to find any documentation on anything with this except UserInputService:IsMouseButtonPressed which I tried but failed at.

UIS.InputBegan:Connect(function(input)
	if input == Enum.UserInputType.MouseButton1 then
		print("Button is down")
	end
end)

UIS is UserInputService BTW.
I would try ContextActionService but, i’ve seen it done with UserInputService so I am unsure if I need to.

7 Likes

input has a .UserInputType property, whereas input itself is an instance of class InputObject, you can look it up on the dev hub.
Small modification to your example code:

UIS.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        print("button is down")
    end
end)
30 Likes