Parent mesh problem

I made a video to show what excacly happens. You can see me dragging the 2 weapons into the hierarchy, they appear in the scene. Then when I click on the play button, I show you where the 2 weapons are located at the beginning of the game and I show you what happens if I scroll down. When I scroll down the Axe scales way down but stays at the same position.

Click here for Video here

Here follows the code:

#pragma strict

public var weapons : GameObject[];

private var currentw : int;
private var nmrweapons : int;
private var weaponslot : Transform;

function Start () {

weaponslot = transform.Find("male_model@Idle/male_model/malemodel|forearm.R.001/malemodel|hand.R/Empty_weapon");
weapons = GameObject.FindGameObjectsWithTag("Weapon");
currentw = 0;
nmrweapons = weapons.Length;

function Update () {

if(Input.GetAxis("Mouse ScrollWheel")<0) {

	if(currentw == nmrweapons){
	currentw = 0;
	currentw = 1;

function Changeweapon(cw:int){

weapons[cw].transform.parent = weaponslot;
weapons[cw].transform.localPosition =;
weapons[cw].transform.localRotation = Quaternion.identity;
weapons[cw].transform.localScale =;


I really do not understand anymore what to do, I’ve tried loads of things. But I just do not have enough knowledge of coding, so I really do need someone to explain me, why its doing what its doing. I am still new at coding so it’s probably a dumb mistake.

Thanks in advance

The row:

 weaponslot = transform.Find("male_model@Idle/male_model/malemodel|forearm.R.001/malemodel|hand.R/Empty_weapon");

fails, because the name is wrong ( …@Idle/malemodel/…) then weaponslot is null

this row:

weapons[cw].transform.parent = weaponslot;

is weapons[cw].transform.parent = null;