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

wont count the amount of players on this team. can you help me?

Asked by 5 years ago
local teams = game:GetService("Teams"):GetTeams()
for _, team in pairs(teams) do
    local players = game.Teams.Playing:GetPlayers()
    print(players)
end

I just need to check how many people are on the players team, but when i run this code it spits out this: table: 38F02E78 I have no idea what is going on.

0
GetPlayers returns an array. You can use the # to get the lenght of that array ie print(#players) User#5423 17 — 5y

1 answer

Log in to vote
0
Answered by
gullet 471 Moderation Voter
5 years ago

GetPlayers() returns a table of the players, you can get the length of the table (the amount of elements in it) by doing #table. So you could print the amount of players in the team with print(#players).

0
thanks! SodaZere 31 — 5y
Ad

Answer this question