Random Team Spawning.

Hey,

I’ve been tearing my hair for days trying to figure out why so its about time I came and asked.

I have 3 teams setup and a 4th team magically spawns and spawns people in ?




function GM:CreateTeams()
	TEAM_RED = 2
	team.SetUp( TEAM_RED, "Red Team", Color( 160, 70, 70, 255 ), true )
	team.SetSpawnPoint( TEAM_RED, "info_player_terrorist" )

	TEAM_BLUE = 3
	team.SetUp( TEAM_BLUE, "Blue Team", Color( 3, 112, 153, 255 ), true )
	team.SetSpawnPoint( TEAM_BLUE, "info_player_counterterrorist" )
 
	team.SetUp( TEAM_SPECTATOR, "Spectators", Color(70,70,70,255), false )
end



Any ideas? Will provide further code if necessary.

Edit : Also, Just noting this only happens sometimes.

Are you doing Player:SetTeam(2) in GM:PlayerSpawn?

Nope

Edit : I seemed to have fixed it by



function GM:PlayerInitialSpawn( ply )
		ply:SetTeam(TEAM_SPECTATOR)
		ply:Spectate(OBS_MODE_ROAMING)
end


Adding that. But when I had that in before it didn’t work but now it appears to work ;s