Unable to interact with SurfaceGui in Character

I have a part inside of Player’s Character, which contains a SurfaceGui with ImageButton.

The ImageButton will only detect clicks if the SurfaceGui is set to AlwaysOnTop, or if I move it out of the Character into the Workspace.

As I don’t want it to be always on top, are there ways to detect clicks when a SurfaceGui is inside of a Character?

P.S.

  1. The ImageButton’s colour becomes lighter when AlwaysOnTop is true
  2. SurfaceGui wont click - #5 by Ie_fishe
  3. SurfaceGui TextButtons not responding
  4. Test.rbxl (25.2 KB)
2 Likes

Regarding this: AlwaysOnTop overrides LightInfluence - I think the explanation was that AlwaysOnTop forces the SurfaceGui to render in the UI pipeline rather than the world one, so it no longer has access to lighting data (i.e. shadows) where it would be located in the world.

1 Like

Well, that actually ain’t the main problem- Do you know any ways that can solve the unclickable GUI?

I’ve noticed that SurfaceGuis seem to have problems sinking inputs when they’re placed on particularly thin parts, though. Given you have these close to the camera, I’d imagine the parts they’re on will be particularly small. No way around it that I’ve found, aside from making the parts larger.

3 Likes

I made the part larger, seems to work now, I guess I can have the image buttons resized, thanks!

1 Like

Apologies for disturbing I know it’s been 3 years :slightly_smiling_face:, I just wanted to reply for anyone in the future that might have this problem and come across this post.

For me it was the thickness of the Part as you mentioned but it could be due to a certain size requirement or it might need a somewhat similar size on x, y, z I do not know as to why.

The strange thing is originally my Part was not part of the character model and it was in workspace keeping to the players right side (RightVector) and it did not need any increase in thickness at all, it was the thinnest it could get so it totally works in workspace no matter what the sizes are as surfaceGuis normally do but I had to move to the character model for reasons such as having more freedom etc. suddenly it was showing problem of not picking up my MouseEnter / MouseLeave, so actually increasing the thickness strangely worked and I’d really like to know why this problem exist. A problem that made me suffer.

–If someone wanted to know the original method I used
–Positioning the GUI Part to the Right Side of the player

guiPart.Parent = workspace
guiPart.Orientation = root.Orientation
			
local offset = Vector3.new(8, 1, 1)
local function updateGuiPosition()
local forwardVector = hum.MoveDirection
local rootCFrame = root.CFrame
local rightVector = rootCFrame.RightVector
local upVector = rootCFrame.UpVector

guiPart.Position = root.Position + offset.X * rightVector + offset.Y * upVector + offset.Z * forwardVector
				
end

updateGuiPosition()

Kind Regards,
:heart_hands:

1 Like