I have this script that is supposed to check that once a part is clicked, it checks if every button is red and if they are red, then it turns green. This script is the exact same in the other buttons so it should only work for the first person to press their button, however, this script turns every button pressed green
--buttons is a folder with 8 button parts
script.Parent.bb.MouseClick:Connect(function(hit)
a= game.Workspace.buttons:GetChildren()
for i, child in ipairs(a) do
if child.BrickColor.Name == "Really red"
then
print("XD")
script.Parent.BrickColor = BrickColor.new("Earth green")
wait(10)
script.Parent.BrickColor = BrickColor.new("Really red")
end
end
end)
please help

2 comments
still doesnt work
change ipairs to in pairs