I am using GetChildren like this:
local cars = game.Workspace.Car:GetChildren()
for i = 1, #cars do
cars[i].BrickColor = BrickColor.Yellow()
end
But it justs finds one random part by using the table. What term finds All Children?
I am using GetChildren like this:
local cars = game.Workspace.Car:GetChildren()
for i = 1, #cars do
cars[i].BrickColor = BrickColor.Yellow()
end
But it justs finds one random part by using the table. What term finds All Children?
I don't see anything wrong in that script, it should work exactly how you want it to. However you should probably using in pairs for this application.
cars = game.Workspace.Car:GetChildren()
for i, v in pairs(cars) do
if v:IsA("Part") then
v.BrickColor = BrickColor.Yellow()
end
end
c=workspace:children()
for i=1,#c do
if c[i].className=="Part"then
c[i].BrickColor=BrickColor.new("Yellow") --Sorry if did this line wrong
elseif c[i].className=="Model"then
ci=c[i]:children()
for i2=1,#ci do
if ci[i2].className=="Part"then
ci[i2].BrickColor=BrickColor.new("Yellow") --Sorry if did this line wrong
end end end end
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
Thank you, I will try it.
Also it may because there is a child of "Car" that is not a part. This will cause the script to break. If there are any children in "Car" that arn't parts your going to need to check to make sure "v" is a part first before doing anything.
I'll just edit to do that....
Well I LUA I fixed it all, but one problem, Okay so I have a Color3Value into the starterGui Gui called "Shop" and When I click a text button