Block Input.GetMouseButtonDown() when clicking on UI element

Sorry if this has been asked-answered before. I wasn’t able to find the right solution yet.

Context:
I have a list of images in the screen Canvas. Each image is a slot of a sort of inventory and they have a script attached that implements IPointerClickHandler.

I have a player gameobject with a script which in the “Update” evaluates if Input.GetButtonMouseDown() was triggered to move or attack the player to the point of the terrain clicked.

When I click on one of the images with the script that implements IPointerClickHandler, the script of the player is also triggered, so the player moves, which I don’t want to happen.
How can I avoid the Input.GetButtonMouseDown() from getting triggered?

I read somewhere about CanvasGroup. Not sure if it is the solution for this, but I tried it with no luck.

Ideas?
Thanks

It sounds like you just need to disable that script when the UI is open. I’m assuming you have a script which handles opening and closing your UI. Just add a reference to the script needing to be disabled and disable it when the UI is opened. IE.

Player.Getcomponent<MoveScript>().enabled = false;

Can anyone help on this one?