I tried the code below but it doesn't work.
for i,v in pairs(game.Players:GetPlayers()) do if v.Character.Humanoid.Health == 0 then v.TeamColor = BrickColor.new("Black") end end