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: Is there anyway to use tab as a hotkey

Previous Thread :: Next Thread 
rny is not online. rny
Joined: 26 Jul 2009
Total Posts: 5079
04 Apr 2014 09:42 PM
?
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
04 Apr 2014 09:43 PM
key:byte() == 9
Report Abuse
powertool is not online. powertool
Joined: 01 Feb 2008
Total Posts: 3771
04 Apr 2014 09:43 PM
The ascii for the tab key is 9, or 0x9 if you're doing hex.
Report Abuse
rny is not online. rny
Joined: 26 Jul 2009
Total Posts: 5079
04 Apr 2014 09:45 PM
i mean on roblox
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
04 Apr 2014 09:50 PM
it is roblox

type keydown on wiki.roblox.com and follow the guide.
Report Abuse
rny is not online. rny
Joined: 26 Jul 2009
Total Posts: 5079
04 Apr 2014 09:51 PM
doesn't work with tab

local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:connect(function(test)
if test:byte() == 9 then
print('success')
game.Players.rny:Kick()
else
print('failure')
end
end)
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
04 Apr 2014 10:02 PM
Use the UserInputService and KeyCode. http://wiki.roblox.com/index.php?title=KeyCode_(Property)
Report Abuse
powertool is not online. powertool
Joined: 01 Feb 2008
Total Posts: 3771
04 Apr 2014 10:03 PM
"Note: Some keys can't be accessed with the KeyDown() method, however the KeyUp() method gets around that."
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
04 Apr 2014 10:14 PM
You should be using the new UserInputService anyways. There's no need for that KeyDown stuff.
Report Abuse
rny is not online. rny
Joined: 26 Jul 2009
Total Posts: 5079
04 Apr 2014 10:15 PM
give me a example with userinputservice
Report Abuse
robocu is not online. robocu
Joined: 18 Feb 2009
Total Posts: 210
04 Apr 2014 10:17 PM
yeah please do i'm intrigued
-=Robo=-
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
04 Apr 2014 10:22 PM
game:GetService("UserInputService").InputBegan:connect(function(input)
      if input.UserInputType==Enum.UserInputType.Keyboard and input.UserInputState==Enum.UserInputBegin and input.KeyCode==9 then --user pressed tab
            print("Tab was pressed.")
      end
end) --has to be in a LocalScript, untested
Report Abuse
rny is not online. rny
Joined: 26 Jul 2009
Total Posts: 5079
04 Apr 2014 10:24 PM
"UserInputBegin is not a valid EnumItem"
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
04 Apr 2014 10:26 PM
Typo'd. Enum.UserInputState.Begin. Don't know what I was thinking.
Report Abuse
rny is not online. rny
Joined: 26 Jul 2009
Total Posts: 5079
04 Apr 2014 10:27 PM
your code is messy imo
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
04 Apr 2014 10:28 PM
Dude, it's three equality checks, a connection, and a print. It's not messy.
Report Abuse
rny is not online. rny
Joined: 26 Jul 2009
Total Posts: 5079
04 Apr 2014 10:29 PM
btw it doesn't work
old school method > new school method
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
04 Apr 2014 10:30 PM
It doesn't work? Is it inside a LocalScript? Let me actually test this stuff.
Report Abuse
rny is not online. rny
Joined: 26 Jul 2009
Total Posts: 5079
04 Apr 2014 10:31 PM
just ran it @ my sb
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
04 Apr 2014 10:32 PM
It works, just not in Studio.
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
04 Apr 2014 10:33 PM
Oh, forgot to mention my change.
and input.KeyCode==Enum.KeyCode.Tab
Report Abuse
rny is not online. rny
Joined: 26 Jul 2009
Total Posts: 5079
04 Apr 2014 10:35 PM
It works, I'll mess around with it.
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
04 Apr 2014 10:37 PM
Be warned, it'll be activated while the user is chatting too.
Report Abuse
robocu is not online. robocu
Joined: 18 Feb 2009
Total Posts: 210
04 Apr 2014 10:43 PM
@The
that'd explain a lot of games that crouch when typing
that's really annoying lol
if there's anyway to prevent that, that'd be interesting, but i still prefer keydown(if possible)
-=Robo=-
Report Abuse
rny is not online. rny
Joined: 26 Jul 2009
Total Posts: 5079
04 Apr 2014 10:47 PM
Is there anyway to check if the player is typing?
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