I Am Really Close On Finishing A Game And I Don't Know How To Find The Amount Of Players On A Team
I need Some Help
I Am Really Close On Finishing A Game And I Don't Know How To Find The Amount Of Players On A Team
I need Some Help
i think this is help u
local Players = game.Players:GetPlayers() -- This Line Get a list of players
local Team = game.Teams.Prisoner -- Put your team in here
local InTeam = {} -- This is the list of Players is on Team Prisoner
for _, Player in pairs(Players) do
if Player.Team == Team then
table.insert(InTeam, Player)
end
end
print(#InTeam)
A simple solution to this is simply:
local players = game.Players:GetPlayers()
print(#players) -- prints the number of players
This discussion is preserved as it was. New answers, comments, and votes are closed.
5 comments
WHY U DONT CHECK UR QUESTION?
WHY U DONT CHECK UR QUESTION?
It was 1 HOUR AGO, maybe they haven't checked it yet.
You also do not need to use tables, :GetPlayers() returns a table, so you can do #players to get the amount of players
but we dont want amount of players it make the code longer