Update a Max Players Text

(before yall say anything ik the scaling on the UI is broke)
I want the “1/8” to display the amount of players on that team. Ive tried one way but its not efficent enough which was a while loop. Ive got a lot of teams, so I need it to happen as soon as the team numbers update.

Resources:
RecieveTeamAmount function
MaxMembers value
image

You can use a remote or some other signal to call a subprogram, and use the method of the teams to get the number of players.

local teams = game:GetService("Teams")

--then...
for _, team in next, teams:GetTeams(), nil do
    local playersNum = #team:GetPlayers()
    print(`{playersNum} Players are on the {team.Name} Team.`)
end

hol on, team:GetPlayers() is a thing?

yeah, it returns all the players on that team.