I have absolutely no idea, so there's no code.
✓ ANSWER ACCEPTED
How do you find the amount of players on a team?
2 answers
✓ Accepted answer
for i,v in pairs(game.Players:GetChildren()) do
local NumTeam = 0
if v.TeamColor = BrickColor.new("Bright red") then
NumTeam = NumTeam + 1
end
end
script.Parent.Text = "There are "..NumTeam.." players on the Red team."
local function GetPlayerCountFromTeam(teamname)
local counter = 0
local team = game.Teams:FindFirstChild(teamname)
if team then
local players = game.Players:GetChildren()
for count = 1, #players do
if players[count].TeamColor == team.TeamColor then
counter = counter + 1
end
wait()
end
end
return counter
end
local amount = GetPlayerCountFromTeam("YOURTEAMNAME")
Try that.
This discussion is preserved as it was. New answers, comments, and votes are closed.
