RMB click not working as intended

I’ve made a script so that when i right click on a button, it opens up settings for that specific chat box. The problem is, most of the time, it doesn’t open. Here’s the code:

Basically I’m asking if the button is hovered + if settings are already not open (this shouldn’t be the problem). This function is called once RMB is clicked. Is Hovered is kinda retarded and gives me weird results every time i click on the button in game. Here is a screen:

This is how it looks once the the settings are open, however as you can see from the strings above, it only worked in the third try. I’m not sure why this problem pops up. Does anyone have a solution to this, or another way to make the same functionality? I’d really appreciate it.

Try checking for an actual mouse click, not a hover. If you check for a hover then you are waiting for a hover, not a click. If you want to do something when a mouse is clicked then you need to check for that.