|
| 11 Jul 2012 01:04 PM |
I have a button that when clicked hides the Gui that it is part of. I was wondering if someone could help me by editing the script, so that after clicking the button, the script won't show when you respawn after death. Here is the script...
ShopFrame = script.Parent.Parent.Parent.Frame
function onClick() if ShopFrame.Visible == true then ShopFrame.Visible = false else ShopFrame.Visible = true end end
script.Parent.MouseButton1Click:connect(onClick)
Anybody can help, I will be grateful for any help. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 01:17 PM |
bumper...
Anyone know how to do this? |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 11 Jul 2012 01:19 PM |
| Add a BoolValue inside the Player when they join, and toggle it on when the button is clicked. Then, when the Player's Character respawns, check the value. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 01:22 PM |
| Im not great at scripting, but I can find out how to do this easily. Thanks, i will try this... |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 01:22 PM |
| is it changed from MouseButton1Down to MouseButton1Click? or does it not matter? |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 01:24 PM |
| it doesn't matter, as long as everything works right in the end :) |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 01:29 PM |
| The boolvalue thing is very confusing, does anyone have any better ideas? |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 11 Jul 2012 01:32 PM |
How is it confusing? You have a function that fires when a Player joins, which creates the value. When that Player's Character is added, you have another function that checks if that value is true, and if it is hide the GUI.
It's that simple. |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Jul 2012 01:40 PM |
Inserted BoolValue into 'Players'
Don't understand how to toggle it on when button is clicked...
I am not good at some of this stuff, can you go step by step on what to do? Thanks :) |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 11 Jul 2012 01:42 PM |
To toggle it, just do
BoolValue.Value = not BoolValue.Value
A Boolean value is either true or false, and to access a ValueObject's stored value, you use '.Value' |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 01:48 PM |
Got it, thanks. I need to have it so that once the button is clicked by the player, they won't see it again in the game.
So far i have...
Players Value Script(BoolValue.Value = not BoolValue.Value)
How do i make it work from here?
|
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 11 Jul 2012 01:50 PM |
When the button is clicked, toggle the BoolValue's value. Use the CharacterAdded event, and if the BoolValue's value is true when it is fired, hide the GUI. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 01:52 PM |
| nevermind, this is too complicated, taking too long. Also, you aren't telling me what i want to know, i will find out from someone else, or from youtube, google, etc. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 01:55 PM |
ShopFrame = script.Parent.Parent.Parent.Frame Button = script.Parent
Button.MouseButton1Click:connect(function() ShopFrame.Visible = not ShopFrame.Visible end)
|
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 02:09 PM |
| Script doesn't do anything. The Gui still shows when respawning after a death... thanks for your help though. |
|
|
| Report Abuse |
|
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
|
| 11 Jul 2012 02:10 PM |
| Why not just make it a .PlayerAdded Event that only shows it when you first enter and then if you ever want to bring it back you just clone it from lighting. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 02:12 PM |
| I am not that advanced, i would need a guide on how to do that... :P |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 02:14 PM |
| Is ShopFrame defined correctly? |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 02:17 PM |
| I believe so. It worked on the other script, so it should be. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 02:24 PM |
| Well, mine should work fine so I don't know what to tell you. |
|
|
| Report Abuse |
|
|