This is printing out nil, why?
team:GetPlayers()
returns an array of player instances belonging to that team instance, you need to iterate over that array instead.
for _, teamPlayer in pairs(team:GetPlayers()) do
Additionally, instead of game.Teams:GetChildren()
you can use game.Teams:GetTeams()
to get an array of teams.
https://developer.roblox.com/en-us/api-reference/function/Teams/GetTeams
1 Like