Team Swapping?

So, I’ve been trying and trying to make a working reliable swap system for a gamemode im creating. Bassicly, it
puts you in some sort of “queue”, and at the end of the round, the player on top of the queue gets added to a specific team.
I was just wondering if this is possible at all? I’ve looked all over the wiki/forums and youtube too, but without luck.
Thanks in advance,

Yeah, it’s possible.

Any idea how I could achieve this?

Fretta sounds like the way to go on this one.