MODERATORS PLS DELETE QUESTIONS WITH MEANINGLESS TITLES.

This won’t work for some reason, it doesn’t come up with any errors, it just only works until i switch weapons?

var Player : GameObject;
var Arms : GameObject;

var Ak74uShot : GameObject;
var AcrwShot : GameObject;
var KnifeShot : GameObject;

var Ak74uRange : int = 125;
var AcrwRange : int = 100;
var KnifeRange : float = 0.75;

var WeaponInt;



function Start ()
{
	
	
	
}

function Update ()
{
	var Ak74uRay : RaycastHit;
	var AcrwRay : RaycastHit;
	var KnifeRay : RaycastHit;
	
	var WeaponInt = Player.GetComponent("Weapon Switch").GunEquipped;
	
	
	
	if (WeaponInt == 1)
	{
		if (Input.GetMouseButton(0))
		{
			Arms.animation.CrossFade("Rifle Recoil");
			if (Physics.Raycast(Ak74uShot.transform.position, Ak74uShot.transform.forward, Ak74uRay, Ak74uRange))
			{
				Debug.Log ("AK74U Fired");
			}
		}
	}
	
	if (WeaponInt == 2)
	{
		if (Input.GetMouseButton(0))
		{
			Arms.animation.CrossFade("Rifle Recoil");
			if (Physics.Raycast(AcrwShot.transform.position, AcrwShot.transform.forward, AcrwRay, AcrwRange))
			{
				Debug.Log ("ACR-W Fired");
			}
		}
	}
	
	if (WeaponInt == 3)
	{
		if (Input.GetMouseButton(0))
		{
			if (Physics.Raycast(KnifeShot.transform.position, KnifeShot.transform.forward, KnifeRay, KnifeRange))
			{
				Debug.Log ("Melee");
			}
		}
	}
	
	
	
}

What is the value of WeaponInt after calling:

var WeaponInt = Player.GetComponent("Weapon Switch").GunEquipped;

If it isn’t one of the values youve stated then it wont do anything until you switch.

Also talking about switches, here is a good example of using switches instead of if statements like so:

switch(WeaponInt) {
    case 1:
    if (Input.GetMouseButton(0))
       {
         Arms.animation.CrossFade("Rifle Recoil");
         if (Physics.Raycast(Ak74uShot.transform.position, Ak74uShot.transform.forward, Ak74uRay, Ak74uRange))
         {
          Debug.Log ("AK74U Fired");
         }
       }
    break;
    case 2:
    if (Input.GetMouseButton(0))
       {
         Arms.animation.CrossFade("Rifle Recoil");
         if (Physics.Raycast(AcrwShot.transform.position, AcrwShot.transform.forward, AcrwRay, AcrwRange))
         {
          Debug.Log ("ACR-W Fired");
         }
       }
    break;
    case 3:
    if (Input.GetMouseButton(0))
       {
         if (Physics.Raycast(KnifeShot.transform.position, KnifeShot.transform.forward, KnifeRay, KnifeRange))
         {
          Debug.Log ("Melee");
         }
       }
    break;
    default:
    // HERE IS WHERE YOU ADD A DEFAULT CASE I.E. What do you want to happen if WeaponInt is not 1,2 or 3
    break;
}