generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: ***Left and right mouse click***

Previous Thread :: Next Thread 
OmgFlyingSpaceCow is not online. OmgFlyingSpaceCow
Joined: 16 Dec 2009
Total Posts: 564
01 Aug 2011 07:37 PM
In lua, can you make a tool do somthing with a **RIGHT** mouse click ONLY, and if so, can you have it so if you left click, it does one thing, while if you right click, it does somthing else??

You see, I'm making a custom staff of mine, Staff of Azure Ever Ice with no reload time and a melee feature. I want it so that if I right click, it does the melee move from another weapon script (The melee script works fine, but only when it's the only combat script in the tool.). If the top paragraph is possible, please tell me what to write in order to launch the melee script via RIGHT mouse click,

I get this idea because I saw "mouseclick1" or somthing like that (Again, it may not be exact, but it's simaller to that term", that lead me to think if whether or not that meant which button on the mouse you clicked.

I want to really bad, but If I ask people to make that mouse script for me, that'd be a request, and you would all hate me, 'cause haters gonna hate.
So, if you could help me, great, I appreciate it. If you could follow through with me and see the staves and such, even better.


The scripts currently in the staff are not needed in this forum. If I knew how to swich between mouse buttons, I can edit them myself.










If you read all that... THANKYOU!
Report Abuse
Ulla42 is not online. Ulla42
Joined: 14 Dec 2009
Total Posts: 1774
01 Aug 2011 07:38 PM
MouseButton2Down
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
01 Aug 2011 07:39 PM
You'll have to use a Text/ImageButton for the right click since Tools/HopperBins don't support right clicks.

It IS possible, but I don't recommend the method (however, I did use it in my ADS experiments).
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
01 Aug 2011 07:39 PM
One problem, mouse.Button2Down doesn't fire
Report Abuse
Ulla42 is not online. Ulla42
Joined: 14 Dec 2009
Total Posts: 1774
01 Aug 2011 07:40 PM
Unless you right click
Report Abuse
Ulla42 is not online. Ulla42
Joined: 14 Dec 2009
Total Posts: 1774
01 Aug 2011 07:41 PM
Also, It's not "mouse.Button2Down"
It's MouseButton2Down
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
01 Aug 2011 07:41 PM
He's using a TOOL, not a GUI.
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
01 Aug 2011 07:43 PM
MouseButton2Down --This is in a GUI, and this does, in fact, fire.
mouse.Button2Down -- This is in a Tool/Hopperbin, and it doesn't fire.
Report Abuse
OmgFlyingSpaceCow is not online. OmgFlyingSpaceCow
Joined: 16 Dec 2009
Total Posts: 564
01 Aug 2011 07:44 PM
Ah yes, what I saw was "Mousbutton1down". And I belive I saw that within the tool script.
Report Abuse
OmgFlyingSpaceCow is not online. OmgFlyingSpaceCow
Joined: 16 Dec 2009
Total Posts: 564
01 Aug 2011 07:49 PM
Okay, so recap.

If I use "Mousebutton1down", that is left click and "Mousebutton2down" is right?

What would be the correct line if I wanted to do this (I'll use some lua terms in it):

if Mousebutton2down was clicked then
...
Report Abuse
ChaosStar95 is not online. ChaosStar95
Joined: 19 Feb 2009
Total Posts: 5943
01 Aug 2011 07:53 PM
No. MouseButton1Down is right, MouseButton2Down is left. You NEED correct capitalization in scripting.
Report Abuse
ChaosStar95 is not online. ChaosStar95
Joined: 19 Feb 2009
Total Posts: 5943
01 Aug 2011 07:53 PM
Wups... I meant MouseButton1Down is left, MouseButton2Down is right...
Report Abuse
OmgFlyingSpaceCow is not online. OmgFlyingSpaceCow
Joined: 16 Dec 2009
Total Posts: 564
01 Aug 2011 07:57 PM
Yes yes, I realized I capitalized wrong 2 seconds after I posted. It would be stupid to post again just to fix errors.

So if MouseButton1Down is right click, then that is the button that is less used?
You click just about everything with your left mouse button.
And still, how would I have it so if I right mouse click, it would trigger the rest of the script? I am very unfamiliar with the mouse in lua, and am unaware of its properties.
Report Abuse
OmgFlyingSpaceCow is not online. OmgFlyingSpaceCow
Joined: 16 Dec 2009
Total Posts: 564
01 Aug 2011 07:58 PM
.___________________________. You posted while I was typing, and I suspected the MouseButton's were mixxed up in your post...
Report Abuse
OmgFlyingSpaceCow is not online. OmgFlyingSpaceCow
Joined: 16 Dec 2009
Total Posts: 564
01 Aug 2011 08:05 PM
Bump.

Main question still remains!

"How would I have it so if I right mouse click, it would trigger the rest of the script? I am very unfamiliar with the mouse in lua, and am unaware of its properties."

Answer it to get the immaginary golden cookie dispencer.
Report Abuse
OmgFlyingSpaceCow is not online. OmgFlyingSpaceCow
Joined: 16 Dec 2009
Total Posts: 564
01 Aug 2011 08:13 PM
Bump.

Main question still remains!

"How would I have it so if I right mouse click, it would trigger the rest of the script? I am very unfamiliar with the mouse in lua, and am unaware of its properties."

Answer it to get the immaginary golden cookie dispencer.
Report Abuse
ChaosStar95 is not online. ChaosStar95
Joined: 19 Feb 2009
Total Posts: 5943
01 Aug 2011 08:16 PM
In a tool, a script triggered by the left mouse button would look something like this:

local t = script.Parent

t.Selected:connect(function(mouse)
mouse.Button1Down:connect(function()
--Stuff
end)
end)
Report Abuse
OmgFlyingSpaceCow is not online. OmgFlyingSpaceCow
Joined: 16 Dec 2009
Total Posts: 564
01 Aug 2011 08:21 PM
Selected is not a valid member of Tool
Report Abuse
OmgFlyingSpaceCow is not online. OmgFlyingSpaceCow
Joined: 16 Dec 2009
Total Posts: 564
01 Aug 2011 08:24 PM
I tried equipted too. It did not work either.
Report Abuse
ChaosStar95 is not online. ChaosStar95
Joined: 19 Feb 2009
Total Posts: 5943
01 Aug 2011 08:24 PM
You're right. I'm sorry, that script is for HopperBins.
Report Abuse
ChaosStar95 is not online. ChaosStar95
Joined: 19 Feb 2009
Total Posts: 5943
01 Aug 2011 08:25 PM
Actually, it's spelt "Equipped".
Report Abuse
OmgFlyingSpaceCow is not online. OmgFlyingSpaceCow
Joined: 16 Dec 2009
Total Posts: 564
01 Aug 2011 08:37 PM
Oh, haha, I made another typo? yes, equipped.
Report Abuse
scepile3 is not online. scepile3
Joined: 27 Feb 2009
Total Posts: 260
01 Aug 2011 09:16 PM
Equipped has to be capitalized also, since capitalization is also vital in scripting... '.'

Also, you might want to use print() to make sure the right click event ever fires... '.'
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
01 Aug 2011 10:38 PM
http://www.roblox.com/Right-Click-Tool-HopperBin-item?id=58197624

Please read the description before taking it.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image