Creating a server searching function

So i’m working on a multiplayer game and i want to make a game searcher like in most multiplayer games. What I want is that the game will take you(the player looking for a game) and 9 other players searching and put them into a match. The game will then select 1 of the 10 players who were put together and host it on that players network. In this case, I won’t have to host any servers and the servers will only be created when 10 people are selected and put into a que. The que will end when the game selects one player’s network to host the server on in which all 10 players are dumped onto that created server. Anyone can tell me how to make this or show me an explanation. A youtube video will be nice Thx.

some plz reply I need the answers