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

I've been wondering why my code for my card door wont work for my game about SCPs?

Asked by 4 years ago

I have multiple scripts that have the card name in all of the places where I need the card name (you will see in the code snip-it I put) and I would delete the correct scripts to make it so the card would work with the specific cards I had.

Example:

OpenSound = script.Parent.Door1Parts.Door1.DoorOpen
CloseSound = script.Parent.Door1Parts.Door1.DoorClose

interval = 0.3

script.Parent.Button1.Button1.Touched:Connect(function(card)
    if card.Parent.Name == "Level1" then --Level1 is the level 1 card name as the tool.

        OpenSound:Play()
        script.Parent.Door1Parts.Door1.Transparency = 1
        script.parent.Door1Parts.Door1.CanCollide = false
        script.Parent.Door1Parts.Door1_1.Transparency = 0
        script.parent.Door1Parts.Door1_1.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_1.Transparency = 1
        script.parent.Door1Parts.Door1_1.CanCollide = false
        script.Parent.Door1Parts.Door1_2.Transparency = 0
        script.parent.Door1Parts.Door1_2.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_2.Transparency = 1
        script.parent.Door1Parts.Door1_2.CanCollide = false
        script.Parent.Door1Parts.Door1_3.Transparency = 0
        script.parent.Door1Parts.Door1_3.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_3.Transparency = 1
        script.parent.Door1Parts.Door1_3.CanCollide = false
        script.Parent.Door1Parts.Door1_4.Transparency = 0
        script.parent.Door1Parts.Door1_4.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_4.Transparency = 1
        script.parent.Door1Parts.Door1_4.CanCollide = false
        script.Parent.Door1Parts.Door1_5.Transparency = 0
        script.parent.Door1Parts.Door1_5.CanCollide = true

        script.Parent.Button1.ButtonLight1.BrickColor = BrickColor.new("Lime green")
        script.Parent.Button2.ButtonLight2.BrickColor = BrickColor.new("Lime green")
        wait(4)

        CloseSound:Play()

        script.Parent.Door1Parts.Door1_5.Transparency = 1
        script.parent.Door1Parts.Door1_5.CanCollide = false
        script.Parent.Door1Parts.Door1_4.Transparency = 0
        script.parent.Door1Parts.Door1_4.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_4.Transparency = 1
        script.parent.Door1Parts.Door1_4.CanCollide = false
        script.Parent.Door1Parts.Door1_3.Transparency = 0
        script.parent.Door1Parts.Door1_3.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_3.Transparency = 1
        script.parent.Door1Parts.Door1_3.CanCollide = false
        script.Parent.Door1Parts.Door1_2.Transparency = 0
        script.parent.Door1Parts.Door1_2.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_2.Transparency = 1
        script.parent.Door1Parts.Door1_2.CanCollide = false
        script.Parent.Door1Parts.Door1_1.Transparency = 0
        script.parent.Door1Parts.Door1_1.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_1.Transparency = 1
        script.parent.Door1Parts.Door1_1.CanCollide = false
        script.Parent.Door1Parts.Door1.Transparency = 0
        script.parent.Door1Parts.Door1.CanCollide = true

        script.Parent.Button1.ButtonLight1.BrickColor = BrickColor.new("Really red")
        script.Parent.Button2.ButtonLight2.BrickColor = BrickColor.new("Really red")

    end
end)

script.Parent.Button2.Button2.Touched:Connect(function(card)
    if card.Parent.Name == "Card" then


        script.Parent.Door1Parts.Door1.Transparency = 1
        script.parent.Door1Parts.Door1.CanCollide = false
        script.Parent.Door1Parts.Door1_1.Transparency = 0
        script.parent.Door1Parts.Door1_1.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_1.Transparency = 1
        script.parent.Door1Parts.Door1_1.CanCollide = false
        script.Parent.Door1Parts.Door1_2.Transparency = 0
        script.parent.Door1Parts.Door1_2.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_2.Transparency = 1
        script.parent.Door1Parts.Door1_2.CanCollide = false
        script.Parent.Door1Parts.Door1_3.Transparency = 0
        script.parent.Door1Parts.Door1_3.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_3.Transparency = 1
        script.parent.Door1Parts.Door1_3.CanCollide = false
        script.Parent.Door1Parts.Door1_4.Transparency = 0
        script.parent.Door1Parts.Door1_4.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_4.Transparency = 1
        script.parent.Door1Parts.Door1_4.CanCollide = false
        script.Parent.Door1Parts.Door1_5.Transparency = 0
        script.parent.Door1Parts.Door1_5.CanCollide = true

        script.Parent.Button1.ButtonLight1.BrickColor = BrickColor.new("Lime green")
        script.Parent.Button2.ButtonLight2.BrickColor = BrickColor.new("Lime green")
        wait(4)


        script.Parent.Door1Parts.Door1_5.Transparency = 1
        script.parent.Door1Parts.Door1_5.CanCollide = false
        script.Parent.Door1Parts.Door1_4.Transparency = 0
        script.parent.Door1Parts.Door1_4.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_4.Transparency = 1
        script.parent.Door1Parts.Door1_4.CanCollide = false
        script.Parent.Door1Parts.Door1_3.Transparency = 0
        script.parent.Door1Parts.Door1_3.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_3.Transparency = 1
        script.parent.Door1Parts.Door1_3.CanCollide = false
        script.Parent.Door1Parts.Door1_2.Transparency = 0
        script.parent.Door1Parts.Door1_2.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_2.Transparency = 1
        script.parent.Door1Parts.Door1_2.CanCollide = false
        script.Parent.Door1Parts.Door1_1.Transparency = 0
        script.parent.Door1Parts.Door1_1.CanCollide = true

        wait(interval)

        script.Parent.Door1Parts.Door1_1.Transparency = 1
        script.parent.Door1Parts.Door1_1.CanCollide = false
        script.Parent.Door1Parts.Door1.Transparency = 0
        script.parent.Door1Parts.Door1.CanCollide = true

        script.Parent.Button1.ButtonLight1.BrickColor = BrickColor.new("Really red")
        script.Parent.Button2.ButtonLight2.BrickColor = BrickColor.new("Really red")

    end
end)

The button door is fine but these card doors aren't, please help?

0
Please do some debugging so we know where the problem is. raid6n 2196 — 4y
0
The problem is that after the level one keycard touches the part that is supposed to activate all of that code below isnt working. PurpleTheOval 2 — 4y

Answer this question