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

CanCollide, Transparency and If/Elseif not working, why?

Asked by 9 years ago

So. I have one set of doors which is closed. I click a button, they open (A different set of doors is visible), but it doesn't work, why?

local a = script.Parent.Parent.a
local b = script.Parent.Parent.b
local c = script.Parent.Parent.c
local d = script.Parent.Parent.d
local e = script.Parent.Parent.e
local f = script.Parent.Parent.f
local g = script.Parent.Parent.g
local h = script.Parent.Parent.h
local i = script.Parent.Parent.i
local j = script.Parent.Parent.j
local k = script.Parent.Parent.k
local l = script.Parent.Parent.l
local w1 = script.Parent.Parent.w1
local a2 = script.Parent.Parent.a2
local b2 = script.Parent.Parent.b2
local c2 = script.Parent.Parent.c2
local d2 = script.Parent.Parent.d2
local e2 = script.Parent.Parent.e2
local f2 = script.Parent.Parent.f2
local g2 = script.Parent.Parent.g2
local h2 = script.Parent.Parent.h2
local i2 = script.Parent.Parent.i2
local j2 = script.Parent.Parent.j2
local k2 = script.Parent.Parent.k2
local l2 = script.Parent.Parent.l2
local w2 = script.Parent.Parent.w2

function onClick()
    if c.CanCollide == true then
        a.Transparency = 1
        b.Transparency = 1
        c.Transparency = 1
        d.Transparency = 1      
        e.Transparency = 1
        f.Transparency = 1
        g.Transparency = 1
        h.Transparency = 1  
        i.Transparency = 1
        j.Transparency = 1
        k.Transparency = 1
        l.Transparency = 1  
        w1.Transparency = 1 
        a.CanCollide = false    
        b.CanCollide = false    
        c.CanCollide = false    
        d.CanCollide = false            
        e.CanCollide = false    
        f.CanCollide = false    
        g.CanCollide = false    
        h.CanCollide = false    
        i.CanCollide = false    
        j.CanCollide = false    
        k.CanCollide = false    
        l.CanCollide = false        
        w1.CanCollide = false   
        a.Transparency = 0
        b.Transparency = 0
        c.Transparency = 0
        d.Transparency = 0      
        e.Transparency = 0
        f.Transparency = 0
        g.Transparency = 0
        h.Transparency = 0  
        i.Transparency = 0
        j.Transparency = 0
        k.Transparency = 0
        l.Transparency = 0  
        w1.Transparency = 0.4   
        a.CanCollide = true 
        b.CanCollide = true 
        c.CanCollide = true 
        d.CanCollide = true         
        e.CanCollide = true 
        f.CanCollide = true 
        g.CanCollide = true 
        h.CanCollide = true 
        i.CanCollide = true 
        j.CanCollide = true 
        k.CanCollide = true 
        l.CanCollide = true     
        w1.CanCollide = true    

        elseif c.CanCollide == false then
        a.Transparency = 0
        b.Transparency = 0
        c.Transparency = 0
        d.Transparency = 0      
        e.Transparency = 0
        f.Transparency = 0
        g.Transparency = 0
        h.Transparency = 0  
        i.Transparency = 0
        j.Transparency = 0
        k.Transparency = 0
        l.Transparency = 0  
        w1.Transparency = 0.4
        a.CanCollide = true 
        b.CanCollide = true 
        c.CanCollide = true 
        d.CanCollide = true         
        e.CanCollide = true 
        f.CanCollide = true 
        g.CanCollide = true 
        h.CanCollide = true 
        i.CanCollide = true 
        j.CanCollide = true 
        k.CanCollide = true 
        l.CanCollide = true     
        w1.CanCollide = true
        a.Transparency = 1
        b.Transparency = 1
        c.Transparency = 1
        d.Transparency = 1      
        e.Transparency = 1
        f.Transparency = 1
        g.Transparency = 1
        h.Transparency = 1  
        i.Transparency = 1
        j.Transparency = 1
        k.Transparency = 1
        l.Transparency = 1  
        w1.Transparency = 1 
        a.CanCollide = false    
        b.CanCollide = false    
        c.CanCollide = false    
        d.CanCollide = false            
        e.CanCollide = false    
        f.CanCollide = false    
        g.CanCollide = false    
        h.CanCollide = false    
        i.CanCollide = false    
        j.CanCollide = false    
        k.CanCollide = false    
        l.CanCollide = false        
        w1.CanCollide = false   
    end
end

script.Parent.ClickDetector.MouseClick:connect(onClick)

Answer this question