"Trying to send command for object without authority" warning but the object is the localPlayer

I have a script saying that if the player presses a button while in a certain trigger it commands the server to open the door. My player is the local player because I get the debug message kick (see the script) so I really don’t understand what the problem is.

Here is the script for the player :

    private void OnTriggerStay2D(Collider2D other)
    {
        if (other.tag == "Door")
        {
            Door door = other.GetComponent<Door>();
            if (door.closed)
            {
                if (Input.GetButtonDown("Kick") && isLocalPlayer)
                {
                    Debug.Log("kick");
                    door.CmdOpenDoor(transform.position.x);
                }

                if (input.rawPeek > 0)
                {
                    peek(door.GetPeekPos(transform.position.x), transform.position.x > door.transform.position.x);
                }
                if (input.rawPeek < 1 && peeking)
                {
                    stopPeek();
                }
            }
            if (!door.closed && peeking) {
                stopPeek();
            }
        }
    }

    private void OnTriggerExit2D(Collider2D other)
    {
        if (other.tag == "Door")
        {
            other.GetComponent<Door>().CmdClose();
            if (peeking)
            {
                stopPeek();
            }
        }
    }
}

Here is the script for the door :

    [Command]
    public void CmdOpenDoor(float x){
        if (x < doors[0].transform.position.x) {
            RpcOpen(RIGHT);
        }
        if (x > doors[0].transform.position.x) {
            RpcOpen(LEFT);
        }
    }

    [Command]
    public void CmdClose()
    {
        RpcClose();
    }

    [ClientRpc]
    private void RpcOpen (int i) {
        closed = false;
        doors[0].enabled = false;
        closedCollider.enabled = false;
        viewCollider.enabled = false;
        doors*.enabled = true;*

}

[ClientRpc]
public void RpcClose () {
if (closed == false)
{
closed = true;
doors[0].enabled = true;
closedCollider.enabled = true;
viewCollider.enabled = true;
doors.enabled = false;
doors.enabled = false;
}
}
Please help !!

By the way the game works fine on the server but not on the client

The problem is, you’re sending the command from the door. Only because the call is initiated from the localplayer, does not make the method in the door script the local player.
All appearances of all the network attributes like Command have to be on scripts on authorized gameobjects.