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

Why isnt the last bit of code executing?

Asked by 9 years ago

So this script works PERFECTLY fine, until the last bit of code. Anything written behind line 26 won't execute. The output shows no errors, It just doesnt do anything. So basically I just want the last bit to execute when the for statement over it has changed each brick's transparency to 0.

allmehtraps = game.Workspace.traps
a = {allmehtraps.Part1,allmehtraps.Part2,allmehtraps.Part3,allmehtraps.Part4}
butt = script.Parent

script.Parent.ClickDetector.MouseClick:connect(function()
    butt.BrickColor = BrickColor.new("Really red")
            butt.ClickDetector:Destroy()
    for i,v in pairs(a) do
        for i = 0,1, 0.1 do
            wait(.15)
            v.Transparency = i
            if v.Transparency == 1 then 
                v.CanCollide = false
                end
        end

    end
    wait(20)
    for i,v in pairs(a) do
        if v.CanCollide == false then

            for i = 1,0, -0.1 do
                wait(.075)
                v.Transparency = i
            end
                if v.Transparency == 0 then
                v.CanCollide = true
                butt.BrickColor = BrickColor.new("Bright green")
                lol = Instance.new("ClickDetector",script.Parent)
            end
        end
    end
end) 

1 answer

Log in to vote
0
Answered by 9 years ago

I think it is because earlier in the script you never defined lol

0
Well im basically declaring it there, and even without that line of code, it still wont work. tempodoa 0 — 9y
0
Well, you need the line there because don't you need the ClickDetector to make the brick(s) turn Transparency to 0? iPrepared 30 — 9y
Ad

Answer this question