|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 18 Mar 2009 |
| Total Posts: 1794 |
|
| |
|
|
| 30 Mar 2015 02:50 PM |
| so the Key is the Else statement then. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|