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

Why is my script not working?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

It's meant to be traffic lights and change the colors of the lights and has a DB value so it cant be spammed. Also I cannot read the output very well, so when I see an error it doesn't make sense to me, anyway, this is what I have but it doesn't work.

db = script.Parent.Parent.Parent.Parent.DB
t2 = script.Parent.Parent.Parent.Parent.Traffic2

function onClicked()
    if db.Value == false then
        db.Value = true
        script.Parent.BrickColor = BrickColor.new("Really black")
        t2.Main.Button.BrickColor = BrickColor.new("Really black")
        wait(5)
        script.Parent.Parent.Green.BrickColor = BrickColor.new("Medium green")
        t2.Main.Green.BrickColor = BrickColor.new("Medium green")
        script.Parent.Parent.Amber.BrickColor = BrickColor.new("Bright orange")
        t2.Main.Amber.BrickColor = BrickColor.new("Bright orange")
        wait(1)
        script.Parent.Parent.Amber.BrickColor = BrickColor.new("Light orange")
        t2.Main.Amber.BrickColor = BrickColor.new("Light orange")
        script.Parent.Parent.Red.BrickColor = BrickColor.new("Bright red")
        t2.Main.Red.BrickColor = BrickColor.new("Bright red")
        script.Parent.Parent.Warning.Decal.Texture = "http://www.roblox.com/asset/?id=167323969"
        wait(8)
        script.Parent.Parent.Amber.BrickColor = BrickColor.new("Bright orange")
        t2.Main.Amber.BrickColor = BrickColor.new("Bright orange")
        script.Parent.Parent.Red.BrickColor = BrickColor.new("Medium red")
        t2.Main.Red.BrickColor = BrickColor.new("Medium red")
        script.Parent.Parent.Warning.Decal.Texture = "http://www.roblox.com/asset/?id=167323958"
        wait(1)
        script.Parent.Parent.Green.BrickColor = BrickColor.new("Bright green")
        t2.Main.Green.BrickColor = BrickColor.new("Bright green")
        script.Parent.Parent.Amber.BrickColor = BrickColor.new("Light orange")
        t2.Main.Amber.BrickColor = BrickColor.new("Light orange")
        db.Value = false
    end
end

script.Parent.ClickDetector.MouseClick:connect()

1 answer

Log in to vote
1
Answered by 9 years ago

line 35 :

 script.Parent.ClickDetector.MouseClick:connect(onClicked)
0
Simple mistake, thanks mate! General_Scripter 425 — 9y
0
Nope :3 ScripterGame 145 — 9y
Ad

Answer this question