So I'm using this script to determine how many players on a team. It works fine, except I want the script to tell if the number of people on a team changes, and then reacts to that. Can someone please help me?
Here's the script
local team = game.Teams; function getPlayers(teamColor) local found = { }; for _,v in pairs(game.Players:GetPlayers()) do if v.TeamColor == teamColor then table.insert(found, v) end end return #found end while wait() do local greenNum = getPlayers(BrickColor.new('Bright green')) local redNum = getPlayers(BrickColor.new('Bright red')) if greenNum > 0 and redNum > 0 then print('Enough players') else print('Not enough players') end end