Multiplayer Network Problem

Hello. I looked up a tutorial online for how to make game servers, but when I tried putting 2 accounts in one game server it didn’t seem to work. Each account was in a different server (at least thats what I think). Can someone please take a look at my code and tell me what I’m doing wrong. Also, I think the problem may be with the port forwarding. I know that the Unity port for Master Server is 23466, but in the tutorial the guy used a random one so I didn’t think it made a difference. Thanks in advance! :slight_smile:

using UnityEngine;
using System.Collections;
using System;

public class connectionsetup : MonoBehaviour {

	private string serverName = "", maxPlayers = "2", port = "23456";
	
	private void OnGUI()
	{
		if(Network.peerType == NetworkPeerType.Disconnected)
		{
		GUILayout.Label("Server Name");
			if(GUILayout.Button("Server 1"))
			{
				serverName = "Server 1";
				try
				{
					Network.InitializeSecurity();
					Network.InitializeServer(int.Parse(maxPlayers), int.Parse(port), !Network.HavePublicAddress());
					MasterServer.RegisterHost("My RPG Server 1", serverName);
					HostData[] data = MasterServer.PollHostList();
					foreach(HostData c in data)
					{
						Network.Connect(c);
						Application.LoadLevel("game");
					}
				}
				catch(Exception)
				{
					print("Please type in numbers for Port and Max Players");
				}
			}
		}
	}
}

You can not start a server instance and then connect to another one.
You need to sepperate the client from the server code.
And there is a networking section in this forum where you could have posted this.