Issues with TextButtons SurfaceGui

Hey developers! I am currently making a checkout system utilizing SurfaceGuis. I am using an adornee.
image

Here’s my code for registering clicks:

for _, Frame in pairs(script.Parent.Items:GetChildren()) do
	if Frame:IsA("Frame") then
		Frame.Click.MouseButton1Down:Connect(function()
			print(Frame.Name)
			local Found = table.find(SelectedItems, Frame.Name)
			if Found then
				table.remove(SelectedItems, Found)
			else
				table.insert(SelectedItems, Frame.Name)
			end
			UpdateItemFrames()
		end)
	end
end

The issue is that it is only working for the top 2 buttons (clicks on the bottom 2 buttons and confirm are not registering!), which doesn’t make sense because all the buttons are exactly the same apart from name and an image id:
image

Here’s what the register parts look like:
image

I would very much appreciate some help with this! Thanks!

Repro place: Issues with TextButtons SurfaceGui - #6 by oskxzr

It’s possible the Z-Index is incorrect.
Confirm whether the Z-Index property of the button is greater than the ImageLabel’s for the bottom two buttons.

1 Like

The Z-Index of the TextButton is set to 5, and everything else is set to 1.

1 Like

Do the GuiObjects named “Cick” match the size of their containing frames? Are they positioned correctly at each corner? Are the frames divided equally in size on the BasePart instance they are on?

2 Likes

Hey there! Thank you for the reply, I appreciate it.


Yes they do, the click buttons’ sizes are set to 1,0,1,0 with a Z-Index of 5 compared to 1 of all the other GUIObjects.

Yes, I am using the following grid layout:

1 Like

screenguirepro.rbxl (62.3 KB)
I have this repro place here…
Would appreciate if anyone has the time to check it out and see if you can work out what’s going wrong.

Thanks!

It has something to do with the properties of the SurfaceGui. After some playing around, I enabled AlwaysOnTop and it seemed to fix it, although it comes up a little brighter.

Edit: GIF of it working:
https://gyazo.com/bdf3bb2ff077ed4f52bb57c683891142

2 Likes