I feel like a complete noob, butttt this is erroring and I can't fix it
error: BrickColor is not a valid member of camera
Idk camera????
script.Parent.TrackTerrain.Value = _G.Terrains[math.random(1,#_G.Terrains)] TrackPieces = game.Workspace:GetChildren("TrackPiece") if script.Parent.TrackTerrain.Value == "Desert" then for DesertConvert = 1, #TrackPieces do TrackPieces[DesertConvert].BrickColor = "Pastel brown" TrackPieces[DesertConvert].Material = "Sand" end end
Don't forget there aren't just BasePart objects in Workspace. Camera and Terrain are examples, you might have more if you put in scripts or whatever.
Those non-BasePart objects do not have BrickColors, thus giving you that error. Try putting aan if statement checking if the child is a BP.
Like that:
script.Parent.TrackTerrain.Value = _G.Terrains[math.random(1,#_G.Terrains)] TrackPieces = game.Workspace:GetChildren("TrackPiece") if script.Parent.TrackTerrain.Value == "Desert" then for DesertConvert = 1, #TrackPieces do if TrackPieces[DesertConvert]:IsA("BasePart") then TrackPieces[DesertConvert].BrickColor = "Pastel brown" TrackPieces[DesertConvert].Material = "Sand" end end end