Alright, so I am trying to write a script that detects when a player joins a team. In this case, the team is called 'Clocktower'. There is a NumberValue that I stuck in there so that when a player joins that team, it adds 1 to that value. Then it would initiate the bottom part of the script. Where once it detects that a player has joined that team, it would start the repeat function until there are no more people in that team. Then, it would set the health of a humanoid in workspace to 0. I am uncertain if I can use the PlayerAdded function for teams or if I am using it correctly at all. If there is an easier way to do this, please do no hesitate. Go easy on me, I am still a beginner level scripter and I am only just learning some of the more advanced 'keywords.'
game.Teams.Clocktower.PlayerAdded:connect(function(player)
game.Teams.Clocktower.NumberValue.Value = game.Teams.Clocktower.NumberValue.Value + 1
end)
game.Teams.Clocktower.PlayerRemoved:connect(function(player)
game.Teams.Clocktower.NumberValue.Value = game.Teams.Clocktower.NumberValue.Value - 1
end)
if game.Teams.Clocktower.NumberValue.Value == 1 then
repeat
wait(1)
until game.Teams.Clocktower.NumberValue.Value == 0
if game.Teams.Clocktower.NumberValue.Value == 0 then
game.Workspace.Humanoid.Health = 0
end
end

4 comments
Can you be more specific? I am aware of the player.TeamColor command, but how would that help me here?
Well, you should use player.TeamColor.Changed, because there is no PlayerAdded in a team.
Oh ok. I will try that and see how it goes! :)
Did it work? If so can you accept my answer? It gives us both rep!