p = workspace:GetChildren() for i=1, #p do if p[i].className == "Part" or "Wedge" then if p[i].BrickColor == BrickColor.new("White") and p[i].Material == "Slate" then p[i].BrickColor = BrickColor.new("Grime") p[i].Material = "Grass" end end end
The problem I'm running into is that there are models in the workspace, and BrickColor & Material are not characteristics of Models.
So if you don't understand, I need this script to change any part or wedge that is colored white, and has the material called Slate.. except it also attempts to change the models in the workspace.
for _,v in pairs (workspace:GetChildren()) if v:IsA("BasePart") then if v.BrickColor == BrickColor.new("White") and v.Material == "Slate" then v.BrickColor = BrickColor.new("Grime") v.Material = "Grass" end end end
"Your error was or "wedge", you needed to put p[i].className == "Wedge" although :IsA("BasePart") is a better alternative." -DevSean
And I changed the for loop to a generic one just because I prefer it over numeric when working with objects.