while true do if game.Workspace.MaxVal.Value >= 5 then local Parts = game.Workspace:GetChildren() for i = 1, #Parts do if Parts[i].Name == "Partay" or "Partay1" or "Partay2" or "Partay3" or "Partay4" or "Partay5" then Parts.BrickColor = BrickColor.new("Parsley green") end end end wait(.2) end
There's no error that's being outputted, but it does go through past that second if statement if I tell it to print something. It might be using the original variable, and not changing it based off of that, but I don't know.
Problem: BrickColor isn't changing.
Solution: Use Parts[i]
instead of Parts
on line 06.
Explanation: If you used Parts
, the script would add a key called "BrickColor" into the Parts table instead of setting the part's BrickColor. Using Parts[i]
would make it so that the BrickColor of the part would change.
while true do if game.Workspace.MaxVal.Value >= 5 then local Parts = game.Workspace:GetChildren() for i = 1, #Parts do if Parts[i].Name == "Partay" or Parts[i].Name == "Partay1" or Parts[i].Name == "Partay2" or Parts[i].Name == "Partay3" or Parts[i].Name == "Partay4" or Parts[i].Name == "Partay5" then Parts[i].BrickColor = BrickColor.new("Parsley green") end end end wait(.2) end
Please upvote and accept this answer if it helped.