FPSPlayer script not seeing weapon

I am using unity 3.3 and I am using the FPS tutorial. The tutorial works, but I decided to make the rocket launcher display the ammo in numbers just like the machine gun does. The problem is that when I switch weapons, it always shows the ammo for the rocket launcher.

Here is where the problem is. I think the two if statements below aren’t working right because the rocket launcher part is always executed. Can someone show me how to fix this? Thanks.

function UpdateGUI () {
// Update health gui
// The health gui is rendered using a overlay texture which is scaled down based on health
// - Calculate fraction of how much health we have left (0...1)
var healthFraction = Mathf.Clamp01(hitPoints / maximumHitPoints);

// - Adjust maximum pixel inset based on it
healthGUI.pixelInset.xMax = healthGUI.pixelInset.xMin + healthGUIWidth * healthFraction;

// Update machine gun gui
// Machine gun gui is simply drawn with a bullet counter text
if (machineGun) {
	bulletGUI.text = machineGun.bulletsLeft.ToString();
	clipGUI.text = machineGun.clips.ToString();
}

// Update rocket gui
// This is changed from the tutorial PDF. You need to assign the 20 Rocket textures found in the GUI/Rockets folder
// to the RocketTextures property.
if (rocketLauncher)	{
	//rocketGUI.UpdateRockets(rocketLauncher.ammoCount);
	bulletGUI.text = rocketLauncher.ammoCount.ToString();
}

}

I had to be able to access the var from another script to make this work. I was using GetComponent and apparently I should have been using GetComponentInChildren. Now it works. Here it is.

var wep = GetComponentInChildren(PlayerWeapons); //This part drove me insane to find out

switch (wep.weaponType){
case 0: 
 // display machineGun ammo
	bulletGUI.text = machineGun.bulletsLeft.ToString();
	clipGUI.text = machineGun.clips.ToString();
  break;
case 1:
  // display rockets
	bulletGUI.text = rocketLauncher.ammoCount.ToString();
  break;

}