Cannot create a room.

Options
I want to create a room in a lobby, and I have a button in unity which is meant to do so, however on pressing the button it does nothing, despite the button having definitely been pressed, and upon pressing the button for a second time I get the error:

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

But I have used the function OnJoinedLobby() to make sure that I am indeed in a lobby, and OnConnectedToMaster to make sure I am connected! What is going on? What Am I doing wrong?


Here is my code:

{
[SerializeField] private string VersionName = "0.1";
public TMP_InputField UsernameInput;
public TMP_InputField CreateGameInput;
public TMP_InputField JoinGameInput;
public GameObject StartButton;



public void StartGame()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);

}


public void QuitGame()
{
Application.Quit();
}

private void Awake()
{
PhotonNetwork.ConnectUsingSettings(VersionName);
}
private void OnConnectedToMaster()
{
PhotonNetwork.JoinLobby(TypedLobby.Default);
Debug.Log("Connected");
}

public void CheckUsername()
{
if (UsernameInput.text.Length >= 3)
{
StartButton.SetActive(true);
}
else
{
StartButton.SetActive(false);
}
}

public void SetUserName()
{
PhotonNetwork.playerName = UsernameInput.text;
}

public void CreateGame()
{
PhotonNetwork.CreateRoom(CreateGameInput.text, new RoomOptions() { MaxPlayers = 5 }, null);
Debug.Log("Creating");
}

public void JoinGame()
{
RoomOptions roomOptions = new RoomOptions();
roomOptions.MaxPlayers = 5;
PhotonNetwork.JoinOrCreateRoom(JoinGameInput.text, roomOptions, TypedLobby.Default);
}

private void OnCreateRoom()
{
Debug.Log("ConnectedPlayer");
PhotonNetwork.LoadLevel("GameScene");
}
void OnJoinedLobby()
{
Debug.Log("joinedLobby");
}
}