Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 15 Jan 2015 04:03 PM |
with FindFirstChild?
for _, v in pairs(game.Players:GetPlayers()) do if v.Character:FindFirstChild("ObjectValue") then
I want to print the number of values found within the players. |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2015 04:07 PM |
To get the number of children (or objects found), all you have to do is use this symbol: #
Correct me if I'm wrong or this doesn't work, but try doing
for i, v in pairs(game.Players:GetChildren()) do numberOfChildren = #v:GetChildren() end
it should be something along those lines, pm me if that doesn't work and I'll test some things out for you :) |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2015 04:21 PM |
make a variabe like local ayy = 0
then whenever findfirstchild succeeds, make ayy = ayy + 1
then at the end print (ayy)
and for all children amount just do #model:GetChildren() |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2015 04:24 PM |
The # stands for 'length of table.' So #{1,2,3} would be 3.
Here is one way to use the #.
local Players = game.Players:GetPlayers() for i=1, #Players do print(i, Players[i]) end
>> 1 Player
Here is another way.
local Players = game.Players:GetPlayers() for _, v in pairs(Players)do print(v.Name, " has ", #v:GetChildren(), " objects.") end
>> Player has 32 parts. |
|
|
| Report Abuse |
|
|
025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
|
| 15 Jan 2015 04:26 PM |
for _, v in pairs(game.Players:GetPlayers()) do if v.Character:FindFirstChild("ObjectValue") then print(#v.ObjectValue)
not sure R$6,352 |
|
|
| Report Abuse |
|
|