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

Whats Wrong With Garage Door? [SLOVED]

Asked by 9 years ago

Hello I have made a garage door, when I make bool value (that is called open) to true it does not do anything. And when I make open to false still nothing help me fix this!

script.Parent.Open.Changed:connect(function()
    if script.Parent.Open.Value == true then
        local getallgates = script.Parent:GetChildren()
        for i = 1, #getallgates do
            if getallgates[i].Name == "Gate" then
                getallgates[i].Transparency = 1
                getallgates[i].CanCollide = false
            end
            if getallgates[i].Name == "Window" then
                getallgates[i].Transparency = 1
                getallgates[i].CanCollide = false
            end
        end
    else
        local getallgatescls = script.Parent:GetChildren()
        for o = 1, #getallgatescls do
            if getallgatescls[o].Name == "Gate" then
                getallgatescls[o].Transparency = 0
                getallgatescls[o].CanCollide = true
            end
            if getallgatescls[o].Name == "Window" then
                getallgatescls[o].Transparency = 0.5
                getallgatescls[o].CanCollide = true
            end
        end
    end
end)

Answer this question