UNET Can't spawn object, network server not active...

I am trying to make a player selection, where the player chooses his player from ui buttons and then spawns it. The script is working perfectly for the host player, but not for the connected clients.

    [Command]
    public void CmdSpawnCharacter() {
        ClientScene.RegisterPrefab(PlayerPrefab); 
        var spawn = NetworkManager.singleton.GetStartPosition();
        GameObject newPlayer = (GameObject)Instantiate(PlayerPrefab, spawn.position, spawn.rotation);
        NetworkServer.Destroy(this.gameObject);

        if (this.playerControllerId == 0)
        {
            NetworkServer.SpawnWithClientAuthority(newPlayer, this.connectionToClient);
        }
        if (this.playerControllerId > 0)
        {
            NetworkServer.SpawnWithClientAuthority(newPlayer, this.connectionToServer);
        }

    }

The object is being spawned on the client side, but as soon as it is spawned i get the error

" SpawnObject for RoguePlayer(Clone) (UnityEngine.GameObject), NetworkServer is not active. Cannot spawn objects without an active server.
UnityEngine.Networking.NetworkServer:Spawn(GameObject)
CharacterSelect:CmdSpawnCharacter() (at Assets/Scripts/CharacterSelect.cs:75)
UnityEngine.EventSystems.EventSystem:Update() "

I searched in a lot of places, and mostly all of them said to make the spawn function a [Command], but it is already a command and is still not working.

BUMP - I have the exactly same problem! It’s horrible how bad the support or documentation is on this…

I was having this issue when I was using a script from an external library. I used to write the script in a separate VS project and after I moved it inside the Unity project, it started working. Not sure why, the vs project might be missing references or is not syncing properly with Unity. I also noticed that the Network Channel info was missing in the component when using the external project.