Answered by
10 years ago Edited 8 years ago
Your code was just about right except two parts of it. When you use this method your going through a table of objects. So P is considered a table, and "i" is the loop (count). In tables there are numbered objects.
Example: P[1]
So when using this method you want to do P[i]. Also you want to do "for i = 1,#P". # means "Number" basically.
http://wiki.roblox.com/index.php?title=Table
1 | local Color = script.Parent.TeamColor |
2 | local P = script.Parent.Team:GetChildren() |
5 | P [ i ] .BrickColor = BrickColor.new(Color.Value) |
UndiscoveredLimited's answer was more sufficient, I thought it was gone, but I guess it's not so I will just keep what I just edited. If you don't understand what for _ ,v in pairs(EXAMPLE:GetChildren()) do
means then I suggest you take a look at the link below. Its the best that I could find in a flash.
1 | local Color = script.Parent.TeamColor |
3 | for _,v in pairs (script.Parent.Team:GetChildren()) do |
4 | v.BrickColor = BrickColor.new(Color.Value) |
http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#pairs
I hope you understand it better now.
Locked by BlueTaslem
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?