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 Object in Global Scripts?

Previous Thread :: Next Thread 
Penjuin3 is not online. Penjuin3
Joined: 05 Sep 2009
Total Posts: 175
27 Jun 2013 11:29 AM
I was wondering if there was anyway to detect keystrokes in a mouse from a global script?

I'm trying to make a flying seat with controls, and I'm a bit stuck in terms of the actual controls.

This is all in an enclosed environment so I can't just put a localscript in the player/hopperbin, I have to use globals.
Report Abuse
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
27 Jun 2013 11:30 AM
Well, have a Script insert a LocalScript into the player when you sit down, and take it out when you stand.

The Unwise Wizard of Scripters has spoken.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
27 Jun 2013 11:32 AM
Or you could use ObjectValues.

game.Players.LocalPlayer.MouseObject.Value = game.Players.LocalPlayer:GetMouse()

now you can use it in serverside script :D
Report Abuse
Penjuin3 is not online. Penjuin3
Joined: 05 Sep 2009
Total Posts: 175
27 Jun 2013 11:33 AM
By enclosed environment I meant in a script builder.

This means I can't just create localscripts with the global script.
Report Abuse
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
27 Jun 2013 11:41 AM
Well, you'll have to use a Tool then.

The Unwise Wizard of Scripters has spoken.
Report Abuse
Penjuin3 is not online. Penjuin3
Joined: 05 Sep 2009
Total Posts: 175
27 Jun 2013 11:42 AM
Tools can't detect keystrokes though, can they? (?)
Report Abuse
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
27 Jun 2013 11:46 AM
Tools used to be one of the only things you could use to detect keystrokes.

The Equipped event will pass the Player's Mouse to the callback, and you can use it inside that scope.

Tool.Equipped:connect(function(mouse)

mouse.KeyDown:connect(function(key)
print(key)
end)

end)

The Unwise Wizard of Scripters has spoken.
Report Abuse
Penjuin3 is not online. Penjuin3
Joined: 05 Sep 2009
Total Posts: 175
27 Jun 2013 12:00 PM
That only works in local though, awsum.
Report Abuse
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
27 Jun 2013 12:07 PM
Huh? You sure? I haven't tested it, but that should be fine.

The Unwise Wizard of Scripters has spoken.
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