War icon

D2

War | PRO | 03/16/17 10:16:13 PM UTC | 0 ⭐ | 625 👁️ | Never ⏰ | []
Lua |

750 B

|

None

|

0 👍

/

0 👎

local a = script.Parent.Door:GetChildren()
 
for i=1,#a do
    wait()
    if a[i].ClassName == 'Part' or a[i].ClassName == "UnionOperation" then
    local b = Instance.new("NumberValue")
    b.Parent = a[i]
    b.Name = "Transp"
    b.Value = a[i].Transparency
    end
end
 
function open()
    for i=1,#a do
        a[i].Transparency = 1
        a[i].CanCollide = false
    end
end
 
function close()
    for i=1,#a do
        a[i].Transparency = a[i].Transp.Value
        a[i].CanCollide = true
    end
end
 
script.Parent.allowed.Changed:connect(function()
    if script.Parent.allowed.Value == true then
        open()
    else
        close()
    end
end)
 
script.Parent.Open.ClickDetector.MouseClick:connect(function()
    script.Parent.allowed.Value = true
    wait(3)
    script.Parent.allowed.Value = false
end)

Comments