Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I change the color of multiple parts in a model?

Asked by 9 years ago

This is what I have tried

script.Parent.Parent.Chatted:connect(function(msg)
        if msg == "test" then
    local children = game.Workspace.Tree:GetChildren()
      for  i = 1, #children do
    i, children.BrickColor = BrickColor.new("Brown") 
        end
     end
 end) 

No script error shows up in the output

1 answer

Log in to vote
0
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
9 years ago
script.Parent.Parent.Chatted:connect(function(msg) --I will assume you have this script in backpack.
        if msg == "test" then
    local children = game.Workspace.Tree:GetChildren()
      for  i = 1, #children do
     children[i].BrickColor = BrickColor.new("Brown") --You can't have i, children, this part of the script would break. You can do children[i] because "i" is the index number or table name for the item in "children". Other than this line, you script seems fine.
        end
     end
 end) 
0
Thank you sir! bestbudd1 45 — 9y
Ad

Answer this question