NetworkServer is not active. Cannot spawn objects without an active server.

I am trying to do some sort of character selection where the client spawns a prefab, but as the client cannot spawn prefabs i made it a [Command] so the server spawns it, but now it says that Network Server is not active whenever i try to spawn.

` [Command]
public void CmdSpawnCharacter() {
var spawn = NetworkManager.singleton.GetStartPosition();
GameObject newPlayer = (GameObject)Instantiate(PlayerPrefab spawn.position, spawn.rotation);

    if (this.playerControllerId == 0)
        NetworkServer.ReplacePlayerForConnection(this.connectionToClient, newPlayer, this.playerControllerId);
    if (this.playerControllerId > 0)
        NetworkServer.ReplacePlayerForConnection(this.connectionToServer, newPlayer, this.playerControllerId);


Did you get this from youtube? (coding i mean) and which script lang. is it?