sheath unsheath weapon

I was on reddit and found this code:

  if (Input.GetKeyDown(KeyCode.Z)&& isLocalPlayer)
            {
                weapon.SetActive(weapon.activeSelf);
                sheathedweapon.SetActive(!sheathedweapon.activeSelf);
            }
            if (Input.GetKeyDown(KeyCode.Z)&& isLocalPlayer)
            {
                weapon.SetActive(!weapon.activeSelf);
                sheathedweapon.SetActive(sheathedweapon.activeSelf);
            }

however this isn’t syncing over the network. what can I do to make this object flip positions on the network?

this actually ended up becoming a huge project that me and a friend worked on. it works nicely tho.

 public void CloseAll()
    {
        onehandmainhandsheath.SetActive(false);////somewhere the object assigned to this, is getting deleted refesh location?//it might have the wrong pobject assigned to it
        onehandoffhandsheath.SetActive(false);
        twohandmainhandsheath.SetActive(false);//refresh location doesnt access this directly all references below it's a 2h and it's throwing error on 1h
        twohandoffhandsheath.SetActive(false);//im just talking here, still talkign about 1840


        twohandmainhandgunsheath.SetActive(false);
        onehandmainhandgunsheath.SetActive(false);
        twohandoffhandgunsheath.SetActive(false);
        onehandoffhandgunsheath.SetActive(false);
        staffsheath.SetActive(false);
        bowsheath.SetActive(false);

        shieldsheath.SetActive(false);

        //ran ouit of room ^^^^^^ lol  so the object assigned in editor to onehandmainsheath
    }
    public bool combatMode = true;//is being deleted by refreshlocation or even somewhere else
    public string mainHandAni;
    public string offHandAni;


    [Server]
    public void ServerToggleCombat(bool combatActive, bool playAni)//cant call a command from server, only client so server for when server calls this
    {
        RpcToggleCombat(combatActive, playAni);
    }
    [Command]
    public void CmdToggleCombat(bool combatActive, bool playAni)//i realized that refreshlocation is a client rpc, but not when we toggle ourselves so we make an rpc for that case
    {
        RpcToggleCombat(combatActive, playAni);
    }
    [ClientRpc]
    public void RpcToggleCombat(bool combatActive, bool playAni)
    {
        combatMode = combatActive;
        if (combatMode)
        {
            if (player.equipment.slots[22].amount != 0)
            {
                foreach (Animator animator in GetComponentsInChildren<Animator>())
                {
                    animator.SetBool("closeRight", true);
                }

            }
            else
            {
                foreach (Animator animator in GetComponentsInChildren<Animator>())
                {
                    animator.SetBool("closeRight", false);
                }
            }
            if (player.equipment.slots[23].amount != 0)
            {
                foreach (Animator animator in GetComponentsInChildren<Animator>())
                {
                    animator.SetBool("closeLeft", true);
                }
            }
            else
            {
                foreach (Animator animator in GetComponentsInChildren<Animator>())
                {
                    animator.SetBool("closeLeft", false);
                }
            }
        }
        else
        {
            foreach (Animator animator in GetComponentsInChildren<Animator>())
            {
                animator.SetBool("closeRight", false);
                animator.SetBool("closeLeft", false);
            }
        }
        if (playAni)
        {
            PlayAnimation();
        }
        StartCoroutine(DelayedToggle(combatActive));
    }


    public void ToggleCombat(bool combatActive, bool playAni)///okay all cases solved, it should be networked 100% lets ctext animation issue
    {
        combatMode = combatActive;

        if (combatMode)
        {
            if (player.equipment.slots[22].amount != 0)
            {
                foreach (Animator animator in GetComponentsInChildren<Animator>())
                {
                    animator.SetBool("closeRight", true);
                }

            }
            else
            {
                foreach (Animator animator in GetComponentsInChildren<Animator>())
                {
                    animator.SetBool("closeRight", false);
                }
            }
            if (player.equipment.slots[23].amount != 0)
            {
                foreach (Animator animator in GetComponentsInChildren<Animator>())
                {
                    animator.SetBool("closeLeft", true);
                }
            }
            else
            {
                foreach (Animator animator in GetComponentsInChildren<Animator>())
                {
                    animator.SetBool("closeLeft", false);
                }
            }
        }
        else
        {
            foreach (Animator animator in GetComponentsInChildren<Animator>())
            {
                animator.SetBool("closeRight", false);
                animator.SetBool("closeLeft", false);
            }
        }
        if (playAni)
        {
            PlayAnimation();
        }
        StartCoroutine(DelayedToggle(combatActive));
    }
    public void PlayAnimation() //play animation before actual swap
    {
        mainHandAni = "";
        offHandAni = "";

        //mainhand
        if (player.equipment.slots[22].amount != 0)
        {// when we check 1 or 2 hand, its not gonna care what hand we want
            if (player.equipment.isa1h(player.equipment.slots[22])) { mainHandAni = "1MainHand"; }//use these names for singular animations
            if (player.equipment.isa2h(player.equipment.slots[22])) { mainHandAni = "2MainHand"; }
            if (player.equipment.isa1hgun(player.equipment.slots[22])) { mainHandAni = "1MainHandGun"; }//use these names for singular animations
            if (player.equipment.isa2hgun(player.equipment.slots[22])) { mainHandAni = "2MainHandGun"; }
            if (player.equipment.isastaff(player.equipment.slots[22])) { offHandAni = "Staff"; }
        }
        //offhand
        if (player.equipment.slots[23].amount != 0)
        {
            if (player.equipment.isa1h(player.equipment.slots[23])) { offHandAni = "1OffHand"; }//offhandfromhilt
            if (player.equipment.isa2h(player.equipment.slots[23])) { offHandAni = "2OffHand"; }//offhandfromback
            if (player.equipment.isa1h(player.equipment.slots[23])) { offHandAni = "1OffHandGun"; }//offhandfromhilt
            if (player.equipment.isa2h(player.equipment.slots[23])) { offHandAni = "2OffHandGun"; }
            if (player.equipment.isashield(player.equipment.slots[23])) { offHandAni = "Shield"; }
        }

        Debug.Log(mainHandAni + ":main    " + offHandAni + ":offhand      before changing into mix");

        if (mainHandAni != "" && offHandAni != "")
        {
            if (mainHandAni == "1MainHand" && offHandAni == "1OffHand") { mainHandAni = "MixHilts"; offHandAni = ""; }//1
            else if (mainHandAni == "2MainHand" && offHandAni == "2OffHandGun") { mainHandAni = "MixBackBack"; offHandAni = ""; }

            else if (mainHandAni == "1MainHand" && offHandAni == "2OffHandGun") { mainHandAni = "MixHiltBack"; offHandAni = ""; }//2
            else if (mainHandAni == "2MainHand" && offHandAni == "1OffHandGun") { mainHandAni = "MixBackHilt"; offHandAni = ""; }//3

            else if (mainHandAni == "1MainHand" && offHandAni == "Shield") { mainHandAni = "MixHiltShield"; offHandAni = ""; }
            else if (mainHandAni == "2MainHand" && offHandAni == "Shield") { mainHandAni = "MixBackShield"; offHandAni = ""; }

            if (mainHandAni == "1MainHandGun" && offHandAni == "1OffHandGun") { mainHandAni = "MixHilts"; offHandAni = ""; }//1
            else if (mainHandAni == "2MainHandGun" && offHandAni == "2OffHandGun") { mainHandAni = "MixBackBack"; offHandAni = ""; }

            else if (mainHandAni == "1MainHandGun" && offHandAni == "2OffHand") { mainHandAni = "MixHiltBack"; offHandAni = ""; }//2
            else if (mainHandAni == "2MainHandGun" && offHandAni == "1OffHand") { mainHandAni = "MixBackHilt"; offHandAni = ""; }//3

            else if (mainHandAni == "1MainHandGun" && offHandAni == "Shield") { mainHandAni = "MixHiltShield"; offHandAni = ""; }
            else if (mainHandAni == "2MainHandGun" && offHandAni == "Shield") { mainHandAni = "MixBackShield"; offHandAni = ""; }
            offHandAni = "";
        }
        Debug.Log(mainHandAni);
        foreach (Animator animator in GetComponentsInChildren<Animator>())
        {
            if (mainHandAni != "")
            {
                animator.SetTrigger(mainHandAni);
            }
            if (offHandAni != "")
            {
                animator.SetTrigger(offHandAni);//use triggers
            }
        }//this might be the way lmao
    }
    IEnumerator<WaitForSeconds> DelayedToggle(bool combatActive)
    {
        yield return new WaitForSeconds(0.6f);//give time for animation to play ^^
        combatMode = combatActive;
        if (combatMode)
        {
            mainhand.SetActive(true);
            offhand.SetActive(true);



            CloseAll(); //just close all 
        }
        else
        {
            mainhand.SetActive(false);
            offhand.SetActive(false);
            CloseAll(); //always close all, so we can only set true what we do have   //its checking slots before theyreefreshlocation

            if (player.equipment.slots[22].amount != 0 || player.equipment.slots[23].amount != 0)
            {
                //mainhand
                if (player.equipment.slots[22].amount != 0)
                {
                    //close right hand

                    if (player.equipment.isa1h(player.equipment.slots[22])) { onehandmainhandsheath.SetActive(true); }
                    if (player.equipment.isa2h(player.equipment.slots[22])) { twohandmainhandsheath.SetActive(true); }
                    if (player.equipment.isastaff(player.equipment.slots[22])) { staffsheath.SetActive(true); }
                    if (player.equipment.isa2hgun(player.equipment.slots[22])) { twohandmainhandgunsheath.SetActive(true); }
                    if (player.equipment.isa1hgun(player.equipment.slots[22])) { onehandmainhandgunsheath.SetActive(true); }
                    if (player.equipment.isa2hgun(player.equipment.slots[22])) { bowsheath.SetActive(true); }
                }
                //offhand
                if (player.equipment.slots[23].amount != 0)
                {
                    if (player.equipment.isa1h(player.equipment.slots[23])) { onehandoffhandsheath.SetActive(true); }
                    if (player.equipment.isa2h(player.equipment.slots[23])) { twohandoffhandsheath.SetActive(true); }
                    if (player.equipment.isa1h(player.equipment.slots[23])) { onehandoffhandgunsheath.SetActive(true); }
                    if (player.equipment.isa2h(player.equipment.slots[23])) { twohandoffhandgunsheath.SetActive(true); }
                    if (player.equipment.isashield(player.equipment.slots[23])) { shieldsheath.SetActive(true); }
                }
            }
        }
    }