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

How to convert a Screen GUI to a Surface GUI?

function Click(mouse)

script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.Menu.Visible = true

end


script.Parent.MouseButton1Down:connect(Click)

That is the basic script that I will use for all the menus. What would I do so that it would work on a SurfaceGUI?

1 answer

✓ Accepted answer

SurfaceGui objects work exactly the same as ScreenGui objects, containing GUI objects to be presented.

They simply either require their Adornee property to be set to the part they are on, or to be the child of a part.

(Full list of SurfaceGui properties)


In addition, you should configure the CanvasSize of the SurfaceGui, which is a Vector2. CanvasSize affects what an "offset" is for UDim2 (the width / height / length of a part is split into the resolution you give it in CanvasSize).

What is less obvious about CanvasSize is that it also represents the resolution to which objects can be positioned, i.e., even if you only use Scale in UDim2's to position elements, very low CanvasSizes could cause artifacts.

4 comments

0

Cool, thanks for the info!

0

Also, just realized why the buttons didn't work last time I tried it! The form of whatever it's on HAS to be a brick!

0

What were you using before?

0

A custom part. Really annoying how it has to be a brick... Well, I just re-sized teh GUI afterwards.

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