Network Problem!

Hello so i want to make multiplayer game but after i start the server if i connect once from the client all works fine but if i disconnect, at reconnecting the game spawns a new player before i hit spawn and it only can be see it on the client part. Any suggestions tips why it doesn’t work? Here is my code:

using UnityEngine;
using System.Collections;

public class NetworkManager : MonoBehaviour {

    public GameObject Player;
    public Camera MainMenuCamera;
    GameObject DestroyMe;
    public bool connected = false;

    public string connectionIP = "127.0.0.1";
    public int connectionPort = 25001;

  
    void OnGUI()
    {
        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            GUI.Label(new Rect(10, 10, 300, 20), "Status: Disconnected");
            if (GUI.Button(new Rect(10, 30, 120, 20), "Client Connect"))
            {
                Network.Connect(connectionIP, connectionPort);
                connected = true;
            }
            if (GUI.Button(new Rect(10, 50, 120, 20), "Initialize Server"))
            {
                Network.InitializeServer(2, connectionPort, true);
                connected = true;
            }
        }
        else if (Network.peerType == NetworkPeerType.Client)
        {
            GUI.Label(new Rect(10, 10, 300, 20), "Status: Connected as Client");
            if (GUI.Button(new Rect(10, 30, 120, 20), "Disconnect"))
            {
                Network.Destroy(DestroyMe);
                MainMenuCamera.enabled = true;
                Network.Disconnect();
            }
        }
        else if (Network.peerType == NetworkPeerType.Server)
        {
            GUI.Label(new Rect(10, 10, 300, 20), "Status: Connected as Server");
            if (GUI.Button(new Rect(10, 30, 120, 20), "Disconnect"))
            {
                Network.Destroy(DestroyMe);
                MainMenuCamera.enabled = true;
                Network.Disconnect();
            }
        }

        // Spawner   
        if (connected && GUI.Button(new Rect(10,50, 120, 20), "Click to Spawn!"))
        {
        DestroyMe = Network.Instantiate(Player, transform.position, transform.rotation, 0) as GameObject;
        MainMenuCamera.enabled = false;
        connected = false;
        }
    }
}

Script seems alright, even though the boolean ‘connected’ is set to false while you’re still connected, you’re using it to determine whethe the player has spawned. I’d suggest you to use an enum for this instead. To avoid confusion.