local ColorFloor = game.Workspace.ColorFloor local ColorFloorChildren = ColorFloor:GetChildren() local function ColorChange() for i = 1, #ColorFloorChildren do local randomnumber = math.random(0, 10) if randomnumber == 1 then ColorFloorChildren[i].BrickColor.new(128, 187, 219) end end end ColorChange()
I want to have a code where it will run a script that randomly chooses a number. Which will determine which color to apply to the Part (Labelled as "ColorPlate"). My problem is for some reason (Probably a typo but I am blind), I'm getting the error "new is not a valid member of BrickColor" from doing this. Any suggestions?
Hello,
It appears that you are checking the property "BrickColor" instead of assigning a new color value.
To fix this, simply change the code from:
ColorFloorChildren[i].BrickColor.new(128, 187, 219)
To:
ColorFloorChildren[i].Color = Color3.FromRGB(128,187,219)
Hopefully, this helps!
Cheers, Ninjamanchase