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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 05 Sep 2009 |
| Total Posts: 175 |
|
|
| 27 Jun 2013 11:42 AM |
| Tools can't detect keystrokes though, can they? (?) |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 05 Sep 2009 |
| Total Posts: 175 |
|
|
| 27 Jun 2013 12:00 PM |
| That only works in local though, awsum. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|