Ok so I made it so that my you started out on one team but if you were killed then it would take you to the other. And that worked. But then I realized since I wanted the map/players to reset after the round that they would only be on the right team once(the first time they spawned) So this is my script to make it spawn on the blue team every time the round began but it didn't work.
function respawn()
for i,v in pairs(game.Players:GetPlayers()) do
v.Character.Humanoid.Health = 0
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
c:WaitForChild("Humanoid").Died:connect(function()
p.TeamColor = BrickColor.new("Bright Blue")
end)
end)
end)
c:WaitForChild("Humanoid").Died:connect(function()
p.TeamColor = BrickColor.new("Bright Orange")
end)
end
Any help. Thanks

2 comments
Does it make the players change to the orange team instead?
It would usually change them to orange once they die but I dont want that to happen when it resets the map.