Colbie988
|
  |
| Joined: 03 Mar 2012 |
| Total Posts: 885 |
|
|
| 13 Dec 2012 09:36 PM |
| Does anyone know the script to make a GUI Button change it's text and it's function after it's been clicked? I wanna make an open/close button, that's the only thing I'm confused about. S.O.S HELP !!! |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2012 09:40 PM |
Use an if statement to find the button's current text. Then change the text after each click.
For hippies: http://www.roblox.com/Peace-Shirt-TRANSPARENT-item?id=99429853 |
|
|
| Report Abuse |
|
|
caw454
|
  |
| Joined: 14 Jul 2009 |
| Total Posts: 344 |
|
|
| 13 Dec 2012 09:42 PM |
Wait, so like, when you touch a door, the Gui pops up? And then you click 'open' and the door opens, and then you click 'close' and it closes? Or what?
~caw~ |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 02:42 AM |
I know what you mean. Very simple script to do this
num = 1 text = {"Open","Close"} gui = script.Parent.Parent.Frame -- thing you want to make visible/invisible
script.Parent.MouseButton1Click:connect(function() gui.Visible = not gui.Visible num = num + 1 if num > 2 then num = 1 end script.Parent.Text = text[num] end) |
|
|
| Report Abuse |
|
|
Colbie988
|
  |
| Joined: 03 Mar 2012 |
| Total Posts: 885 |
|
|
| 14 Dec 2012 04:16 AM |
| Oh thanks Jelly! This works perfectly! :D |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
| |
|
|
| 14 Dec 2012 07:34 AM |
Jelly, a little inefficient, but nice.
For hippies: http://www.roblox.com/Peace-Shirt-TRANSPARENT-item?id=99429853 |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 08:01 AM |
| I wrote that last night (british) and I was tired so efficiency wasn't my top priority :P |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2012 08:32 AM |
Ceaseless, don't post that siggy in Scripters. Sorcus doesn't like that.
- thedestroyer115 |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2012 04:51 PM |
XD, nah, Sorcus doesn't mind, :3.
For hippies: http://www.roblox.com/Peace-Shirt-TRANSPARENT-item?id=99429853 |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2012 04:53 PM |
Well, Jelly, if you wanted to make a little bit more efficient:
script.Parent.MouseButton1Down:connect(function() -- don't mind the down... if gui.Visible == false then gui.Visible = true gui.Text = "Close" else gui.Visible = false gui.Text = "Open" end end)
For hippies: http://www.roblox.com/Peace-Shirt-TRANSPARENT-item?id=99429853 |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 04:54 PM |
| ikr, just wanting to blow his mind :L |
|
|
| Report Abuse |
|
|
Colbie988
|
  |
| Joined: 03 Mar 2012 |
| Total Posts: 885 |
|
|
| 15 Dec 2012 06:08 PM |
| Lol btw thx for the scripts guys. |
|
|
| Report Abuse |
|
|