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
 

Key pressed function...

Previous Thread :: Next Thread 
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
25 May 2013 11:11 AM
Where is the wiki for this...

I want to make it... so if you press space bar... you go upwards gradually... but if its not held you go down... im not sure how i would do this...

Is this possible? im making an underwater diving type game :3
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
25 May 2013 11:12 AM
.KeyDown

Life is an endless nightmare
Report Abuse
velibor is not online. velibor
Joined: 24 Nov 2009
Total Posts: 1003
25 May 2013 11:12 AM
http://wiki.roblox.com/index.php/KeyUp
http://wiki.roblox.com/index.php/KeyDown
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
25 May 2013 11:14 AM
Is it possible to do without the script being in a tool?
Like in a local gui in the player, and if they player presses it?
Report Abuse
velibor is not online. velibor
Joined: 24 Nov 2009
Total Posts: 1003
25 May 2013 11:15 AM
http://wiki.roblox.com/index.php/RBX.lua.PlayerMouse_(Object)
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
25 May 2013 11:16 AM
THANKYOU :D
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
25 May 2013 11:21 AM
game.Players.LocalPlayer:GetMouse().Button2Down:connect(function()
print("Button2 down!")
end)

How do i change this... so its a key like pressing b...?
Report Abuse
velibor is not online. velibor
Joined: 24 Nov 2009
Total Posts: 1003
25 May 2013 11:31 AM
Mouse = Game.Players.LocalPlayer:GetMouse()

lastkey = nil
Mouse.KeyDown:connect(function(key)
if key:lower() == "b" then
-- Your Action
Mouse.KeyUp:connect(function(upkey)
if upkey == lastkey then
-- Your action
end
end)
end
end)
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
25 May 2013 11:38 AM
Thanks :D
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
25 May 2013 11:44 AM
Has what i basically needed...
Thankies dude :3

I now can make a game... where pressing up will make the charecter float up... and letting go will slowly put him down :3
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