Since My last Idea Isn't Working To Find When Someone Dies On A Team, I made so when someone dies They Change Team, So I Have to Detect The Amount Of Player On a team Reach 0, Something Triggers. But I Don't Know How To Do It
Here Is The Script I Have But The Only Problem is That It gets the amount on ALL Teams Not Just The one I want
wait(20) local teams = game:GetService("Teams"):GetTeams("Leader") for _, team in pairs(teams) do local players = team:GetPlayers() print("Team " .. team.Name .. " has " .. #players .. " players") local Players = #players local LO = game.Workspace.Palace.LeaderSign.Folder print(Players) if Players == 0 then script.Parent.LeaderTeamChanger.Disabled = false print("Leader Died") script.Parent.PlaceHolder.Value = script.Parent.Leader.Value script.Parent.Leader.Value = LO.NL1.Value LO.NL2.Value = LO.NL3.Value LO.NL3.Value = LO.NL4.Value LO.NL4.Value = LO.NL5.Value LO.NL5.Value = LO.NL6.Value LO.NL6.Value = LO.NL7.Value LO.NL7.Value = LO.NL8.Value LO.NL8.Value = LO.NL9.Value LO.NL9.Value = LO.NL10.Value LO.NL10.Value = script.Parent.PlaceHolder.Value script.Parent.PlaceHolder.Value = "Blank" script.Parent.LeaderTeamChanger.Disabled = true end end
It would be easier to do
if #players == 0 then
then converting the number of players into a variable.