function Paint(Brick) local Constant = (Brick.BrickColor.r + Brick.BrickColor.b + Brick.BrickColor.g) / 3 Brick.Color = Color3.new(Constant, Constant, Constant) end function Search(Object) wait() print(Object) coroutine.resume(coroutine.create(Paint), Object) local Children = Object:GetChildren() for X = 1, # Children do Search(Children[X]) end end Search(game.Workspace)
So I want this script to make everything black and white, the parts, players, etc. But the problem is the players are still colored and the blocks are Black & White.
If I could get help, that would be fantastic!
I think the problem is that you're not checking to see if the object is a part or not. Some items don't have a BrickColor property and that may cause the script to break. Try this:
function Paint(Brick) local Constant = (tonumber(Brick.BrickColor.r) + tonumber(Brick.BrickColor.g) + tonumber(Brick.BrickColor.g)) / 3 Brick.BrickColor = BrickColor.new(Color3.new(Constant, Constant, Constant)) end function Search(Object) wait() local Children = Object:GetChildren() --Get the children of the object for x = 1, #Children do --Numeric loop from 1 to the number of items in the Children table. if Children[x]:IsA("BasePart") then --If the child is a part of any kind then. Paint(Children[x]) --Run the Paint function on the child. elseif Children[x]:IsA("Model") then --If the child is a model then. Search(Children[x]) --Search the model for potential bricks. else return end end end Search(game.Workspace)