Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would i print how many objects are there?

Hello, fellas. So i've been doing a script lately on a 'victory' GUI. It would be complicated to explain the whole function of the Interface but there's a line that i couldn't figure out. I can't really find the right term for it and i wasn't able to find any results on Google about this(since i don't know how to explain this)

So i wanted to know how would i print how many people are there on the specific team? so i tried doing alot of process but nothing seems to work.

i tried doing:

local a = tonumber(game.Teams.Muscovy:children())

print(a)

But even if i'm in the team it prints "nil"

Anybody have time to state it?

1 comment

0

:children() is not a function. I think you mean :GetChildren()

1 answer

✓ Accepted answer
local a = game.Teams.Muscovy:GetChildren()

print(#a)

If you put a # sign before the variable it will print the number of the given objects

2 comments

0

Wonderful! I just changed the :GetChildren to a :GetPlayers() which it worked fantastic when i added your print(#a)!

0

No problem

This discussion is preserved as it was. New answers, comments, and votes are closed.