Rapid Fire Through UI Buttons issue

since i’m a newbie i’m having a issue with ui buttons logic the problem is if i simpy use the statment
if(Input.GetButton(“Fire1”)) in the Update statement everything is working fine means the enemy is taking the damage on the continuous firing but when i convert this to a (public function Fire ) so i can use through a Ui fire button using " event trigger " for an andriod platform then the problem occurs that enemy is not taking any damage on continous firing

@nikigmi sorry for the inconvenience here’s the code

    function Update(){

          if(firing==true){
         Fire();
      }

           }



       public function Fire(){


         firing=true;


    if(AK47Ammo.CurrentAmmo>=1)

    {
            if(Firing==0)
        {
        AK47Firing();
        }
            }
        }

 public function notFiring(){
 firing=false;
  }



function AK47Firing()
{
        nextFire=Time.time+fireRate;

        anim.SetBool("Fire",true);

    AK47Ammo.CurrentAmmo -= 1;


        gunSound.Play();
        Flash.SetActive(true);
    (MuzzleOff());
        var hitShot:RaycastHit;
    if(Physics.Raycast(transform.position,transform.TransformDirection(Vector3.forward)*100,hitShot))
        {

  hitShot.transform.SendMessage("DeductPoints",DamageAmount,SendMessageOptions.DontRequireReceiver );    
        }                
}

         function MuzzleOff()
        {
                                   Firing=1;

            yield WaitForSeconds(0.2);
            Firing=0;
            var ps: ParticleSystem = GetComponent.<ParticleSystem>();
         ps.Stop();
        Flash.SetActive(false);
                    Shell.SetActive(false); 
        }