generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Game Design
Home Search
 

Re: Multiple keys pressed

Previous Thread :: Next Thread 
trytry1 is not online. 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
SheikhGoat is not online. SheikhGoat
Joined: 17 Mar 2011
Total Posts: 1992
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 is not online. 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 is not online. 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
SheikhGoat is not online. SheikhGoat
Joined: 17 Mar 2011
Total Posts: 1992
10 Nov 2016 06:09 PM
Oh Sorry, change io to InputObject
Report Abuse
trytry1 is not online. trytry1
Joined: 18 Dec 2010
Total Posts: 129
10 Nov 2016 06:11 PM
Ok, Thanks! i will try that now
Report Abuse
trytry1 is not online. 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
SheikhGoat is not online. SheikhGoat
Joined: 17 Mar 2011
Total Posts: 1992
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 is not online. trytry1
Joined: 18 Dec 2010
Total Posts: 129
10 Nov 2016 06:15 PM
Oh, lol thanks!
Report Abuse
SheikhGoat is not online. SheikhGoat
Joined: 17 Mar 2011
Total Posts: 1992
10 Nov 2016 06:17 PM
No problem!
Report Abuse
trytry1 is not online. 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
SheikhGoat is not online. SheikhGoat
Joined: 17 Mar 2011
Total Posts: 1992
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 is not online. 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
cooldudett1234567890 is not online. cooldudett1234567890
Joined: 25 Apr 2012
Total Posts: 672
10 Nov 2016 06:50 PM
dont remove the parenthisis just change OtherKey to the name of the key you want
Report Abuse
cooldudett1234567890 is not online. cooldudett1234567890
Joined: 25 Apr 2012
Total Posts: 672
10 Nov 2016 06:52 PM
(Enum.KeyCode.OtherKey) --change OtherKey with whatever key name you want thats all
Report Abuse
trytry1 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image