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

How to convert a Screen GUI to a Surface GUI?

Asked by 10 years ago
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

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

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.

0
Cool, thanks for the info! Michael007800 144 — 10y
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! Michael007800 144 — 10y
0
What were you using before? BlueTaslem 18071 — 10y
0
A custom part. Really annoying how it has to be a brick... Well, I just re-sized teh GUI afterwards. Michael007800 144 — 10y
Ad

Answer this question