How to seperate gui input from world input?


I have a GUI interface and a player that hase code to detect when the mouse is pressed.

When i mess with my GUI buttons the code for the player also fires off; an undesired behavior. The code in the player is meant for mining or using his current item not meant for buttons.

Some people have suggested using _unhandled_input and mouse filters, but i havent gotten either of those to work. Im just wondering what the common thing to do in the situation?