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
The issue to your problem is that you have two functions that determine the team the player joins on death of the humanoid. This causes the "Bright Orange" function to run after the "Bright Blue" function. the easiest way to work around this is to simply replace:
c:WaitForChild(Humanoid).Died:connect(function() p.TeamColor = BrickColor.new("Bright blue") end)
With:
p.TeamColor = BrickColor.new("Bright blue")
"Blue" and "Orange" also cannot be capitalized.