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

How to make a ScreenGui appear onclick with a SurfaceGui Button?

I am trying to create an IFE System for my ROBLOX Airline, everything works except for the script that inserts the IFE Gui into the PlayerGui when you click a SurfaceGui Button.

This is my current script:

local button = script.Parent

local function onButtonActivated()
    local ui = script.Parent.Parent.Parent.ifemain
    local playergui = game.Players.LocalPlayer.PlayerGui
    ui.Parent = playergui
end
 
button.Activated:Connect(onButtonActivated)

When pressing the SurfaceGui Button, nothing happens, not even anything in the script output box. How can I fix this?

1 answer

✓ Accepted answer

Put your SurfaceGui in StarterGui, then set the Adornee property to the part you want to display it on. Remember, LocalScripts don't work in the workspace.

31 comments

0

I don't want it to display on a SurfaceGui

0

What do you mean? If you want them to be able to press the button, you're better off putting the SurfaceGui in StarterGui

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

surface guis belong in workspace though on parts

0

Yeah, I know that

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