werts150
|
  |
| Joined: 11 Nov 2012 |
| Total Posts: 1450 |
|
|
| 13 Mar 2013 06:12 PM |
I have a button GUI and a leaf GUI. I want to make it so that when you hit the button, the leaf GUI shows up. But if you do not hit the button then the leaf doesn't appear.
I have this script in the button:
script.Parent.MouseButton1Down:connect(function() _G.boughtFan = true script.Parent.Visible = false end)
I also have this script in the exit shop GUI:
if (_G.boughtFan == true) then script.Parent.Parent.Parent.FanLeaf.Visible = true else if (_G.boughtFan == false) then script.Parent.Parent.Parent.FanLeaf.Visible = false end end
When I run the game, the leaf is invisible. Then when I click the button and exit the shop GUI, the leaf is still invisible. How do I make it appear when I hit the button? |
|
|
| Report Abuse |
|
|
|
| 13 Mar 2013 06:20 PM |
Is that the whole script of the GUI? If not, you would do something like:
script.Parent.MouseButton1Down:connect(function( ) if (_G.boughtFan ) then script.Parent.Parent.Parent.FanLeaf.Visible = true elseif (not _G.boughtFan ) then script.Parent.Parent.Parent.FanLeaf.Visible = false end end )
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 13 Mar 2013 06:21 PM |
Or perhaps just:
script.Parent.MouseButton1Down:connect(function( ) script.Parent.Parent.Parent.FanLeaf.Visible = _G.boughtFan end )
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
werts150
|
  |
| Joined: 11 Nov 2012 |
| Total Posts: 1450 |
|
|
| 13 Mar 2013 06:22 PM |
Oh, sorry. I just put in part of it, since the script as more things that have nothing to do with the leaf. But if I were to take out the extra things, it would look like this:
function OnClicked() if (_G.boughtFan == true) then script.Parent.Parent.Parent.FanLeaf.Visible = true else if (_G.boughtFan == false) then script.Parent.Parent.Parent.FanLeaf.Visible = false end end end
script.Parent.MouseButton1Down:connect(OnClicked) |
|
|
| Report Abuse |
|
|
|
| 13 Mar 2013 06:33 PM |
Try:
script.Parent.MouseButton1Down:connect(function() _G.boughtFan = not _G.boughtFan script.Parent.Visible = not script.Parent.Visible end)
¤ ¤ † K M <( •д• )> X D † ¤ ¤
|
|
|
| Report Abuse |
|
|
werts150
|
  |
| Joined: 11 Nov 2012 |
| Total Posts: 1450 |
|
|
| 13 Mar 2013 06:42 PM |
| I replaced that with the shop button code, but it still doesn't show up. But wouldn't that make it false? |
|
|
| Report Abuse |
|
|
|
| 13 Mar 2013 06:45 PM |
It would make it true, then false, then true, etc. Sorry, but can you explain a bit more about what you want, there seems to be multiple scripts.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
werts150
|
  |
| Joined: 11 Nov 2012 |
| Total Posts: 1450 |
|
|
| 13 Mar 2013 06:50 PM |
| Well I only have 2 scripts that relate to the leaf. One is in the shop button, where you actually buy the leaf. The other is in the exit button, where when you click Exit, its supposed to make the leaf visible. |
|
|
| Report Abuse |
|
|
|
| 13 Mar 2013 06:52 PM |
Ah, I see. Though it should work, are they both scripts/localscripts, and any output?
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
werts150
|
  |
| Joined: 11 Nov 2012 |
| Total Posts: 1450 |
|
|
| 13 Mar 2013 07:02 PM |
| No output, and they are both normal scripts. Not local. |
|
|
| Report Abuse |
|
|
werts150
|
  |
| Joined: 11 Nov 2012 |
| Total Posts: 1450 |
|
|
| 13 Mar 2013 07:22 PM |
| The weird thing is, is that I have a frog that you can purchase, and it is the exact same as the leaf, but with a different variable and image. The only difference is the leaf is draggable, and the frog is not. Could draggable change the visibility? |
|
|
| Report Abuse |
|
|
werts150
|
  |
| Joined: 11 Nov 2012 |
| Total Posts: 1450 |
|
|
| 13 Mar 2013 07:33 PM |
| Never mind, I fixed it. The issue was that the leaf was going underneath the background. It was there, just I couldn't see it. Thanks for your help ;) |
|
|
| Report Abuse |
|
|