Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Real quick simple question. How do you get the number of children?

Asked by 6 years ago

I am trying to get the number of children of a part or something but I dont remember where do put the #

for i,v in pairs(game.Players:GetChildren()) do
    print(v)
end

Theres the for loop but I forgot where you put the # to make it a number value..

Anyone know?

0
#Instance:GetChildren() RubenKan 3615 — 6y

1 answer

Log in to vote
0
Answered by
Zafirua 1348 Badge of Merit Moderation Voter
6 years ago
Edited 6 years ago
local Player = game.Players:GetChildren()
local PlayerChildren = #Player
print (PlayerChildren)
0
Yea that's the worst way to get players Amiaa16 3227 — 6y
0
doesn't matter which way... if it works it's good lol awesomeipod 607 — 6y
0
It does matter. I could do tons of things i.e. game:GetService("Players").Name = "asd" or Instance.new("Part", game:GetService("Players")) Amiaa16 3227 — 6y
0
@Kiriot22. I simply answered his question on how to reference the "#". Now of course the code might not be efficient, but that was not his original question. Ironically, you also put a worst way to instance an object in a game. Zafirua 1348 — 6y
Ad

Answer this question