Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I check if everyone on a team dies once?

So I wan't to make a team based sword game where if all the players in the opposing team dies the other team will win, so I wan't to know how do I check if everyone on a team has already died once and declare the opposing team the victory.

1 comment

1

Iterate through each team list by using Team:GetPlayers() in conjunction with a pairs loop. Connect a .Died event to each Humanoid. You can set up your own method of keeping record of every death, and checking if all have died.

1 answer

✓ Accepted answer

I mean easy way is if someone dies from the team it will change his team to 'Neutral' or 'Lobby' something like that and then you check if it will find any children in the team, if no then everyone has died. To check it here is example script:

local children = game.Teams.RedTeam:GetChildren() -- change that
if #children == 0 -- if there is no children
	then print("everyone has died this team")
	end

1 comment

0

Thanks for the answer, I changed the GetChildren part to GetPlayers and it seems to be working fine :D

This discussion is preserved as it was. New answers, comments, and votes are closed.