Can't click on SurfaceGui button without AlwaysOnTop property enabled

Hi, I’m trying to make a surfacegui (a tablet) for the character to hold and interact with. However, I noticed that its only usable when the alwaysontop property is set to true. You cant interact with it at all if this property is not enabled and I don’t want the UI to be seen through the players head for obvious reasons.

Below you can see an example:
image
here we can see the element is dark because my mouse is hovered on it.


Here we can see the same while the character is holding the UI, and it is seen through the players head.


Here is the mouse over the button with alwaysontop disabled. You can see that the button is no longer highlighted and there is no print in the script that it was hovered on. (the lighting is dark so that may make it confusing but I assure you its not being selected)

I’ve tried messing with all kinds of properties and different hacky methods of trying to get this work, with no luck. Anyone know the solution?

also note that alongside trying to put the surfacegui and local script in the tool itself, it is currently adornee’d to the part and is in the playergui

3 Likes

Old post, sorry.

The best way to do it is to create an invisible part with CanQuery and CanCollide off and have it backed up from the Part a little bit.

Roblox’s collision blocks interaction and sometimes collisions can be bigger than the model itself. Which will block the button from being pressed. Simply moving it away a tiny bit for Roblox Baseparts seem to work just fine.

1 Like

Another necro for people stumbling here:

Some mouse events like .Activated or .MouseButton1Click don’t work on SurfaceGuis (unless they’re set to AlwaysOnTop), whereas some like .MouseButton1Down seem to always work.

1 Like