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
 

Re: Buttons (GUI) switching visibility.

Previous Thread :: Next Thread 
Finloe is not online. Finloe
Joined: 28 Dec 2011
Total Posts: 67
02 Jan 2012 01:28 AM
Hey. Im trying to get two buttons (which already have scripts) to change whenever you click them. I want one to appear while the other one is not visible. So when i click the button labeled "AppearObby1" then that button disappears and the "RemoveObby1" appears. and then the opposite action is formed when the "RemoveObby1" button is clicked.


Here is the script so far for the "AppearObby1" button
___________________________________________
script.Parent.MouseButton1Down:connect(function()
model = game.Lighting.Obby1:clone()
model:clone().Parent = game.Workspace
end)
___________________________________________

And for "RemoveObby1" button
___________________________________________
script.Parent.MouseButton1Down:connect(function()
model = game.Lighting.Obby1:clone()
game.Workspace.Obby1:Destroy()
end)
___________________________________________

Can i put this ability inside this script or would i have to make another script for each button?
Report Abuse
1RATMLabs is not online. 1RATMLabs
Joined: 15 Jun 2009
Total Posts: 268
02 Jan 2012 03:03 AM
Appear obby 1
script.Parent.MouseButton1Down:connect(function()
model = game.Lighting.Obby1:clone()
model.Parent = game.Workspace
end)
--model:clone().Parent isn't needed

Remove obby 1
script.Parent.MouseButton1Down:connect(function()
game.Workspace.Obby1:Remove()
end)
--To remove something, you use Remove(), not Destroy()
Report Abuse
Finloe is not online. Finloe
Joined: 28 Dec 2011
Total Posts: 67
02 Jan 2012 03:05 AM
Those scripts work just fine. I need the buttons to change. Destroy is the process i want. I works fine.
Report Abuse
Wordsarecool is not online. Wordsarecool
Joined: 20 Sep 2008
Total Posts: 4273
02 Jan 2012 03:07 AM
Destroy deletes all data of the object.


Use remove.
Report Abuse
Finloe is not online. Finloe
Joined: 28 Dec 2011
Total Posts: 67
02 Jan 2012 03:09 AM
Well remove will take away the copy of the model. In this script it doesnt necessarily matter. However my problem is that if you click the "AppearObby1" button twice in a row then you can't get rid of the model from the workspace.
Report Abuse
1RATMLabs is not online. 1RATMLabs
Joined: 15 Jun 2009
Total Posts: 268
02 Jan 2012 03:17 AM
Isn't there an "Enable" bool value in a GUI?
Report Abuse
Finloe is not online. Finloe
Joined: 28 Dec 2011
Total Posts: 67
02 Jan 2012 03:21 AM
yes but im looking for it to go away because i want the two buttons to overlap.
Report Abuse
Finloe is not online. Finloe
Joined: 28 Dec 2011
Total Posts: 67
02 Jan 2012 03:29 AM
yes but im looking for it to go away because i want the two buttons to overlap.
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
02 Jan 2012 03:53 AM
@1RAT,
Im laughing to your comments on that script :P
Why can't you use 'destroy()' to remove things?
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
02 Jan 2012 07:39 AM
:Remove()<---Use that.
Report Abuse
Finloe is not online. Finloe
Joined: 28 Dec 2011
Total Posts: 67
02 Jan 2012 12:24 PM
ok can some one tell me how to make the buttons visibility change now.
Report Abuse
Finloe is not online. Finloe
Joined: 28 Dec 2011
Total Posts: 67
02 Jan 2012 01:16 PM
Would i have to add another script?
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
02 Jan 2012 01:51 PM
Yes.

Make a GUI

Insert>Objects>Screen

Put a frame

Insert>Objects>Frame

Put a button (not inside fram)

Insert>Objects>TextButton

Put a script Inside button

Insert>Object>Script

Resize frame and textbutton then don't make frame visible. (Click frame then check it's property then uncheck the visibility)

After that put this code there.

script.Parent.MouseButton1Down:connect(function()
script.Parent.Frame.Visible = true--make frame visible
end)

PM me if you want to learn about GUIs
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