maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 11 Feb 2014 08:19 PM |
mouse = game.Players.LocalPlayer:GetMouse () mouse.KeyDown:connect(function(key) if key == 48 then -- code end end) It's basically detecting if you hit Shift, but it doesn't seem to trigger the code inside. Is there anything obviously wrong with this code? |
|
|
| Report Abuse |
|
|
jonesj627
|
  |
| Joined: 06 Oct 2010 |
| Total Posts: 1496 |
|
|
| 11 Feb 2014 08:24 PM |
mouse = game.Players.LocalPlayer:GetMouse () mouse.KeyDown:connect(function(key) if (key.byte) == 48 then -- code end end)
i think i fixed it but i'm unsure |
|
|
| Report Abuse |
|
|
|
| 11 Feb 2014 08:24 PM |
Key is the string "key" that was pressed. It looks like you're trying to check the key from its byte code. To do that, just use this:
if key:byte() == 48 then -- code end
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
| |
|
|
| 11 Feb 2014 08:39 PM |
| Isn't that the Shift key? Also where did you find this? |
|
|
| Report Abuse |
|
|
|
| 11 Feb 2014 08:44 PM |
@ZirutoHellfire Yes, that is the shift key. That's what he intended it to be too, if I read his post correctly. I would also assume that he wrote this script himself, he did not get it anywhere.
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 03:14 AM |
| Also shouldn't it be a Local Script? |
|
|
| Report Abuse |
|
|
GOLDC3PO
|
  |
| Joined: 31 May 2011 |
| Total Posts: 509 |
|
|
| 12 Feb 2014 07:33 AM |
here you go: repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Torso") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid") local mouse = game.Players.LocalPlayer:GetMouse() repeat wait() until mouse mouse.KeyDown:connect(function(key) if string.byte(key) == 48 then --Do whatever here! end end) mouse.KeyUp:connect(function(key) if string.byte(key) == 48 then --Key up so :) end end) |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 08:48 AM |
Why on earth did you wait for their character, head, and torso before starting the rest of the script??
Also, when you use a function and it returns nil, that nil won't magically turn into something else if you wait a bit (I am referring to your use of mouse = blahblahblah, repeat wait() until mouse). You need to keep on checking, or in other words you need to keep on re-calling that function. |
|
|
| Report Abuse |
|
|