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 » Scripting Helpers
Home Search
 

Re: How can I detect if an arrow key as been pressed?

Previous Thread :: Next Thread 
ZDude2461 is not online. ZDude2461
Joined: 26 Apr 2009
Total Posts: 347
30 Dec 2012 07:09 AM
function onKeyDown(key)
key = key:lower()
if key == "Arrow key?" then
/
/
/

Anyway, how can I get this code to detect with it's an arrow key that's been pressed? More specifically the up arrow.
Report Abuse
mertes is not online. mertes
Joined: 30 Apr 2010
Total Posts: 1253
30 Dec 2012 07:15 AM
I'm not a pro on scripting, but I think it is "ArrowKey=Up" and onward, anyway you can't type it, but yes, I think it's something like I did, not sure, since I just started scripting 1 week ago.
Report Abuse
crazyman32 is online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
30 Dec 2012 07:23 AM
You will need to use its byte code.

if (key:byte() == 17) then
...
end

UP = 17
DOWN = 18
RIGHT = 19
LEFT = 20
Report Abuse
ZDude2461 is not online. ZDude2461
Joined: 26 Apr 2009
Total Posts: 347
30 Dec 2012 07:27 AM
Thanks. :D
Report Abuse
crazyman32 is online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
30 Dec 2012 07:55 AM
To check for byte codes, just change your code to something like this:

MOUSE.KeyDown:connect(function(key)
print(key .. " bytecode = " .. key:byte())
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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