What is the keycode for right mouse button?

what is the keycode for the right mouse button I want to detect when the player presses the right mouse button.

6 Likes

Enum.UserInputType.MouseButton2, you will need to check the InputObject’s UserInputType for this, not the keycode property

example

UserInputService.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton2 then
       --right click pressed
    end
end)
9 Likes

Thanks I didnt know the right keycode

2 Likes

Wait
It says mouseButton2 is not a member

2 Likes

Did you write it correctly? You need to use the UserInputType Enum, not the KeyCode Enum

2 Likes

ahhh yeah that’s my bad I used keycode

4 Likes