|
| 06 Dec 2014 02:44 PM |
I've been trying to change my place into a snowy theme, however there are so many trees and bricks I cannot color each brick white individually other wise it will take until next Christmas to finish.
What I have thought of is a script which turns every brick with a grass material white, however I am unsure how to to this or even if it is possible. I have tried several attempts but I have failed to get a result. Also, these bricks are grouped and in different locations not all in Workspace if that makes sense. Any help would be appreciated :) |
|
|
| Report Abuse |
|
|
Xsitsu
|
  |
| Joined: 28 Jul 2009 |
| Total Posts: 2921 |
|
|
| 06 Dec 2014 02:48 PM |
function Search(obj) if obj:IsA("BasePart") then if obj.Material == "Grass" then obj.BrickColor = BrickColor.new("White") end end
for _, v in pairs(obj:GetChildren()) do Search(v) end end
Search(game.Workspace) |
|
|
| Report Abuse |
|
|
| |
|
Xsitsu
|
  |
| Joined: 28 Jul 2009 |
| Total Posts: 2921 |
|
|
| 06 Dec 2014 03:11 PM |
function Search(obj) if obj:IsA("BasePart") then if obj.Material == Enum.Material.Grass then obj.BrickColor = BrickColor.new("White") end end
for _, v in pairs(obj:GetChildren()) do Search(v) end end
Search(game.Workspace)
Was comparing materials the wrong way. |
|
|
| Report Abuse |
|
|
|
| 06 Dec 2014 03:20 PM |
| Thank you! It was nice to come back and correct it as well. |
|
|
| Report Abuse |
|
|