How do I make surface GUI buttons work?

Hello developers!

I was starting another new project, and a part of that project is for a player to click a surface GUI button that’s in a part. I placed the part, Then put a Surface GUI then a TextButton, Then I added a local script to the TextButton and it did not work, Here is what I put in the local script:

script.Parent.MouseButton1Click:Connect(function()
	print("TEST")
end)
7 Likes

Put the SurfaceGui in a ScreenGui in StarterGui.

Then, go to the properties of the SurfaceGui and make the Adornee the Part you are looking to put it on.

54 Likes

I just want to send my thanks to @TrackoTheTaco for this post, and to @ianstype for the solution. This helped me fix an issue of mine that has been dawning on me, I will be slotting you into my experiences credits, inside the games menu place(simply the first place that the player enters, before the server teleports them to their desired server) This is simply just to show sources of coding help. once again. Thank you :slight_smile:

4 Likes