trytry1
|
  |
| Joined: 18 Dec 2010 |
| Total Posts: 129 |
|
|
| 10 Nov 2016 05:58 PM |
| i have no clue how to make it check if multiple keys are pressed. what i mean is on Lumber Tycoon 2 where when you pick up a log you can press and hold shift while you press WASD to rotate it. does anyone know how to do this? |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 06:02 PM |
local UIS = game:GetService("UserInputService")
UIS.InputBegan:connect(function(InputObject) local Key = io.KeyCode.Name if Key == "LeftShift" then if UIS:IsKeyDown(Enum.KeyCode.LeftShift) and UIS:IsKeyDown(Enum.KeyCode.OtherKey) then print("Left Shift and otherKey were pressed") end end end)
You can find more information on the roblox wiki UserInputService page. |
|
|
| Report Abuse |
|
|
trytry1
|
  |
| Joined: 18 Dec 2010 |
| Total Posts: 129 |
|
|
| 10 Nov 2016 06:06 PM |
| Wow that was fast i will try that now |
|
|
| Report Abuse |
|
|
trytry1
|
  |
| Joined: 18 Dec 2010 |
| Total Posts: 129 |
|
|
| 10 Nov 2016 06:08 PM |
it says io is globally undefigned
"local Key = io.KeyCode.Name" |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 06:09 PM |
| Oh Sorry, change io to InputObject |
|
|
| Report Abuse |
|
|
trytry1
|
  |
| Joined: 18 Dec 2010 |
| Total Posts: 129 |
|
|
| 10 Nov 2016 06:11 PM |
| Ok, Thanks! i will try that now |
|
|
| Report Abuse |
|
|
trytry1
|
  |
| Joined: 18 Dec 2010 |
| Total Posts: 129 |
|
|
| 10 Nov 2016 06:13 PM |
Im sorry i am not that familliar with keys pressed i started today the error i got was:
OtherKey is not a valid EnumItem
I dont even okow what EnumItem is |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 06:15 PM |
OtherKey was just an example. Replace the word OtherKey with the name of the key you want.
Here's a list of all the anmes of the keys to help you out: http://wiki.roblox.com/?title=API:Enum/KeyCode |
|
|
| Report Abuse |
|
|
trytry1
|
  |
| Joined: 18 Dec 2010 |
| Total Posts: 129 |
|
| |
|
| |
|
trytry1
|
  |
| Joined: 18 Dec 2010 |
| Total Posts: 129 |
|
|
| 10 Nov 2016 06:20 PM |
For the Other key do i put quotes around the number or parentheses because when i put parenthesees i get this error:
Players.Player1.PlayerGui.Shift Rotate:6: attempt to call field 'KeyCode' (a userdata value)
Should this be in a local script, because right now it is...
|
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 06:26 PM |
No, just replace otherkey, dont change anything, you dont need parathenisis.
Yes, should be in a localscript |
|
|
| Report Abuse |
|
|
trytry1
|
  |
| Joined: 18 Dec 2010 |
| Total Posts: 129 |
|
|
| 10 Nov 2016 06:28 PM |
Whenever i have no parenthisis it has a red underline and it says this error:
Players.Player1.PlayerGui.Shift Rotate:6: ')' expected near '.119' |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 06:50 PM |
| dont remove the parenthisis just change OtherKey to the name of the key you want |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 06:52 PM |
| (Enum.KeyCode.OtherKey) --change OtherKey with whatever key name you want thats all |
|
|
| Report Abuse |
|
|
trytry1
|
  |
| Joined: 18 Dec 2010 |
| Total Posts: 129 |
|
|
| 10 Nov 2016 06:56 PM |
Thank both of you i got it to work
End Post. |
|
|
| Report Abuse |
|
|