Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you detect Right mouse down?

Asked by
Mystdar 352 Moderation Voter
10 years ago

Normally people do scripts, like with click detectors or weapons with the left mouse, and I know you can detect keys with Strings or ASCII characters, but how would you detect a right mouse down? Thanks

2 answers

Log in to vote
1
Answered by 10 years ago

Bman is correct, but kinda incorrect.

You can only use MouseButton2Down on GUI objects. You can use Button2Down on Mouse objects [:GetMouse(), Selected:connect(function(mouse) [...] end)] And, on ClickDetectors, MouseClick:connect triggers on Left and Right mouse clicks.

Ad
Log in to vote
0
Answered by
Bman8765 270 Moderation Voter
10 years ago

Just do MouseButton2Down:connect instead of MouseButton1Down:connect

You can find a lot more about what you can do with the mouse here: http://wiki.roblox.com/index.php?title=API:Class/Mouse

Below is an example script.

local part = -- Insert your part or gui here

function RightClick()
    print("Right clicked")
end

part.MouseButton2Down:connect(RightClick)

Answer this question