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: mouse.Button1Down tool help?

Previous Thread :: Next Thread 
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
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
ToxicDominator is not online. ToxicDominator
Joined: 24 Oct 2013
Total Posts: 8373
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 is not online. 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
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
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 is not online. 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
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
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
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
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
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
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 is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
07 Nov 2013 03:22 PM
You could use Humanoid.Target or Humanoid.TargetPoint...
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
09 Nov 2013 02:08 PM
So even the Player:GetMouse() method won't work in a LocalScript?
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
09 Nov 2013 02:09 PM
only works in a local script
Report Abuse
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
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 is not online. 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 is not online. 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
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
09 Nov 2013 04:25 PM
Who told anyone to leave?

So neither work with a regular script?
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
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
superswordfish is not online. superswordfish
Joined: 14 Jun 2013
Total Posts: 1336
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
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