Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer
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) 

1 comment

0

Thank you sir!

This discussion is preserved as it was. New answers, comments, and votes are closed.