Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is my script not working?

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

✓ Accepted answer

line 35 :

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

2 comments

0

Simple mistake, thanks mate!

0

Nope :3

This discussion is preserved as it was. New answers, comments, and votes are closed.