|
| 26 Jun 2012 02:58 PM |
I'm sure that this is a simple question. Lets say I have a table: myTable = game.Players:GetChildren() and I wanted to edit a player in that table's torso. Would this be right? myTable[1].Character.Torso:Remove()
|
|
|
| Report Abuse |
|
|
|
| 26 Jun 2012 03:01 PM |
Well, that would change a player's torso, assuming that one player was in the server. What would be better would be to randomize it:
if #myTable > 0 then myTable[math.random(1,#myTable)].Character.Torso:remove() end
-God Bless- |
|
|
| Report Abuse |
|
|
ComBatPro
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 205 |
|
| |
|
|
| 26 Jun 2012 03:44 PM |
@noober;
What does this line do?
myTable[math.random(1,#myTable)].Character.Torso:remove()
I just want to know for future references. |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2012 04:15 PM |
So you put a period in front of the brackets?
|
|
|
| Report Abuse |
|
|
|
| 26 Jun 2012 04:58 PM |
It chooses a random child of myTable.
Yes, the period is to denote a child of the object value stored in myTable.
-God Bless- |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2012 05:07 PM |
And if you want to be really fancy about it, you could even do the following:
myTable[math.random(#myTable)].Character.Torso:remove() --Notice the removal of "1," in math.random() |
|
|
| Report Abuse |
|
|