Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you detect Right mouse down?

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

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.

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.