Hello Guys, I need help making a code for a button.

I was making a code for a button when he get pressed he turn off the "IsTrigger" from a "boxCollider2D" from the player, I have this code from the ball, is a object who get stuck to player.
the Player have already the "IsTrigger" on.

public class ballscript : MonoBehaviour
{
private bool stickToPlayer;
[SerializeField] private Transform transformPlayer;
[SerializeField] private Transform playerBallPosition;
float speed;
Vector2 previouslocation;
public Collider2D ballcol;

void Start()
{

}

public void SetStickToPlayer(bool value)
{
stickToPlayer = value;
}

// Update is called once per frame
void Update()
{
if (!stickToPlayer)
{
float distanceToPlayer = Vector3.Distance(transformPlayer.position, transform.position);
if (distanceToPlayer < 0.5)
{
stickToPlayer = true;
}
}
else
{
Vector2 currentlocation = new Vector2(transform.position.z, transform.position.x);
speed = Vector2.Distance(currentlocation, previouslocation) / Time.deltaTime;
transform.position = playerBallPosition.position;
transform.Rotate(new Vector3(transformPlayer.right.z, 0, transformPlayer.right.x), speed, Space.World);
previouslocation = currentlocation;
}
}

}

If u can made a force when player click on button to make shoot thats good.
thanks and good day for u.

i forgot to say, i wanna do this in touchscreen button