Proxemics
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 2542 |
|
|
| 11 Apr 2015 08:41 AM |
So I'm making a command GUI that fires functions when a player presses a button. Try it out here:
http://www.roblox.com/games/193975441/Proxs-Command-GUI-testing
It's still a work in progress (and I started work on it a day ago), but it's improving every single day.
Anyways, what I need help with is the "Hide/Show" button that should hide/show the GUI when clicked. I wrote a script for this button as well, which doesn't work. The script is very messy. I made it in about 2-3 minutes, and didn't think about logic and events really well:
script.Parent.MouseButton1Down:connect(function() for i,v in pairs(script.Parent:GetChildren()) do if v.Name == "decrease_health" or v.Name == "help" or v.Name == "fire" or v.Name == "light" or v.Name == "increase_health" or v.Name == "kill" or v.Name == "leave" or v.Name == "remove_hats" or v.Name == "remove_left_arm" or v.Name == "remove_left_leg" or v.Name == "remove_right_arm" or v.Name == "remove_right_leg" or v.Name == "smoke" or v.Name == "explode" or v.Name == "sparkles" then if v.Visible == true then v.Visible = false script.Parent.Text = "Show" elseif v.Visible == false then v.Visible = true script.Parent.Text = "Hide" end end end end)
The script is in a LocalScript, which is in the TextButton. Could anyone help me with this? Thanks. |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 11 Apr 2015 08:46 AM |
stuff = {"decrease_health","help","fire","light","increase_health","kill","leave","remove_hats","remove_left_arm","remove_left_leg","remove_right_arm","remove_right_leg", "smoke","explode","sparkles"} script.Parent.MouseButton1Down:connect(function() for i,v in pairs(script.Parent:GetChildren()) do for ii, vv in pairs(stuff) do if v.Name == vv then if v.Visible == true then v.Visible = false script.Parent.Text = "Show" elseif v.Visible == false then v.Visible = true script.Parent.Text = "Hide" end end end end end)
try that |
|
|
| Report Abuse |
|
|
Proxemics
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 2542 |
|
| |
|
Proxemics
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 2542 |
|
| |
|
Proxemics
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 2542 |
|
| |
|
| |
|
Proxemics
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 2542 |
|
| |
|
Proxemics
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 2542 |
|
| |
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
|
| 11 Apr 2015 09:33 AM |
stuff = {workspace.script,workspace.script2} script.Parent.MouseButton1Down:connect(function() for i,v in pairs(script.Parent:GetChildren()) do for ii, vv in pairs(stuff) do if v.Name == vv.Name then if v.Visible == true then v.Visible = false script.Parent.Text = "Show" elseif v.Visible == false then v.Visible = true script.Parent.Text = "Hide" end end end end end) |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2015 09:49 AM |
You sunk my battleship...
:< |
|
|
| Report Abuse |
|
|