|
| 06 Nov 2013 05:22 PM |
Should the mouse.Button1Down event work correctly in a global script if the mouse has been gotten from the tool.Equipped event?
For me it's not working as a global script with the tool.Equipped :P.
Ex:
tool.Equipped:connect(function(mouse) -- Fine mouse.Button1Down:connect(function() -- this code does not work end) -- works end)
Lolz. Please help! |
|
|
| Report Abuse |
|
|
|
| 06 Nov 2013 05:24 PM |
A global script? Do you mean LocalScript? Remember to get the mouse of the local player. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 06 Nov 2013 05:25 PM |
@Toxic a global script is the opposite of a localscript please leave |
|
|
| Report Abuse |
|
|
|
| 06 Nov 2013 05:40 PM |
No, it will not. The Mouse Object exists to the client only, meaning that the server is trying to reference a null Object whenever you try to use it, resulting in an error.
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 06 Nov 2013 05:45 PM |
| I thought equipped returns mouse so you could do that |
|
|
| Report Abuse |
|
|
|
| 06 Nov 2013 05:47 PM |
It does. However, the server doesn't know how to use the Mouse, and the Mouse has no idea what to do. So basically, it just dies. Poor thing. I'll bury it. Anyways, any Mouse Object (including extensions such as PlayerMouse) must be used with a LocalScript.
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
|
| 07 Nov 2013 01:53 PM |
Ok, but will this work if I use the :GetMouse() function on the Player?
I need to have it be a Global script because later in the script it interacts with other Player's PlayerGui's, which are local to the Player in a LocalScript :P. |
|
|
| Report Abuse |
|
|
|
| 07 Nov 2013 02:38 PM |
No, you cannot. Any Mouse Object (or extend of it) must be used by a LocalScript.
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 07 Nov 2013 03:22 PM |
| You could use Humanoid.Target or Humanoid.TargetPoint... |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2013 02:08 PM |
| So even the Player:GetMouse() method won't work in a LocalScript? |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2013 02:09 PM |
The Player:GetMouse() method will ONLY work in a LocalScript.
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 09 Nov 2013 02:09 PM |
| only works in a local script |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2013 03:45 PM |
| Oh man, so both tool.Equipped:connect(function(mouse) mouse.Button1Down AND player:GetMouse() only wwork in a LocalScript? DOH! |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 09 Nov 2013 03:49 PM |
| Because mouse is client sided, you could use .Equipped in a server side script but have fun using the mouse |
|
|
| Report Abuse |
|
|
XAXA
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 6315 |
|
|
| 09 Nov 2013 03:49 PM |
Vouching. Only works in a local script: http://wiki.roblox.com/index.php/RBX.lua.Mouse_(Object)
Don't be too rash to tell people to leave :c |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2013 04:25 PM |
Who told anyone to leave?
So neither work with a regular script? |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2013 07:51 PM |
We have answered this for you quite a few times. You can ONLY use the Mouse Object in a LocalScript. Stop asking.
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
|
| 11 Nov 2013 02:57 PM |
| Im asking if that is the case for both ways to get the mouse. I guess so :P. |
|
|
| Report Abuse |
|
|