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
 

Keydown Event with ArrowKeys help

Previous Thread :: Next Thread 
Moolah60 is not online. Moolah60
Joined: 26 Sep 2009
Total Posts: 654
18 Nov 2012 03:38 PM
Alright so I know the Byte Codes for the arrow Keys (17 = up) (18 = down) but when I use them in a Hopper Bin or with the :GetMouse() function they do not work, even when I test with print(). Is it because Roblox is overriding it since they control camera and player movement or is it something I'm doing wrong?

Example Script:

tool = script.Parent

function printKey(key)
if key == string.byte(17) then print("Up was pressed!")
end

function selected(mouse)
mouse.KeyDown:connect(printKey)
end

tool.Selected:connect(selected)
Report Abuse
ferm is not online. ferm
Joined: 24 Feb 2009
Total Posts: 22
18 Nov 2012 03:40 PM
tool = script.Parent

function printKey(key)
key = string.byte(key)
if key == 17 then print("Up was pressed!")
end

function selected(mouse)
mouse.KeyDown:connect(printKey)
end

tool.Selected:connect(selected)
Report Abuse
Moolah60 is not online. Moolah60
Joined: 26 Sep 2009
Total Posts: 654
18 Nov 2012 03:41 PM
Oh I see I'll try that then
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
18 Nov 2012 04:25 PM
tool = script.Parent

function printKey(key)
key = string.byte(key)
if key == 17 then print("Up was pressed!") end
end

function selected(mouse)
mouse.KeyDown:connect(printKey)
end

tool.Selected:connect(selected)



---------------

Ya'll forgot an '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