UIS equivalent of Mouse.Button2Up

So I was working in melee weapon project and I want to make a block when you right click and I wanted to use UserInputService. How would I achieve this?

Use UserInputService.InputEnded, with the InputObject that is passed, check that its UserInputType is Enum.UserInputType.MouseButton2

Can you provide an example of this?


local userInputService = game:GetService('UserInputService')

userInputService.InputEnded:Connect(function(inputObject, gameProcessedEvent)
    if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
        print('mouse button 2 up')

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.