i wanna get the number of players in the server, i found 2 ways to do this but which one is better?

Using GetPlayers():

while wait(.1) do
	if #Players:GetPlayers() <= 2 then
		--Do stuff
	end
end

and using GetChildren():

while wait(.1) do
	if #Players:GetChildren() <= 2 then
		--Do stuff
	end
end

so... which one is better?

3 comments

8

GetPlayers(), because GetChildren() gets everything including non-player objects, even if you don't use Players for storage (and you shouldn't be) you should still use GetPlayers(), and please don't use wait() as your loop's condition

0

thanks!

0

That was a really good explanation incapaxian, you beat me to it oof.