generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Change color of all grass bricks?

Previous Thread :: Next Thread 
CeruleanTides is not online. CeruleanTides
Joined: 20 Oct 2010
Total Posts: 736
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 is not online. 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
CeruleanTides is not online. CeruleanTides
Joined: 20 Oct 2010
Total Posts: 736
06 Dec 2014 02:58 PM
Hmm it doesn't work.
Report Abuse
Xsitsu is not online. 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
CeruleanTides is not online. CeruleanTides
Joined: 20 Oct 2010
Total Posts: 736
06 Dec 2014 03:20 PM
Thank you! It was nice to come back and correct it as well.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image