2D Game Pickup Weapon Equip

So the problem I’m having is in a simple 2D style game with the item pickup. I have this script for it:

#pragma strict

//item pickup

var hand : Transform;
var weapon : Transform;

function OnTriggerStay(item : Collider)
{
	if(item.gameObject.tag == "Range" || item.gameObject.tag == "Melee")
	{	
		var name : String = item.gameObject.name;
		weapon = findChild(name, hand);
		if(Input.GetKeyDown(KeyCode.E))
		{
			item.gameObject.SetActive(false);	
			weapon.gameObject.SetActive(true);
		}
	}
	else if (item.gameObject.tag == "PickUp")
	{
		item.gameObject.SetActive(false);
	}
}

function findChild(name : String, hand : Transform)
{
	var childTransforms = hand.GetComponentsInChildren(Transform, true);
	for (var t : Transform in childTransforms)
	{
		if(t.gameObject.name == name)
		{
			return t;
		}
		return null;
	}
}

The problem is I"m trying to access the children of my hand, which is the weapons parent object. It’s not assigning it from the findChild function so the weapon variable isn’t setting an instance of an object. I just want the script to set active the weapon with the same name as the pickup item, which is handgun as is the gun object as child.

So I’m not sure how to fix this. I’m still a big script noob btw lol.

Nevermind, found the fix it was right here:

28.        var childTransforms = hand.GetComponentsInChildren(Transform, true);

just changed to

28.        var childTransforms = hand.GetComponentInChildren(Transform);