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: Key Pressing

Previous Thread :: Next Thread 
xKinqMill is not online. xKinqMill
Joined: 26 Jun 2014
Total Posts: 545
05 Oct 2015 03:11 PM
When i make an input event script, the function fires when you are typing.

Say you have this script:

local uis=game:GetService("UserInputService")

uis.InputBegan:connect(function(i)
if i.KeyCode==Enum.KeyCode.R then
-- reset player
end
end)

If i was chatting something and i said "r" the player would reset. I don't want it to fire when you are chatting. How do i get it not to fire when chatting?
Report Abuse
DogBone343 is not online. DogBone343
Joined: 09 Jan 2014
Total Posts: 6855
05 Oct 2015 03:14 PM
Use :GetMouse() and KeyDown instead of user input service.
Report Abuse
xKinqMill is not online. xKinqMill
Joined: 26 Jun 2014
Total Posts: 545
05 Oct 2015 03:16 PM
KeyDown is depreciated. It no longer works.
Report Abuse
xKinqMill is not online. xKinqMill
Joined: 26 Jun 2014
Total Posts: 545
05 Oct 2015 03:18 PM
Is there another way to get a pressed key?
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
05 Oct 2015 03:19 PM
KeyDown works but it's bad. Don't listen to DogBone. Use the second argument of InputBegan, gameProcessedEvent. It checks if you're chatting or not.

uis.InputBegan:connect(function(i, gpe)
if not gpe then
if i.KeyCode==Enum.KeyCode.R then
-- reset player
end
end
end)
Report Abuse
helicopter35 is not online. helicopter35
Joined: 25 Oct 2010
Total Posts: 1225
05 Oct 2015 03:20 PM
@Dog

Just... no.
Report Abuse
xKinqMill is not online. xKinqMill
Joined: 26 Jun 2014
Total Posts: 545
05 Oct 2015 03:24 PM
@Recurring Thanks!
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
05 Oct 2015 03:29 PM
np. happy coding
Report Abuse
LotsOfViolence is not online. LotsOfViolence
Joined: 29 Jun 2011
Total Posts: 8375
05 Oct 2015 03:40 PM
Oh god just use KeyDown, it works 100% of the time for me, and it's so much easily understood better.

http://www.roblox.com/Coon-left-item?id=296811217 http://www.roblox.com/Coon-right-item?id=296811237
Report Abuse
xKinqMill is not online. xKinqMill
Joined: 26 Jun 2014
Total Posts: 545
05 Oct 2015 03:41 PM
Look up KeyDown on the wiki. Read the warning label.
Report Abuse
xKinqMill is not online. xKinqMill
Joined: 26 Jun 2014
Total Posts: 545
05 Oct 2015 03:42 PM
And i already said it doesn't work for me...
Report Abuse
LotsOfViolence is not online. LotsOfViolence
Joined: 29 Jun 2011
Total Posts: 8375
05 Oct 2015 03:44 PM
@king

"Look up KeyDown on the wiki. Read the warning label."

What of it? It works perfectly fine for me. There's nothing wrong with it.

lp=game.Players.LocalPlayer
repeat wait() until lp.Character
mouse=game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:connect(function(key)
if key=="r" then
lp.Character:BreakJoints()
end
end)


Put that in a local script, it works perfectly fine.


http://www.roblox.com/Coon-left-item?id=296811217 http://www.roblox.com/Coon-right-item?id=296811237
Report Abuse
xKinqMill is not online. xKinqMill
Joined: 26 Jun 2014
Total Posts: 545
05 Oct 2015 03:46 PM
^ What kind of computer do you have?
Report Abuse
xKinqMill is not online. xKinqMill
Joined: 26 Jun 2014
Total Posts: 545
05 Oct 2015 03:49 PM
^ Oh wow. It works. I tried it many times and it didn't work. I guess Roblox re-added it.
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
05 Oct 2015 03:51 PM
"Oh god just use KeyDown, it works 100% of the time for me, and it's so much easily understood better."

simpler? if you have any understanding of Events you should be able to get used to UIS easily. keydown is deprecated for a reason.

UIS > keydown

and if you want to go a step further

CAS (contextactionservice) > UIS for mobile support
Report Abuse
LotsOfViolence is not online. LotsOfViolence
Joined: 29 Jun 2011
Total Posts: 8375
05 Oct 2015 03:52 PM
mobile gaming is for 7 year olds anyways

http://www.roblox.com/Coon-left-item?id=296811217 http://www.roblox.com/Coon-right-item?id=296811237
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
05 Oct 2015 03:55 PM
ok then keep using keydown. again, its deprecated for a (multitude of) reasons
Report Abuse
LotsOfViolence is not online. LotsOfViolence
Joined: 29 Jun 2011
Total Posts: 8375
05 Oct 2015 03:56 PM
and what are the reasons? You're the type of person who thinks using :Remove() on one brick is going to destroy your entire game.


http://www.roblox.com/Coon-left-item?id=296811217 http://www.roblox.com/Coon-right-item?id=296811237
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
05 Oct 2015 04:02 PM
im the type of logical person who thinks Destroy() > remove() because destroy destroys a brick while remove parents it to nil. im also the kind of logical person who doesnt like to engage in *these* kind of arguments

http://www.roblox.com/Forum/ShowPost.aspx?PostID=175613503
Report Abuse
LotsOfViolence is not online. LotsOfViolence
Joined: 29 Jun 2011
Total Posts: 8375
05 Oct 2015 04:03 PM
I know :Destroy() is obviously more efficient, but i've seen a thread once where this new user needed help and his script had :Remove() and people lashed out on him calling him a scrub. I mean it was hilarious, but still.

http://www.roblox.com/Coon-left-item?id=296811217 http://www.roblox.com/Coon-right-item?id=296811237
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
05 Oct 2015 04:04 PM
@LOV they say "DO NOT USE FOR NEW WORK" for a reason

i.e. "we may remove this in the future but we're lazy right now"
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