Detect if mouse has clicked UI or Map (solved)

I am making a game and currently i have the player moving to the position where the touch has been clicked. I have added a inventory button over top of the screen. I have moved it to a ui layer that i made. But when i press the button the player still moves to the touch position. I dont want it to do this, i have tried to use the “cursor is over object” and the “click” events to check if only the map was touched but it didnt work. How can i make it so the player doesnt move to the cursor when ui is being interacted with?

Picture of my code

As simple solution as to obvious to figure out
Relax we all been there

To your 1st event you add condition
Cursor or touch is on object and here you select object you want to be clickable but when clicked player NOT to move there
And you invert it

Better idea would be to add your all clickable objects to a group called UIButtons

And now instead of each object you simply select that group
Even better idea is to add another layer called UIStuff
And put on that layer EVERYTHING that shows when you press some UI stuff

For example you open pause menu or settings menu
All that crap should be on different layer
For example pause menu on Pause layer and settings layer on Settings layer

And now you add to your 1st condition SOME layer is NOT VISIBLE
And in conditions where you care to interact with these elements
SOME layer is visible

And you simply show/hide these layers depending on if pause button was clicked
Or settings button was clicked
And EVERYTHING inside these layers will work only when they are visible
Meaning you won’t click on stuff that is invisible when for example settings menu is not visible

And here is how to use TOGGLE variable action to use same button for 2 different things
For example show/hide layer
In my case play pause music

Hi Btara,

Add this condition to your event:
(inverse) cursor over “inventory-btn”

Also, I think you should also add “trigger once”, so that the event doesn’t keep triggering on every frame.

Edit: I didn’t see ZeroX4’s reply for some reason, it should work as well.

Thanks, it works now!