Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I open a playergui when surfacegui clicked?

I'm having trouble getting my playergui to open when i click on my surfacegui, which is supposed to open it. The surfacegui is a textbutton, and the gui is a screengui.
The script is below:

function onclick(player)
	local GUI = script.Parent.ScreensGUI:clone()
	GUI.Parent = player.WaitForChild("PlayerGui")
end

script.Parent.MouseButton1Click:connect(onclick)

1 answer

✓ Accepted answer

SurfaceGuis don't know who clicked them (if the scripts even work at all - but even then you should not use server scripts for input).

Put the GUI in StarterGui and set its Adornee (you may have to do that through a script), then you can properly receive input.

This discussion is preserved as it was. New answers, comments, and votes are closed.