Hi folks, I'm a bit of a beginner in scripting and still trying to gather techniques to make my codes efficient. Please have a look at my script and hopefully one of you awesome helpers can tell me what I'm doing wrong, thank you!
Debounce = false
function OnClicked()
if Debounce == true then return end
Debounce = true
for i,v in pairs (script.Parent.Parent:GetChildren())do
if v.Name == "LED" then
v.BrickColor = BrickColor.new("Crimson")
wait(2)
v.BrickColor = BrickColor.new("Deep orange")
wait(2)
v.BrickColor = BrickColor.new("Parsley green")
wait(4)
v.BrickColor = BrickColor.new("Crimson")
end
end
end
script.Parent.ClickDetector.MouseClick:Connect(OnClicked)
Basically, I have 3 sets of L.E.D's I want to light up when a button is clicked, but for some reason it does work in the colour order although only 1 set of L.E.D's light up if that makes sense. Thank you all again for your time and hope to hear soon!

2 comments
accept my answer please
I will, it hasn't come up for me yet because I just joined. Don't worry, I will remember since you helped me out a lot! Thank you again!