When client leaves room they cannot join or create a new room

The game will start and everyone connects to photon without an issue. Any user can create or join a room. However the user that creates the room is free to join or create another room after leaving the first room. The client that joins the room is unable to create or join a room after leaving the first one.

This error is shown: CreateRoom failed. Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster.

I have tried completely disconnecting the user from photon and reconnecting but it just seems to hang at various stages.

If I completely disconnect PhotonNetwork.connectionStateDetailed Shows ConnectingToNameServer

If I just let the player try to join another room without disconnecting I get ConnectingToMasterserver

Any thoughts on what I am doing wrong? The only thing I can think of that is different between the two users is the matchmaking system. Even if the Master client leaves the match and the second client becomes the master they are still unable to join after leaving the room.

Here is my matchmaking code:
public void TryToFindMatch(string matchType)
    {
        bool matchFound = false;
        foreach (RoomInfo game in PhotonNetwork.GetRoomList())
        {


            if (game.CustomProperties.ContainsValue(matchType))
            {
                
                if (game.CustomProperties.ContainsValue("HasNotStarted"))
                {
                    if (game.PlayerCount < 8)
                    {
                        if (game.IsOpen)
                        {
                            Debug.Log("FOUND AVAILABLE ROOM: " + game.Name);
                            matchFound = true;
                            PhotonNetwork.JoinRoom(game.Name);
                            break;
                        }
                      
                    }
                }

            }
        }

        if (matchFound == false)
        {
            Debug.Log("NO GAME FOUND. CREATING... ");

            
            
            RoomOptions roomOptions = new RoomOptions();
            roomOptions.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable();
            roomOptions.MaxPlayers = 8;
            roomOptions.CustomRoomProperties.Add("GameType", gameType);
            roomOptions.CustomRoomProperties.Add("HasStarted", "HasNotStarted");
            roomOptions.CustomRoomPropertiesForLobby = new string[2] { "GameType", "HasStarted" };
         
            roomOptions.CleanupCacheOnLeave = false;
     
            PhotonNetwork.CreateRoom(null, roomOptions, TypedLobby.Default);
            
        }
    }

Answers

This discussion has been closed.