,How can I resolve the error “Trying to send command for object without authority.”?

I don’t know what I did wrong I tried couple different ways from not using commands to using SpawnWithClientAuthority. But It either gives build and compile errors or just the Error in the title

Here the Start function of my player object

void Start () {
    player = isLocalPlayer;
    race = Data.races[(int)selectRace].getInstance();
    clss = Data.classes[(int)selectClass].getInstance();
    health = race.Health * clss.HealthMultiplyer;
    speed = race.Speed * clss.SpeedMultiplyer;
    armor = race.Armor * clss.ArmorhMultiplayer;
    energy = race.Energy * clss.EnergyMultiplayer;
    skills.AddRange(race.RaceSkills);
    skills.AddRange(clss.ClassSkills);


        Data.entities.Add(this);

    Debug.Log(isLocalPlayer);


    if (!isLocalPlayer)
        return;
    int enID = Data.entities.IndexOf(this);
    foreach (Skill s in skills)
        s.CmdSpawn(enID);

}

And here is the spawn functions from skills I try to spawn

[Command]
public override void CmdSpawn(int enID)
{
    setEntity(Data.entities[enID]);
    Debug.Log("Spawned");
    dir = getEntity().lookingAt;
    gameObject.transform.position = getEntity().transform.position + dir * 0.65f;
    transform.up = dir;
    NetworkServer.Spawn(gameObject);
}

and

[Command]
public override void CmdSpawn(int enID)
{
    setEntity(Data.entities[enID]);
    dir = getEntity().lookingAt;
    transform.up = dir;
    dir = new Vector3(dir.z, dir.y, -dir.x);
    gameObject.transform.position = getEntity().transform.position + dir * 0.65f;

    NetworkServer.Spawn(gameObject);


}

If you can help, thank you ^.^

You are trying to send command to a object that is not your instantiated prefab ID. So you need to order to give authority and to remove authority after has used it.

//Put authority
assignAuthorityObj.GetComponent<NetworkIdentity>().AssignClientAuthority(this.GetComponent<NetworkIdentity>().connectionToClient);

//Remove authority
 assignAuthorityObj.GetComponent<NetworkIdentity>().RemoveClientAuthority(this.GetComponent<NetworkIdentity>().connectionToClient);

Objects must have been spawned with NetworkServer.SpawnWithClientAuthority or have authority set with NetworkIdentity.AssignClientAuthority. Commands sent from these object are run on the server instance of the object, not on the associated player object for the client,