Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I open a playergui when surfacegui clicked?

Asked by 8 years ago

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

Log in to vote
0
Answered by 8 years ago

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.

Ad

Answer this question