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: Double Use of Key Stroke

Previous Thread :: Next Thread 
RufusTulliusAurelius is not online. RufusTulliusAurelius
Joined: 25 Apr 2008
Total Posts: 438
30 Mar 2015 02:43 PM
So, I am scripting something that lets say, I want to open an inventory backpack up by pressing I, now what if I wanted to close that Inventory Backpack, Using I? Currently I can only Script this correctly by Using Opening the Inventory with I and Closing it with C, but I want to be able to Open and Close it with I.
Report Abuse
lokkut is not online. lokkut
Joined: 18 Mar 2009
Total Posts: 1794
30 Mar 2015 02:45 PM
local open = false

Mouse.KeyDown:connect(function(k)
if k == "i" then
if open == true then
--close
else
-- open
end
end
end)
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
30 Mar 2015 02:47 PM
local open = false
Mouse.KeyDown:connect(function(k)
if k == "i" then
if open == true then
open = false
else
open = true
end
end
end)
Report Abuse
lokkut is not online. lokkut
Joined: 18 Mar 2009
Total Posts: 1794
30 Mar 2015 02:49 PM
oops thanks
Report Abuse
RufusTulliusAurelius is not online. RufusTulliusAurelius
Joined: 25 Apr 2008
Total Posts: 438
30 Mar 2015 02:50 PM
so the Key is the Else statement then.
Report Abuse
lokkut is not online. lokkut
Joined: 18 Mar 2009
Total Posts: 1794
30 Mar 2015 02:51 PM
mhm

i'd be a scrub and set it something cool like tab tho

but thats just me
Report Abuse
RufusTulliusAurelius is not online. RufusTulliusAurelius
Joined: 25 Apr 2008
Total Posts: 438
30 Mar 2015 02:56 PM
Does the else statement undo a weld? or is that bit more complicated, like lets say I saluted when I pressed Q if I wanted to unsalute is at as simple as an else statement or do I need to remove the welds?
Report Abuse
lokkut is not online. lokkut
Joined: 18 Mar 2009
Total Posts: 1794
30 Mar 2015 02:57 PM
you need to remove it manually
else is basically saying

if blah == true then
-- hi
else -- happens when the if statement isn't fullfilled
-- bye
end
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
30 Mar 2015 03:00 PM
Let me just review this

"I am scripting something"
"So the key is the else statement then"

Excuse me, could you kindly spell the language you're doing this in for me?
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
30 Mar 2015 03:02 PM
If you have one frame / gui object that contains everything else:

Mouse.KeyDown:connect(function(Key)
if Key and Key:lower() == "i" then
-- Window is the gui that contains everything else
Window.Visible = not Window.Visible
end
end)

~The herp lerped a derp~
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