Why is my multi touch not working?

if (Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began)
{
if (!EventSystem.current.IsPointerOverGameObject(Input.touches[0].fingerId))
{
if (!anim.GetCurrentAnimatorStateInfo(0).IsName(“PlayerAttack”))
{
anim.Play(“PlayerAttack”);
}
}

        }

I have a joystick in my canvas and what i’ m trying to achieve is that when the player touches the screen anywhere except the joystick he attacks. I did this by using this code but now I can’t move the joystick and attack at the same time.