Changing the position of an object hit with a RaycastHit

Hey guys so I’m getting sending out a raycast to check if I hit an object with the tag Weapon on it. I then am trying to set the position of the weapon to 0, 0, 0 although for some odd reason it is refusing to work. This is my current code:

hit.transform.tag = "Weapon1";
                        hit.transform.parent = GameObject.Find("WeaponParent").transform;
                        hit.transform.localPosition = new Vector3(0, 0, 0);
                        hasWeapon1 = true;

Instead of getting the object hit and changing the position from that. I changed my code to find the GameObject’s tag which I changed to Weapon1 and then changed the position to 0, 0, 0 from there. Changed code: hit.transform.tag = "Weapon1"; hit.transform.parent = GameObject.Find("WeaponParent").transform; GameObject.FindGameObjectWithTag("Weapon1").transform.localPosition = new Vector3(0, 0, 0);