I've been trying to figure this out for about 5 hours and I can't get it no matter what I try. How would I get player's names that are only on one team? For example: List the names of the players on the red team, and list the names of the players on the blue team.
Can anyone help? It's driving me insane.
function getplayers(teamname) local list = {} local p = game.Players:GetPlayers() local team = game.Teams[teamname].TeamColor for i = 1,#p do if p[i].TeamColor == team then table.insert(list, p[i].Name) end end return(table.concat(list,", ") end print(getplayers("Blue Team"))
this will give you a string list of players on a team.