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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 02 Jan 2012 03:07 AM |
Destroy deletes all data of the object.
Use remove. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
| |
|
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
|
  |
| Joined: 28 Dec 2011 |
| Total Posts: 67 |
|
|
| 02 Jan 2012 01:16 PM |
| Would i have to add another script? |
|
|
| Report Abuse |
|
|
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 |
|
|