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: Using UserInputService instead of KeyDown?

Previous Thread :: Next Thread 
DeGames is online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
21 Nov 2015 09:39 AM
I've made tools that are run by keydown events. I heard they're deprecated, to clarify does this mean it would work for some people and not others because of their system?

I've been advised to use UserInputService, but I have no clue how that works.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
21 Nov 2015 09:41 AM
it means that you should not use it for new stuff and it remains for backwards compatibility

-Ok, 5am, it works. For real.
Report Abuse
Dogejia is not online. Dogejia
Joined: 08 Feb 2012
Total Posts: 1873
21 Nov 2015 09:41 AM
It would still work, its just old, they want everyone to use UIS, I think its better cuz it has more functions (e.g KeyDown vs UIS with their type of keydown and mobile keydown (so fingerdown))

http://wiki.roblox.com/index.php?title=UserInputService


Dogemon, gotta pet them all!
Report Abuse
DeGames is online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
21 Nov 2015 09:55 AM
for example the Keydown event is used asVV
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "e" then
game.workspace.Part.Anchored = false
end
end)

There's a function called "GetKeysPressed", I'm assuming i'd use that. How is this implemented?
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
21 Nov 2015 09:58 AM
uis.InputBegan:connect(function(input,b)
if b then return end
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.W then
--code
end
end
end)
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
21 Nov 2015 10:15 AM
game:GetService("UserInputService").InputBegan:connect(function(iO,gPE)
if not gPE then
if iO.KeyCode == Enum.KeyCode.E then
print'User pressed "e"'
end
end
end)

-- The "iO" is the "Input Object" and "gPE" is the "game Processed Event"

--If gPE is true, that means the player is typing (like on the chat, and you don't want to detect them pressing a key whilst they are typing).

--If gPE is fasle, then that means they just press is when not typing in some other game event.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
21 Nov 2015 10:38 AM
jesus christ use a better variable naming scheme

-bump to 0.0.3-dev:wq
Report Abuse
DeGames is online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
21 Nov 2015 11:32 AM
Thanks! Is game process event only referring to chat?
Report Abuse
MomentInTime is not online. MomentInTime
Joined: 16 Jul 2015
Total Posts: 6226
21 Nov 2015 12:06 PM
keydown is so much better to use
i hate using enums
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
21 Nov 2015 01:17 PM
@moment
thats why you suck at scripting

enumeration > strings
uis > keydown
Report Abuse
MomentInTime is not online. MomentInTime
Joined: 16 Jul 2015
Total Posts: 6226
21 Nov 2015 01:24 PM
I'm not bad at scripting by any means,
For anything that requires keydown, using uis is pointless, because mobile players can't keydown, and mousebutton1down covers them touching the screen
strings are better btw
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
21 Nov 2015 01:25 PM
you know nothing of scripting, and now scripters will flame you because your stupid
Report Abuse
MomentInTime is not online. MomentInTime
Joined: 16 Jul 2015
Total Posts: 6226
21 Nov 2015 01:31 PM
I know so much more than you in so many more languages
I have never encountered any problems doing what I do
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
21 Nov 2015 01:35 PM
you know little more than basic lua or you would know:

-enums are preferred of strings, it makes it easy to edit and readable, among other reasons
-UIS is better, KeyDown is the old depricated way that was very brittle and barely supports anything in comparison to UIS
-You just plain canno script better than me
Report Abuse
MomentInTime is not online. MomentInTime
Joined: 16 Jul 2015
Total Posts: 6226
21 Nov 2015 01:58 PM
I know Java, JavaScript, JQuery, a little AJAX, C++, and Lua
Keydown looks better and it has yet to fail me
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
21 Nov 2015 02:03 PM
alright kiddo, we believe you.

>implys that KeyDown wasnt a failure from the start.
Report Abuse
MomentInTime is not online. MomentInTime
Joined: 16 Jul 2015
Total Posts: 6226
21 Nov 2015 02:08 PM
I do know those languages, and keydown has yet to fail me. It is reliable and very useful.
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
21 Nov 2015 02:09 PM
>reliable and useful

rofl
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
21 Nov 2015 02:09 PM
both of you

stop

-final commit.
Report Abuse
MomentInTime is not online. MomentInTime
Joined: 16 Jul 2015
Total Posts: 6226
21 Nov 2015 02:11 PM
I'll stop after this comment so long as Zax stops

@Zax
Does it work when a key is pressed? Yes
Can it crash or be overloaded? No

Please explain how it is neither reliable or useful
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
21 Nov 2015 02:13 PM
not reliable because doesnt support gamepads and barely can support touchscreen, oh and, i can press keys on mobile. my phone is a slider and touchscreen.
not useful because we have UIS and CAS, the modern methods.

Also, you eanted me to stop posting so you could act as if I had no answer, when you very well know you asked a question.

Your argument is like saying dirt > food.
Report Abuse
MomentInTime is not online. MomentInTime
Joined: 16 Jul 2015
Total Posts: 6226
21 Nov 2015 02:16 PM
Why would keydown need to support gamepads if only computers can press keys? There are other functions that can be used to detect other events. KeyDown does its purpose just fine. UIS has extra processing because it covers everything.
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
21 Nov 2015 02:17 PM
Your stupid, we need to support gamepads so roblox can evolve.
Report Abuse
MomentInTime is not online. MomentInTime
Joined: 16 Jul 2015
Total Posts: 6226
21 Nov 2015 02:19 PM
No I'm not; you're stupid. GamePads are pointless; ROBLOX still derives 75%+ of its players from computers. And as I said before, there are other event listeners that can cover it without UIS getting in the way. KeyDown is better than UIS for detecting keys, and MouseButton1Down is better for detecting clicks.
Report Abuse
Dogejia is not online. Dogejia
Joined: 08 Feb 2012
Total Posts: 1873
21 Nov 2015 02:21 PM
UIS has keydown (its version), and you can make it so if you type like

ergdewrthealkdmn widrewqhwefgiwnghojeufginwdf

It wont crash, you just use debounce :)

Yet its hard to understand, so keydown is guud 2


Dogemon, gotta pet them all!
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