function onClicked(GUI)
h = script.Parent.Parent.Parent.Parent.Character:findFirstChild("Humanoid")
if h then
Im making a GUI, and then i realized "This would be better with a show/hide button!" so i did this, and it epicly fails. Any ideas?
SCRIPT:
if script.Parent.Text == "Hide" then
local p = script.Parent.Parent:GetChildren()
for i=1,#p do
if p[i].className == "TextButton" or p[i].className == "TextLabel" or p[i].className == "TextBox" then
if p[i].Name ~= "Show/Hide" then
p[i].Position = (p[i].Position - UDim2.new(50, 50, 50, 50))
script.Parent.Text = "Show"
else
if script.Parent.Text == "Show" then
local pp = script.Parent.Parent:GetChildren()
for ii=1,#pp do
if pp[ii].className == "TextButton" or pp[ii].className == "TextLabel" or pp[ii].className == "TextBox" then
if pp[ii].Name ~= "Show/Hide" then
pp[ii].Position = (pp[ii].Position + UDim2.new(50, 50, 50, 50))
script.Parent.Text = "Hide"
else return end
end end end end end end end end end
script.Parent.MouseButton1Click:connect(onClicked)
thanks for helpin'! |