Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Brick visible true/false not working?

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)

2 comments

0

Any errors in output? Try puting a few prints inbetween the code to see where it stops working

0

it printed all of the prints i put in and no errors but yet it wont be invisible xD

1 answer

Sorry to say this, but, the script is too complicated, for it shouldn't be. Possibly too many checks?

This discussion is preserved as it was. New answers, comments, and votes are closed.