How can i summon an object over the network?

i got my multiplayer game going but i cant seem to summon object over network.
this is my script:

using UnityEngine;
using UnityEngine.Networking;

public class networkspawn : NetworkBehaviour {
public GameObject prefab;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

if (Input.GetKey(KeyCode.Space))
{
CmdSummon(prefab, transform.position, Quaternion.identity);
}
}

[Command]public void CmdSummon(GameObject summonedprefab, Vector3 position, Quaternion rotation)
{
GameObject go = Instantiate(summonedprefab, position, rotation);
NetworkServer.Spawn(go);
Destroy(go, 10);
}
}

it works for the host but on client i get the error “trying to send command for object without authority.”
if i use network.instantiate i get the error “failed network.instantiate because we are not connected.”

any ideas?

You can search for the errors you get and find some answers that may help you out:

https://www.reddit.com/r/Unity3D/comments/4ts6u4/trying_to_send_command_for_object_without/
https://www.reddit.com/r/Unity3D/comments/4bwjps/unet_trying_to_send_command_for_object_without/