Called when a player has changed team using Player:SetTeam.
Avoid calling Player:SetTeam in this hook as it may cause an infinite loop!
Print the old Team name and the new Team name of players
hook.Add("PlayerChangedTeam", "PrintOldAndNewTeam", function(ply, oldTeam, newTeam) PrintMessage(HUD_PRINTTALK, ply:Nick() .. " switched from " .. team.GetName(oldTeam) .. " to " .. team.GetName(newTeam)) end)
Output: Player1 switched from Team1 to Team2