I made a button gui that when its clicked it should make some bricks invisible and visible if clicked again, but it wont do anything and i have no errors in the output, i have a similar script that works but the bricks are all from the same group unlike for this one, but still it makes no sense to me.. help?
on = 1 script.Parent.MouseButton1Down:connect(function() local plr = script.Parent.Parent.Parent.Parent.Parent.Parent local c1 = plr.Character.RobeChest:GetChildren() local c2 = plr.Character.RobeLarm:GetChildren() local c3 = plr.Character.RobeRarm:GetChildren() local c4 = plr.Character.RobeLleg:GetChildren() local c5 = plr.Character.RobeRleg:GetChildren() if on == 1 then on = 0 for i = 1, #c1 do if c1[i].Name ~= "Middle" then c1[i].Transparency = 1 end end for i = 1, #c2 do if c2[i].Name ~= "Middle" then c2[i].Transparency = 1 end end for i = 1, #c3 do if c3[i].Name ~= "Middle" then c3[i].Transparency = 1 end end for i = 1, #c4 do if c4[i].Name ~= "Middle" then c4[i].Transparency = 1 end end for i = 1, #c5 do if c5[i].Name ~= "Middle" then c5[i].Transparency = 1 end end end if on == 0 then on = 1 for i = 1, #c1 do if c1[i].Name ~= "Middle" then c1[i].Transparency = 0 end end for i = 1, #c2 do if c2[i].Name ~= "Middle" then c2[i].Transparency = 0 end end for i = 1, #c3 do if c3[i].Name ~= "Middle" then c3[i].Transparency = 0 end end for i = 1, #c4 do if c4[i].Name ~= "Middle" then c4[i].Transparency = 0 end end for i = 1, #c5 do if c5[i].Name ~= "Middle" then c5[i].Transparency = 0 end end end end)
Sorry to say this, but, the script is too complicated, for it shouldn't be. Possibly too many checks?