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: KeyDown question

Previous Thread :: Next Thread 
PerpetualMovement is not online. PerpetualMovement
Joined: 04 Dec 2012
Total Posts: 1001
21 Jun 2013 08:43 PM
Is it possible to check if the player pressed any key instead of manually typing every letter?
Report Abuse
yomamadude6 is not online. yomamadude6
Joined: 21 Nov 2009
Total Posts: 2151
21 Jun 2013 08:44 PM
mouse.KeyDown:connect(function(key)
if key = "r" then
--oasdijfioasdjfiosajfd
end
end)
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
21 Jun 2013 08:45 PM
KeyDown event fires whenever a key is pressed.

function kd(key)
print(key)
end

game.Players.LocalPlayer:GetMouse.KeyDown:connect(kd)

donut first, answer later
Report Abuse
PerpetualMovement is not online. PerpetualMovement
Joined: 04 Dec 2012
Total Posts: 1001
21 Jun 2013 08:45 PM
That's not what I meant. Like if he pressed ANY key? Not one certain key.
Report Abuse
yomamadude6 is not online. yomamadude6
Joined: 21 Nov 2009
Total Posts: 2151
21 Jun 2013 08:45 PM
mouse.KeyDown:connect(function(key)
--oasdijfioasdjfiosajfd
end)
Report Abuse
PerpetualMovement is not online. PerpetualMovement
Joined: 04 Dec 2012
Total Posts: 1001
21 Jun 2013 08:45 PM
Thanks evolved.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
21 Jun 2013 08:46 PM
@yomama - You didn't answer his question OR provide a functional script.

mouse.KeyDown:connect(function(key)
                  --code here
end)

The KeyDown event already fires when any key is pressed, so if you simply omit the if statement you normally use, you'll have what you want.

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
21 Jun 2013 08:47 PM
Well, most keys at least.

http://wiki.roblox.com/index.php/KeyDown

donut first, answer later
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
21 Jun 2013 08:47 PM
Wow, one heck of a latepost...

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
yomamadude6 is not online. yomamadude6
Joined: 21 Nov 2009
Total Posts: 2151
21 Jun 2013 08:47 PM
that's the exact code I posted. /facedesk
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
21 Jun 2013 08:48 PM
@yomama - I was referring to your first post.

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
yomamadude6 is not online. yomamadude6
Joined: 21 Nov 2009
Total Posts: 2151
21 Jun 2013 08:49 PM
Oh, I see, forgot a second =, sorry
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