game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
print(player.Team.Name)
if player.Team.Name == "Blue" then
player.Team = game.Teams:WaitForChild("Red")
else
player.Team = game.Teams:WaitForChild("Blue")
wait(0.5)
end
end)
end)
end)
I made this script is so that when a players dies it will switch the player to the other team. In this case when the player dies on blue then he will be switched to red , vice versa.
But when I die it runs , the problem is that the output gives me this error "Infinite yield possible on 'Teams:WaitForChild("Blue")"
The line 6 and 9 line is to change or set the players team , could there be anything wrong there?

4 comments
It still doesnt change but just gives me the same infinite yield error.
That's weird.
That's weird.
Nvm I found another method its about remote events thanks anyways!