|
| 29 Sep 2012 10:06 PM |
| How do I use GetMouse with keydown? |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 10:45 PM |
| you didn't explain anything nobzr |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 10:46 PM |
| What? I am asking how to do it. |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:01 PM |
Does anyone know how?
I really need this. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 29 Sep 2012 11:02 PM |
-- local script local p = Game.Players.LocalPlayer local mouse = p:GetMouse()
mouse.KeyDown:connect(function(k) -- Code end) |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:02 PM |
| So is the letter "k", the key that it is detecting? |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 29 Sep 2012 11:04 PM |
ITS THE SAME MOUSE AS BEFORE THAT YOU WOULD GET FROM TOOLS AND HOPPERBINS. THE SAMMMMMEEEEEE MOUSSSSEEEEE.
There needs to be a sticky about this... Because I thought it was obvious. But no one else does. You use the same events and properties that you did with the old mouse. The only change is that you can access it from any local location... |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:05 PM |
| Well, I never used the old mouse, so I would not know that. |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 29 Sep 2012 11:06 PM |
http://wiki.roblox.com/index.php/Mouse
Enjoy. Google is a wonderful tool; use it first because it requires no extra human effort and is therefore the most efficient. |
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Sep 2012 11:08 PM |
local player = game.Players.LocalPlayer local mouse = player:GetMouse()
mouse.KeyDown:connect(function(key) if key:lower() == "k" then print(key) else print(key .. " is nil") end end) |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:09 PM |
| Thanks, for another way to do it! |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 29 Sep 2012 11:09 PM |
| I really wish people would stop preaching the if key:lower() == "?" then thing... It makes no sense to me... |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:13 PM |
| @aboy so basically if the key is upper caps or lower caps then print the key |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 29 Sep 2012 11:14 PM |
No your thing says:
if the key being pressed is the "k" key then print "k" otherwise print the key being pressed is nil
That makes 0 sense... |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:15 PM |
@unholysoda - What are you talking about? The only difference is that the argument's name is different.
@aboy - How doesn't it make sense? It's straight-forward. |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:16 PM |
@aboy5643 With your way, it will print the text, no matter what key is pressed. With his way, it only will print, if the key you want is pressed. |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:17 PM |
| Except that nil part that he used. |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:17 PM |
"ITS THE SAME MOUSE AS BEFORE THAT YOU WOULD GET FROM TOOLS AND HOPPERBINS. THE SAMMMMMEEEEEE MOUSSSSEEEEE." Actually, the game.Players.LocalPlayer:GetMouse() function returns a mouse which cannot have its icon set. Lame!
I had to still use the "Hey, select this tool!" method of getting the mouse in my current game! :P |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 29 Sep 2012 11:18 PM |
| Why would you need to check for the lowercase version of the key being pressed? All keys being pressed are lowercase by default T_T You don't need to check it to a lowercase version of the key being pressed... It's just a waste of a conditional and marginable speed.... |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:18 PM |
| Well for what I am trying to do, @thedeathmaster01 method worked, whole the other guys method did not. |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 29 Sep 2012 11:19 PM |
@blobbyblob
According to devs in scripters, that's an unintended bug. But otherwise it is the same mouse object... It's just some artifact stuff that was making the port not work correctly. |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:22 PM |
I have one more question.
How would I have something happen when they first press the button, and have something else happen, when they release the button? |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:22 PM |
| @aboy - Oh, I didn't know you were only referring to the lowercase part; I thought you were talking about the whole line. Anyway, I'm not sure if this is correct, and I can't test it now because I can't install ROBLOX on this laptop, but maybe the key is uppercase if you're holding the shift button. |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 29 Sep 2012 11:24 PM |
@unholysoda
mouse.KeyUp:connect(function(keyBeingPressed) --do stuff here end)
@Electric
It doesn't... Left shift = 0 and Right shift = /. They don't modify the keys and http://wiki.roblox.com/index.php/KeyDown_(Event) <---- that page proves my point... |
|
|
| Report Abuse |
|
|