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?
2 comments
Thank you so much, I believe that's fixed! Unfortunately I was given another error hopefully unrelating to the previous. It stated ("ServerScriptService.Script:9: attempt to call a nil value - Server - Script:9 issue"). The line it focuses is ("ColorFloorChildren[i].Color = Color3.FromRGB(128,187,219)")
Nevermind. I figured out the function was running before my floorplates were created. I used WaitForChild and fixed the issue. Thank you again!