Auto team Join is possible?

Hello, I want make the Auto Join on a Team for my Gmod server but I don’t know if this is possible.

The reason I want to add this, is that many players close the window to choose a team and then do not understand why they are not playing, even if I put a message on the loading screen about to be pressing the F2 key to choose a team not many do.

Sometimes several people are not chosen team and want to play, then I would like to automatically be entered into a team.
The mode is “Prop Hunt”.

This is the menu that appears when they come in, but they close.

// Called on gamemdoe initialization to create teams
function GM:CreateTeams()
	if !GAMEMODE.TeamBased then
	team.SetUp(TEAM_HUNTERS, "Hunters", Color(150, 205, 255, 255))
	team.SetSpawnPoint(TEAM_HUNTERS, {"info_player_counterterrorist", "info_player_combine", "info_player_deathmatch", "info_player_axis"})
	team.SetClass(TEAM_HUNTERS, {"Hunter"})

	team.SetUp(TEAM_PROPS, "Props", Color(255, 60, 60, 255))
	team.SetSpawnPoint(TEAM_PROPS, {"info_player_terrorist", "info_player_rebel", "info_player_deathmatch", "info_player_allies"})
	team.SetClass(TEAM_PROPS, {"Prop"})

Thanks in advance, regards.

Hmm you can add onto the close menu function so that it randoms them a team if they don’t already have one. Although some people go AFK and don’t want to be on a team :blush:

This people can select spectating mode, is the same.

Ugh, people fuck up being able join teams on my fretta server. It’s quite annoying because if they are pressing the close button themselves, it is literally their own fucking fault. Most of the time they don’t listen when you tell them how to solve it either.

If it’s not already, put this inside the fretta shared.lua and see if it helps at all:

GM.AllowAutoTeam = true				// Allow auto-assign?

With Fretta, if you don’t join a team, you’re on TEAM_UNASSIGNED, so you could always do something like OnPreRoundStart to go through players who are on that team and then SetTeam to either 1 or 2, but I’m not quite sure how you’d take autobalance into account and make it so it doesn’t stack all the TEAM_UNASSIGNEDs onto one team. I’m also going to look into removing that close button entirely, I think :v:

haha, you’re absolutely Reason.

But unfortunately that was already well, so it does not work.