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

Is there a way where I can get a surfacegui opens a Gui Frame?

Asked by
dog6779 25
6 years ago
Edited 6 years ago

So in this picture, I made a Gui and surfaceGui for a button.

But how do I make it where the Surfacegui Button gets clicked on and you see the gui frame?

Like this is what I am doing:

https://gyazo.com/d422970e61dc15319c46ce19cca33140 https://gyazo.com/d422970e61dc15319c46ce19cca33140

And even so, I use a script like this to somehow open the main frame from the Gui.

This script is in the Surfacegui button here:

If you don't know the application teleporter that's the thing I am doing on the surface Gui. https://gyazo.com/14f3513c11a83960c1f68e030eb559b5

local Button = script.Parent
Frame = script.Parent.Parent.Main

function onClick()
if Frame.Visible == false then
Frame.Visible = true
elseif Frame.Visible == true then
Frame.Visible = false
end
end

Button.MouseButton1Click:connect(onClick)

And now I want the button for the Gui here. https://gyazo.com/726c1b6942e41e389ffec4134524e1ae

And now I wanted the frame when it is open it closes https://gyazo.com/53d4ae7ca1735c0583e1defa073e8902

And here is the Button where It closes. https://gyazo.com/c7891517cfabb7fd4c62b188f62ddb00

So I guess that is all.

0
It looks like working code to me. Could you explain what's wrong? MooMooThalahlah 421 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

The reason the button isn’t working on the SurfaceGui is because you didn’t parent it to PlayerGui. As it says in the wiki, the SurfaceGui must be in PlayerGui (or StarterGui if everyone sees it) to let the game know who can interact with the GUI. If you just put it in some part in workspace, the game won’t know who can interact with it.

So basically put your SurfaceGui in PlayerGui/StarterGui and set its adornee in its properties to the part in workspace you want the GUI to show up on. The button and your script should then work.

Ad

Answer this question