|
| 10 Nov 2012 07:56 AM |
Is there a way to check through a local script as in what key on your keyboard you press? I know you can do it with a hopperbin, but I'm trying to get it through a local script. Thanks. |
|
|
| Report Abuse |
|
|
Memris
|
  |
| Joined: 14 Jun 2012 |
| Total Posts: 160 |
|
|
| 10 Nov 2012 08:02 AM |
As of now i don't think they have any way of tracing what buttons are pressed with just a local script and doing nothing special. I know they have GetMouse(), but that's irrelevant..
Sorry, but from my knowledge, the answer is no. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2012 08:07 AM |
Ok thanks for your help!
I'm looking to use this in a gui, because basically when u press a certain key a bunch of options will pop up on your screen. I was wondering if u could do this without having to click a gui, because in a highly intensive game it will waste time, and with a hopperbin, well this game invovles tools. |
|
|
| Report Abuse |
|
|
Memris
|
  |
| Joined: 14 Jun 2012 |
| Total Posts: 160 |
|
|
| 10 Nov 2012 08:10 AM |
Here's the problem with using a tool in this way.
When you select the tool, it grabs your mouse and whatever, then disappears. You still have it "Equipped", BUT when you equip or select a hopperbin or another tool, the tool will be unselected. So the only way it works is if you have no other tools in the game. |
|
|
| Report Abuse |
|
|
Memris
|
  |
| Joined: 14 Jun 2012 |
| Total Posts: 160 |
|
|
| 10 Nov 2012 08:11 AM |
| Actually I just totally misread that, you probably already know this. Sorry, I'm pretty tired. Lol. |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 10 Nov 2012 08:24 AM |
| You can easily use hopperbin, just you won't be able to detect pressed keys while you don't have it equipped, and if you set it to nil, make sure you don't have other tools, since you can loose main tool. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2012 08:27 AM |
| I understand that, but I have other tools in the game, and so I can't have hopperbin selected, or else pretty much you would die, because it will be a fast and intense game. |
|
|
| Report Abuse |
|
|
sharps222
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 117 |
|
|
| 10 Nov 2012 08:29 AM |
Lol guys, the first answer was SO close! You can use
mouse=player:GetMouse() mouse.KeyPressed:connect(function() **then your key function here** end)
|
|
|
| Report Abuse |
|
|
Memris
|
  |
| Joined: 14 Jun 2012 |
| Total Posts: 160 |
|
|
| 10 Nov 2012 08:29 AM |
| Are you serious? Wow, maybe I should have looked into that more.. |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 10 Nov 2012 08:30 AM |
| @sharps. Didn't know they released that already. But meh, I don't care about game making on roblox these days. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2012 08:30 AM |
@above
So that would work in a local script, correct?
I think I may have to check the object browser :3 |
|
|
| Report Abuse |
|
|
Memris
|
  |
| Joined: 14 Jun 2012 |
| Total Posts: 160 |
|
|
| 10 Nov 2012 08:31 AM |
| I think it would ONLY work in a Local script. |
|
|
| Report Abuse |
|
|
sharps222
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 117 |
|
|
| 10 Nov 2012 08:31 AM |
| Its just like a hopperbin, because you use hopperbin to get mouse object, but now you dont need to! Note:Using :GetMouse() does not allow you to change the players mouse icon. however, there is a way of dropping a physical tool onto the players head when you first enter the game and then removing it after you got the mouse. (Its what crazyman32 does) |
|
|
| Report Abuse |
|
|
sharps222
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 117 |
|
| |
|
|
| 10 Nov 2012 08:32 AM |
I meant @sharps, wow I had quick replies.
Oh and now I see all the things you can do with the mouse, but I'm just wondering if accessing the mouse will work fine. |
|
|
| Report Abuse |
|
|
sharps222
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 117 |
|
|
| 10 Nov 2012 08:32 AM |
I use this in my "Alamir : Game tool" place. |
|
|
| Report Abuse |
|
|
sharps222
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 117 |
|
|
| 10 Nov 2012 08:33 AM |
| It works, and its simple, thats the kind of answers I give :3 |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2012 08:34 AM |
| One last question, is the "player" the character in workspace or the actual player? |
|
|
| Report Abuse |
|
|
Memris
|
  |
| Joined: 14 Jun 2012 |
| Total Posts: 160 |
|
|
| 10 Nov 2012 08:35 AM |
The actual player.
You can use:
player = game.Players.LocalPlayer
Since it's in a LocalScript. |
|
|
| Report Abuse |
|
|
sharps222
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 117 |
|
|
| 10 Nov 2012 08:36 AM |
| The actual player. The character has very little things you can do with him, the only function runable on your character is player=GetPlayerFromCharacter(game.Workspace.sharps222) |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2012 08:36 AM |
| Yup, got it. Thanks to all of you :D |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 10 Nov 2012 08:37 AM |
| @Memris. But you must remember that local scripts runs only in player, or character. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2012 08:38 AM |
Wait one last question :3
At sharp's first script, he used the connection "Keypressed" or something like that. If I want it to only work for a specific key, would I put an if/else right after? |
|
|
| Report Abuse |
|
|
Memris
|
  |
| Joined: 14 Jun 2012 |
| Total Posts: 160 |
|
|
| 10 Nov 2012 08:38 AM |
| I don't think at any point that I said that they would run elsewhere, so I don't know why that was directed at me. But thanks. |
|
|
| Report Abuse |
|
|
Memris
|
  |
| Joined: 14 Jun 2012 |
| Total Posts: 160 |
|
|
| 10 Nov 2012 08:39 AM |
Its actually:
local player = game.Players.LocalPlayer local m = player:GetMouse()
m.KeyDown:connect(function(k)
if k == "z" then
print("You pressed z!")
end
end)
|
|
|
| Report Abuse |
|
|