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
 

Gui Hiding Script

Previous Thread :: Next Thread 
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
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
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
11 Jul 2012 01:17 PM
bumper...


Anyone know how to do this?
Report Abuse
adark is not online. 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
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
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
snowboarder199 is not online. snowboarder199
Joined: 15 Aug 2009
Total Posts: 2703
11 Jul 2012 01:22 PM
is it changed from MouseButton1Down to MouseButton1Click? or does it not matter?
Report Abuse
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
11 Jul 2012 01:24 PM
it doesn't matter, as long as everything works right in the end :)
Report Abuse
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
11 Jul 2012 01:29 PM
The boolvalue thing is very confusing, does anyone have any better ideas?
Report Abuse
adark is not online. 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
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
11 Jul 2012 01:34 PM
I will try it again...
Report Abuse
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
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 is not online. 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
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
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 is not online. 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
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
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
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
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
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
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 is not online. 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
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
11 Jul 2012 02:12 PM
I am not that advanced, i would need a guide on how to do that... :P
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
11 Jul 2012 02:14 PM
Is ShopFrame defined correctly?
Report Abuse
FearMeIAmLag is not online. FearMeIAmLag
Joined: 02 Jun 2012
Total Posts: 1748
11 Jul 2012 02:17 PM
I believe so. It worked on the other script, so it should be.
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
11 Jul 2012 02:24 PM
Well, mine should work fine so I don't know what to tell you.
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