|
| 31 May 2013 04:14 AM |
So, after I do:
game.players:getchildren(). (I know capitalisation, but my phone is messing up) how can I find each players character using in pairs. |
|
|
| Report Abuse |
|
|
|
| 31 May 2013 04:19 AM |
I'd first use :GetPlayers() so that it finds players and not everything inside players (stated in roblox wiki also) Then I could use this to get the players and their characters:
p = game.Players:GetPlayers() for i = 1, #p do if p[i].Character then --Stuff goes here end end |
|
|
| Report Abuse |
|
|
|
| 31 May 2013 04:22 AM |
Or if you wanted to use pairs:
for _,v in pairs (game.Players:GetPlayers()) do if v.Character then --Stuff goes here end end |
|
|
| Report Abuse |
|
|
|
| 31 May 2013 04:42 AM |
What does #p and [i] mean?
I know what the p is and I know what the i is. I jut don't know what the [] an # mean. |
|
|
| Report Abuse |
|
|
|
| 31 May 2013 04:46 AM |
The for loop with i and #p is for the loop to run through every player. When using p[i].Character, it runs the for loop in every player to find a character in each and ignores any players with no character. |
|
|
| Report Abuse |
|
|
|
| 31 May 2013 08:02 AM |
| Yes, in this situation, but what do they do? Like an explanation of the actual thing, not jut this scenario. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|