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!
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.
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.