I want it so when a player leaves a game it checks to see if a team has no players so it Clones a item. i have done this so far
local players = team:GetPlayers() game.Players.PlayerRemoving:connect(function(player) if game.Teams.Slot1.Players == 0 then game.Lighting.Start:Clone().Parent = game.Workspace end end
But i am no good with team
I think you would have to create a function that loops through all the players and checks what team they are on.
Here is a simple one:
function getNumOfPlayersInTeam(BColor) local total = 0 for i,v in pairs(game.Players:GetPlayers()) do if v.TeamColor == BColor then total = total + 1 end end return total end
so now, you would just do something like this:
if getNumOfPlayersInTeam(game.Teams.Slot1.TeamColor) == 0 then -- bla bla bla end