Click SurfaceGuis Through Parts

Can we be allowed to click a SurfaceGui as long as we can see it? If you have an invisible part between you and the gui, you can’t click it. I’m trying to make a first person jet with buttons. And because we can’t make unions small but appear big (…told ya this would come in handy) the cockpit is clustered with parts.

Even though the gui is visible you can’t click it. Can it please be made so SurfaceGuis can be clicked so long as they are visible? Thanks!

2 Likes

I bet you it would be really hard to calculate if it’s actually showing, but I do see how useful it would be.

Unfortunately this is a sort of hairy part of the API with no obviously correct solution to it.

Unfortunately there is no good way for a SurfaceGui to know whether it’s “visible” or not from the user’s perspective. For instance, what about parts with Meshes on them where part bounding box ~= the actual part? What about cases where there are legitimately semi-transparent parts blocking the view? What about cases with partially-transparent textures or decals on parts? What about cases where you want parts to be ignored SurfaceGui wise even if they are visible?

Just “SurfaceGuis should ignore invisible parts” isn’t really an acceptable solution to the problem, and could even end up doing more harm than good in some cases. I would suspect that that’s why SurfaceGuis do not try to do something like that yet.

In my opinion the right solution is to put something like a “:DoUserInput( … )” function on SurfaceGuis that lets you pass an arbitrary user input to them, letting you implement whatever behavior you want for them derived from the PlayerMouse.

1 Like

Personally, what I’ve been doing is checking if the mouse is over the part that has the surface GUI adorned to it, and when they click, if it’s over that part, do stuff. I add all of the invisible parts to one model and set that as the TargetFilter.

Going to necrobump this since it is the first Google result when searching for this.

This can be fixed by setting the collision group of your invisible parts to be non-collidable with the Default collision group.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.