GetMouseButtonsPressed

Constructor:

GetMouseButtonsPressed()

Description

Returns the inputObject array corresponding to the current pressed-down mouse button

Return Value

Variable name Type Default Description
inputobject table {inputobject input_information_object_list}

Examples

Keep monitoring the enumerated keys pressed on the current object in the loop. Traverse the returned table and observe whether the traversal information is correct or not.

coroutine.start(function()
    while true do
        coroutine.wait(0.1)
        
        local str = ""
        local a = UserInputService.GetMouseButtonsPressed()
        for i = 1,#a do
            str = str..tostring(a[i].InputType).."  "
        end
        print(str)
    end
end)