title: Gun freezes up after one shot then does not work
body: <p>My gun will freeze up after one shot and there are no errors.</p>
  <p>I'm still working on it so no ammo and stuff. I am using <a href="https://assetstore.unity.com/packages/3d/props/guns/modern-guns-handgun-129821" rel="nofollow noreferrer">https://assetstore.unity.com/packages/3d/props/guns/modern-guns-handgun-129821</a>
  as a base model width no code the code is mine.</p>
  <p>Here are the settings:
  <a href="https://i.stack.imgur.com/3feNw.png" rel="nofollow noreferrer">https://i.stack.imgur.com/3feNw.png</a></p>
  <p>Code:</p>
  <pre><code>using UnityEngine;
  
  public class GunScript : MonoBehaviour
  {
      [Header (&quot;Ammo Settings&quot;)]
      public string ReloadTriggerName = &quot;Reload&quot;;
      public int ReloadTime;
      public int ClipSize;
      public int MaxAmmo;
      private int CurrentAmmo;
      public KeyCode ReloadKey = KeyCode.R;
  
      [Header (&quot;Aim Settings&quot;)]
      public KeyCode Aimkey = KeyCode.Mouse1;
      public int TimeToAim;
      public Transform Anchor;
      public Transform Aim;
      public Transform hip;
      [Header (&quot;Mis&quot;)]
      public Animator animator;
      public bool IsAutomatic;
      public int coolDown;
  
      [Header(&quot;basic setting&quot;)]
      public string FireTriggerName = &quot;Fire&quot;;
      public int Damage = 10;
      public Transform gunTip; 
  
      //Script vars
      private bool CanFire = true;
      private bool Reloading = false;
  
      void Start()
      {
          CurrentAmmo = ClipSize;
      }
      void Update()
      {
         if(CanFire)
         {
          if(IsAutomatic)
          {
              if(Input.GetButton(&quot;Fire1&quot;) &amp;&amp; !Reloading &amp;&amp; CurrentAmmo &gt; 0) 
              {
                  Shoot();
                  CanFire = false;
                  Invoke(&quot;ResetCanShoot&quot;, coolDown);
              } 
          } else
          {
              if(Input.GetButtonDown(&quot;Fire1&quot;) &amp;&amp; !Reloading &amp;&amp; CurrentAmmo &gt; 0) 
              {
                  Shoot();
                  CanFire = false;
                  Invoke(&quot;ResetCanShoot&quot;, coolDown);
              }
          }
  
          AimGun(Input.GetKey(Aimkey));
  
          if(Input.GetKeyDown(ReloadKey) &amp;&amp; CurrentAmmo &gt; ClipSize)
          {
              
          }
  
          }
      }
      void Shoot()
      {
          animator.SetTrigger(FireTriggerName);
           CurrentAmmo = CurrentAmmo - 1;
  
           //Shoot
           print(&quot;Pew&quot;);
           RaycastHit hit;
           if (Physics.Raycast(gunTip.position, gunTip.transform.forward, out hit))
           {
              
               Debug.Log(hit.transform.name);
  
               ZombieHealth zombieHealth = hit.transform.GetComponent&lt;ZombieHealth&gt;();
               if(zombieHealth != null)
               {
                   zombieHealth.TakeDamage(Damage);
               }
           }
      }
  
      void AimGun(bool isAiming)
      {
          if(isAiming)
          {
              Anchor.position = Vector3.Lerp(Anchor.position, Aim.position, Time.deltaTime * TimeToAim);
          } else
          {
              Anchor.position = Vector3.Lerp(Anchor.position, hip.position, Time.deltaTime * TimeToAim);
          }
      }
  
  
  
      void ResetCanShoot()
      {
          CanFire = false;
      }
  }
  </code></pre>