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 » Scripting Helpers
Home Search
 

Re: Recoloring script no work

Previous Thread :: Next Thread 
TomCat88 is not online. TomCat88
Joined: 03 Dec 2011
Total Posts: 8971
11 Dec 2013 09:56 PM
p = game.Workspace:GetChildren()
for i = 1, #p do
if p[i]:IsA("Part") and p[i].BrickColor == BrickColor.new("Bright green") then
p[i].BrickColor = BrickColor.new("White")
else
end
end

//-TC [wARC]
Report Abuse
TomCat88 is not online. TomCat88
Joined: 03 Dec 2011
Total Posts: 8971
11 Dec 2013 10:00 PM
Bump

//-TC [wARC]
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
11 Dec 2013 10:04 PM
Maybe the object you're trying to recolor is a model.
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
11 Dec 2013 10:14 PM
Yeah, you should use recursion

function Recolor(Child,Color)
for i,v in pairs(Child:GetChildren()) do
if v:IsA('BasePart') then
v.BrickColor=Color
end
Recolor(v,Color)
end
end

Recolor(Workspace,BrickColor.White())
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
11 Dec 2013 10:15 PM
You might wanna modify above

function Recolor(Child,Color)
for i,v in pairs(Child:GetChildren()) do
if v:IsA('BasePart') then
v.BrickColor=Color
elseif v:IsA("Model") then
Recolor(v,Color)
end
end
end

Recolor(Workspace,BrickColor.White())
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
11 Dec 2013 10:18 PM
I didn't bother to put a check for a model because some people actually put parts in other parts and stuff.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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