mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 27 Aug 2013 09:53 AM |
| What's the difference between 'MouseButton1Click' and 'MouseButton1Down'? |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 28 Aug 2013 06:57 AM |
@AgentFirefox, That explantion is perfect.
Thankyou. |
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
| |
|