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: Set color of children

Previous Thread :: Next Thread 
Raildex is not online. Raildex
Joined: 06 Dec 2009
Total Posts: 934
27 Jan 2016 12:17 PM
How would I set the color of all the parts inside a section of a model. Say in order to change the color of car parts.
Report Abuse
Vezious is not online. Vezious
Joined: 09 Nov 2013
Total Posts: 606
27 Jan 2016 12:18 PM
A child's color should not matter! All children are the same. They shouldn't be treated differently because of their color. Let them be!
Report Abuse
Bernkastel2727 is not online. Bernkastel2727
Joined: 23 Sep 2012
Total Posts: 2612
27 Jan 2016 12:24 PM
local c = workspace.Model:getChildren()
for i = 1, #c do
c.BrickColor = BrickColor.new("White")
end
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
27 Jan 2016 12:28 PM
^ lol?

local c = Model:GetChildren()
for _,v in ipairs(c) do
c.BrickColor = BrickColor.new("White")
end


Report Abuse
TickerOfTime is not online. TickerOfTime
Joined: 02 Sep 2012
Total Posts: 2030
27 Jan 2016 12:29 PM
^lol?

```
for K,V in next, Model:children() do
V.BrickColor = BrickColor.Random()
end
```
Report Abuse
Vezious is not online. Vezious
Joined: 09 Nov 2013
Total Posts: 606
27 Jan 2016 12:30 PM
^Lol
^^Lmao
^^^Truuuu



local Model = game.Workspace:FindFirstChild("I Like Turtlez")

for i,v in pairs (Model:GetChildren()) do
v.BrickColor = BrickColor.new("White")
end
Report Abuse
Bernkastel2727 is not online. Bernkastel2727
Joined: 23 Sep 2012
Total Posts: 2612
27 Jan 2016 12:31 PM
^^^^lol??

local c = game.Workspace:GetChildren();
for c = 1, #c do
if c[c].className == "Part" then
c.BrickColor = BrickColor("Grime");
end
end
Report Abuse
Vezious is not online. Vezious
Joined: 09 Nov 2013
Total Posts: 606
27 Jan 2016 12:33 PM
^OMG
^^OK
^^Lol
^^^Lmao
^^^^^Truuuu



local Model = game.Workspace:FindFirstChild("I Like Turtlez")

for i,v in pairs (Model:GetChildren()) do
if v:IsA("BasePart") then
v.BrickColor = BrickColor.new("White")
end end
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
27 Jan 2016 12:35 PM
local function property(instance, key, value)
pcall(function() instance[key] = value return (nil); end)
for _, child in next, (instance:getChildren()) do
property(child, key, value)
end
end

property(workspace.model, "BrickColor", BrickColor.new("Bright blue"))
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
27 Jan 2016 12:36 PM
oh lol why did I keep c


Report Abuse
Vezious is not online. Vezious
Joined: 09 Nov 2013
Total Posts: 606
27 Jan 2016 12:37 PM
^nice
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
27 Jan 2016 12:39 PM
^very


Report Abuse
Vezious is not online. Vezious
Joined: 09 Nov 2013
Total Posts: 606
27 Jan 2016 12:39 PM
^ Berry
Report Abuse
Bernkastel2727 is not online. Bernkastel2727
Joined: 23 Sep 2012
Total Posts: 2612
27 Jan 2016 12:39 PM
^^^^^^^um?

function GetChildren(theParent,tblToLoop,loopThroughDescendants)
local loopThroughDescendants = loopThroughDescendants or false
local tblToLoop = tblToLoop or {}
for i,v in pairs(theParent:GetChildren()) do
table.insert(tblToLoop,v);
if loopThroughDescendants then
GetChildren(v,tblToLoop,true);
end
end
return tblToLoop
end
local Children = GetChildren(game.Workspace.Model,false,true);
for i,v in pairs(Children) do
if v:IsA("Part") then
script.Parent.BrickColor = BrickColor("White");
end
end
Report Abuse
Bernkastel2727 is not online. Bernkastel2727
Joined: 23 Sep 2012
Total Posts: 2612
27 Jan 2016 12:41 PM
No, I'm sorry, its v.BrickColor = BrickColor("White");

not script.Parent.BrickColor = BrickColor("White");
Report Abuse
Vezious is not online. Vezious
Joined: 09 Nov 2013
Total Posts: 606
27 Jan 2016 12:42 PM
^ A tsunami just washed away your sand castle
Report Abuse
Raildex is not online. Raildex
Joined: 06 Dec 2009
Total Posts: 934
27 Jan 2016 02:32 PM
What would I do to get the color from a value. This is what I have so far

carV = backup:clone()
carV.Parent = game.Workspace
carV:makeJoints()
carV:SetPrimaryPartCFrame (script.objectValue.Value.CFrame+Vector3.new(0,5,0))
carV:SetPrimaryPartCFrame (car1.PrimaryPart.CFrame * CFrame.Angles(0,math.rad(180), 0))
print(carV.PrimaryPart)
local c = carV.Primary:getChildren()
for i = 1, #c do
c.BrickColor = script.Parent.Parent.carPrimaryColor
end
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
27 Jan 2016 02:37 PM
I'm going to assume
script.Parent.Parent.carPrimaryColor

Is a brickColorValue


c.BrickColor = script.Parent.Parent.carPrimaryColor.Value
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