Thank you @damies13 and @alex_read, I managed to find a solution based on what you guys sent, and it worked perfectly fine.
Here’s the code:
${visible_element}= Get Element States id=button then bool(value & visible)
IF ${visible_element}
Click button
END
I appreciate and thank you guys for the solution!