Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Brick visible true/false not working?

Asked by
Paldi 109
8 years ago

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)
0
Any errors in output? Try puting a few prints inbetween the code to see where it stops working NinjoOnline 1146 — 8y
0
it printed all of the prints i put in and no errors but yet it wont be invisible xD Paldi 109 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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

Ad

Answer this question