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: What's the difference?

Previous Thread :: Next Thread 
mark298 is not online. mark298
Joined: 24 Oct 2008
Total Posts: 1264
27 Aug 2013 09:53 AM
What's the difference between 'MouseButton1Click' and 'MouseButton1Down'?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
27 Aug 2013 09:55 AM
MB1C fires when someone completely clicks a GUIbutton with the left mouse button, while MB1D fires when the left mouse button is held down.

MB1C will fire when the player clicks it normally, but if they just hold it down, it won't fire, however, MB1D will. There's also MB1U, which is the opposite of MB1D, and will fire when the left mouse button is up.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
27 Aug 2013 10:43 AM
That explanation can be kind of confusing to people who don't know the difference between Click and Down.

May I offer an explanation of my own?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
27 Aug 2013 11:10 AM
Be my guest, Agent.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
27 Aug 2013 11:30 AM
MouseButton1Down - Fires when you press the left button of the mouse on the UI
MouseButton1Click - Fires when the cursor remains on the UI when MouseButton1Down and Up happens.

MouseButton1Up - Fires when you lift the left button on the mouse on the UI




I dunno why but I prefer to use MouseButton1Up over MouseButton1Click.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
27 Aug 2013 11:33 AM
I'm also pretty sure for MouseButton1Up, if you held the left mouse button down even off the GUIButton with the script, and lifted it on the button with it, it would still fire. The MouseButton1Click will actually check for a legitimate click of the left mouse button.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
27 Aug 2013 11:39 AM
"MouseButton1Down - Fires when you press the left button of the mouse on the UI
MouseButton1Click - Fires when the cursor remains on the UI when MouseButton1Down and Up happens.

MouseButton1Up - Fires when you lift the left button on the mouse on the UI"

That is basically what I was going to say.

The problem with your explanation, Knightmare, is the way you said "completely clicks." It didn't give the explanation I would have wanted if I were learning this.

But, to add to these definitions:


MouseButton1Down - Fires when you press the left button of the mouse on the UI

MouseButton1Up - Fires when you lift the left button on the mouse on the UI

MouseButton1Click - Fires when the MouseButton1Down AND MosueButton1Up events are fired on the same UI element (you can press down the button, move the cursor outside of the element, move the cursor back inside the element, release the button, and this event will still fire).

Basically, we can "simulate" a MouseButton1Click event by doing the following (this is an extremely basic example and does not cover all cases in terms of cursor position combined with button manipulations):


GuiElement.MouseButton1Down:wait()
GuiElement.MouseButton1Up:wait()
print "Clicked!"
Report Abuse
mark298 is not online. mark298
Joined: 24 Oct 2008
Total Posts: 1264
28 Aug 2013 06:57 AM
@AgentFirefox, That explantion is perfect.

Thankyou.
Report Abuse
mark298 is not online. mark298
Joined: 24 Oct 2008
Total Posts: 1264
28 Aug 2013 06:57 AM
Explanation* :/
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