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 » Scripters
Home Search
 

Re: Is this how to do Key press Local Script?

Previous Thread :: Next Thread 
dr_rai is not online. dr_rai
Joined: 26 Oct 2015
Total Posts: 69
04 Apr 2016 11:49 AM
script.KeyDown:connect(function(key)

if key == "q" then
script.Parent.Parent.StarterGui.ToolsGui.Building.Visible = true
else
script.Parent.Parent.StarterGuo.ToolsGui.Building.Visible = false
end
end
dr_rai the docter
Report Abuse
dr_rai is not online. dr_rai
Joined: 26 Oct 2015
Total Posts: 69
04 Apr 2016 11:50 AM
Plus, this local script is NOT inside a tool but inside the StarterPack.
dr_rai the docter
Report Abuse
dr_rai is not online. dr_rai
Joined: 26 Oct 2015
Total Posts: 69
04 Apr 2016 11:51 AM
Hope there is any answer.
Report Abuse
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
04 Apr 2016 11:52 AM

script.KeyDown:connect(function(key)

if key == "q" then
script.Parent.Parent.StarterGui.ToolsGui.Building.Visible = true
else
script.Parent.Parent.StarterGuo.ToolsGui.Building.Visible = false
end
end)

dr_rai the docter
Report Abuse
dr_rai is not online. dr_rai
Joined: 26 Oct 2015
Total Posts: 69
04 Apr 2016 11:55 AM
Thanks.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
04 Apr 2016 12:21 PM
@dire your method is deprecated.

@OP Use UIS


Report Abuse
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
04 Apr 2016 12:51 PM
Still works though
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
04 Apr 2016 12:52 PM
Its not about "if it works"

Its about the correct way to do it.


Report Abuse
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
04 Apr 2016 01:03 PM
No, it's not about the correct way to do it. It's about getting stuff to work. If it's stupid and it works then it ain't stupid. Also, if OP were to use UserInputService, they'd just spend a bunch of time learning something new, instead of getting their thing to work. There's a time for getting things to work and a time for being a perfectionist.
Report Abuse
sharpchain1 is not online. sharpchain1
Joined: 05 Aug 2013
Total Posts: 1009
04 Apr 2016 01:23 PM
Deprecated use User Input Service I didnt want to use uis at first either because when i was learning to script i was taught the keyDown method(uis wasnt there yet) but once i switched to uis i realized that it is much more efficient and you can detect keypresses of way more keys with much less effort


~sharpchain1 Leader of Domini Studios
Report Abuse
sharpchain1 is not online. sharpchain1
Joined: 05 Aug 2013
Total Posts: 1009
04 Apr 2016 01:24 PM
o and @dire we will see what works when roblox finaly removes KeyDown()


~sharpchain1 Leader of Domini Studios
Report Abuse
dr_rai is not online. dr_rai
Joined: 26 Oct 2015
Total Posts: 69
04 Apr 2016 01:46 PM
How the hell did we end up from Key Press scripts into this.
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
04 Apr 2016 01:48 PM
UserInputService isn't better. It's more object oriented, which Roblox likes to follow, but in real application, its a bunch of bleh because at the end of the line, you have all this code that is put into more and more functions and more and more functions that it gets down to being called by one function.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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