Surface Text Button not working

I don’t know why its not working. When I click it nothing happens. I’ve tried multiple different scripts and the function doesn’t even happen so I don’t believe its the script. Its a surface gui using a text button parented to PlayerGui and Adorned to a part. In case it could be this is the relevant script:

local playButtonUI = workspace.MainMenu.Play.SurfaceGui
local playButton = workspace.MainMenu.Play.SurfaceGui.Frame.TextButton

playButtonUI.Parent = Players.LocalPlayer.PlayerGui
playButtonUI.Adornee = workspace.MainMenu.Play -- Here it is moved to the gui bit so thats not the problem

playButton.MouseButton1Click:Connect(playEntered)

I have also moved the player camera if that could be affecting it?


image

1 Like

The SurfaceGui must be parented to a Player’s PlayerGui in order for it to be interactable.

It already is, just not from the start (I’ll optimise it later or something I just want it to work rn)

Have you checked your player gui in-game to be sure it is finding your player’s gui and parenting it there?

Yes I have and it does parent correctly

Ok i would also change this:

To this, since now its in the players gui it wont be in workspace anymore:

local playButton = playButtonUI.Frame.TextButton
1 Like

Good spot, I added that bit after the other and ig I didn’t change it, I reckon that will be the problem though (I cant check it now). Thanks!

Still hasn’t worked. Idk what we can try next.

Have you tried using Click Detector with the text button?

Yep, I clicked it and nothing happened still.

At this point I would post your entire script to the scripting section, and also list any errors it produces, as im sure your script is hanging up somewhere.