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

Key Code for Right Mouse Button?

Asked by
u_g 90
10 years ago

How would you make it so that something is done when the right mouse button is clicked? [Also, it has to be compatible with this:

1if key == "(right mouse button)"  then
2-- code
3end

1 answer

Log in to vote
2
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

Well, It's MouseButton2Down. So...

1mouse = game.Players.LocalMouse:GetMouse()
2mouse.Button2Down:connect(function()
3    print("Right click!")
4end)
0
Thanks. u_g 90 — 10y
0
Thank me by Accepting this answer! Shawnyg 4330 — 10y
Ad

Answer this question