of     1   

tidus019
#31254448Monday, August 09, 2010 6:50 PM GMT

ok i tried to change this so it changes every brick in my place to any random colour, but without succes.I cant find it in the scripting wiki, Help plz :-) original script : -- BouyertheDestroyer 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)
OBF
#31254514Monday, August 09, 2010 6:51 PM GMT

coroutines take only one argument.
V1Buzzbomb
#31255133Monday, August 09, 2010 6:58 PM GMT

@above any extra arguments are passed to the function. what exactly are you trying to accomplish? because you could just call the paint function. I would build a table of the workspace children using a recursive function, then operate on the table directly by calling paint on each object. Your also going to need to check if each entry is a brick before calling your function using an if statement and object:IsA("BasePart").
tidus019
#31256370Monday, August 09, 2010 7:12 PM GMT

sorry, i really dont understand what your explaining, im a beginning scripter ;-) i'm trying to make every brick in my place a random colour :-)
arundel
#31257390Monday, August 09, 2010 7:23 PM GMT

time = 1 -- One second of waiting before changing colors. while wait(time) do for i,v in pairs(game.Workspace:GetChildren()) do if v.className == "Part" then v.Color = Color3.new(math.random(),math.random(),math.random()) end end end
V1Buzzbomb
#31260789Monday, August 09, 2010 7:59 PM GMT

Gchilds = {} --our table we are going to be inserting bricks into function getDecendants(object) --get all objects under an object local childs = object:GetChildren() for i,v in ipairs(childs) do if v:IsA("Part") or v:IsA("TrussPart") or v:IsA("WedgePart") then Gchilds[#Gchilds + 1] = v end getDecendants(v) --this function called it's self, makeing it a recursive function end end getDecendants(game.Workspace) --start the function off with the workspace for i,v in ipairs(Gchilds) do --paint all of your bricks v.BrickColor = BrickColor.Random() --painting code, you chould change this for different effects. You must always use BrickColor though end --here is a script that will paint every brick in workspace a random color.
arundel
#31261748Monday, August 09, 2010 8:10 PM GMT

@V1Buzzbomb , if v:IsA("BasePart") then Get's all types of parts ;)

    of     1