Tutorials•Updated November 8, 2026•8 min read

Roblox GUI Tutorial: A Working Panel, Button, and Layout

Build a Roblox GUI practice panel with a LocalScript. Learn ScreenGui, button input, scale plus offset, AnchorPoint, and practical layout checks.

A Roblox GUI is an interface built from objects such as ScreenGui, Frame, TextLabel, and TextButton. Start with one panel and one local action. Once you can explain its object hierarchy, size, position, and input behavior, add a larger menu or connect it to gameplay.

Concept illustration of interface panels with different screen proportions
Existing conceptual interface artwork, not a screenshot of the practice script below.

Understand the container and its children

A ScreenGui contains a screen interface in the player’s PlayerGui. A Frame can group the visible panel, with text and buttons beneath it. Roblox’s on-screen containers guide explains the usual StarterGui-to-PlayerGui workflow. The code in this article instead creates one local practice interface directly in PlayerGui.

Keep the first hierarchy shallow: one screen container, one panel, one label, and one button. Name the objects so you can identify the instance you are editing. A label inside the wrong Frame can produce a valid property value in an unexpected place.

Create a complete local practice panel

In a practice place, insert a LocalScript in StarterPlayer → StarterPlayerScripts. Paste the full example, run the place, and inspect the player’s PlayerGui in Explorer. The script creates its own objects, so no separately named Frame or button is required.

local Players = game:GetService("Players")
local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")

if playerGui:FindFirstChild("ObbyGuiPractice") then
    warn("The practice GUI already exists")
    return
end

local screen = Instance.new("ScreenGui")
screen.Name = "ObbyGuiPractice"
screen.ResetOnSpawn = false
screen.Parent = playerGui

local frame = Instance.new("Frame")
frame.Name = "PracticePanel"
frame.AnchorPoint = Vector2.new(0.5, 0.5)
frame.Position = UDim2.fromScale(0.5, 0.5)
frame.Size = UDim2.new(0.5, -32, 0.4, 0)
frame.BackgroundColor3 = Color3.fromRGB(24, 28, 38)
frame.Parent = screen

local label = Instance.new("TextLabel")
label.Size = UDim2.new(1, -32, 0, 36)
label.Position = UDim2.fromOffset(16, 16)
label.BackgroundTransparency = 1
label.TextColor3 = Color3.new(1, 1, 1)
label.TextSize = 20
label.Text = "Press the button"
label.Parent = frame

local button = Instance.new("TextButton")
button.Size = UDim2.new(1, -32, 0, 48)
button.Position = UDim2.new(0, 16, 1, -64)
button.BackgroundColor3 = Color3.fromRGB(13, 78, 241)
button.TextColor3 = Color3.new(1, 1, 1)
button.TextSize = 18
button.Text = "Count a press"
button.Parent = frame

local presses = 0
button.Activated:Connect(function()
    presses += 1
    label.Text = "Presses: " .. presses
end)

The intended result is a centered panel with a label and button. Activating the button increments a local counter and changes the label. The duplicate-name guard avoids creating another copy if the script is run again while its interface already exists. The example is documentation-reviewed, not executed here inside Studio.

This counter is a presentation exercise. It does not award currency, save progress, or tell the server that a purchase occurred. If the interaction later affects gameplay, define the permitted action and server validation separately from the button’s visible feedback.

Combine scale and offset deliberately

The position and size guide describes scale as a fraction of the parent dimension and offset as an additive pixel amount. Use both when the design needs them. The panel’s width expression is half its parent width minus 32 pixels; the button uses its parent width minus 32 pixels for a 16-pixel inset on each side.

The UDim2 calculator lets you vary parent dimensions, scale, offset, position, and AnchorPoint without changing several properties blindly. In an 800 × 600 reference parent, the panel settings shown above give a 368 × 240 rectangle. The tool is a simplified geometry calculation; constraints and layout objects can change the actual result in Studio.

A fixed offset can be useful for an inset or a control height. A scale can be useful for a proportional panel. Neither choice alone proves that a layout works on every device. Check what happens when the parent becomes too small for its children rather than treating “scale” as an automatic responsive-design setting.

Use AnchorPoint to explain centering

The sample sets AnchorPoint to (0.5, 0.5) and Position to (0.5, 0.5). The frame’s center is placed at the parent’s center. If AnchorPoint were (0, 0), that same Position would put the frame’s upper-left at the center instead.

Try changing just the anchor in a copy of the practice scene. Keep Size and Position fixed so the difference is understandable. Then restore the centered anchor before testing another parent size.

Connect the button’s input locally

The GuiButton reference documents Activated. The sample listens to that event, increments a local number, and updates Text. Use one small effect first so you can tell whether input or layout is responsible when something fails.

If a panel needs to open and close, decide how the player will reopen it before hiding its only button. If a button starts a server action, do not assume a client-side label update establishes a successful server result. Keep pending, successful, and failed states distinct in the eventual interface.

Check readability and device behavior

  • Try a narrow viewport and a wider one; inspect the immediate parent’s dimensions.
  • Use a long label to see whether text clips or overlaps another control.
  • Check that the button remains visible and usable with the target input method.
  • Leave space for the platform’s reserved controls and screen areas.
  • Respawn and confirm that the chosen ResetOnSpawn behavior matches your intent.
  • Inspect any layouts, constraints, UIScale, padding, or automatic sizing before blaming UDim2.

The fixed text sizes in this exercise make the starting behavior explicit. Real interfaces need a deliberate text-sizing strategy, not a universal instruction to enable TextScaled everywhere. Test readable text and usable controls together at the sizes you intend to support.

Add artwork, colors, and sound after the interaction works

Use the Color3 picker to prepare a color value, and the image placement guide to choose the correct image object and asset workflow. For button feedback, the audio creation and upload guide covers asset preparation and playback checks.

Give each visual change a purpose: a border can identify an interactive area, a label can explain a state, and spacing can separate unrelated actions. A decorative corner radius or gradient does not repair an unclear interaction.

Debug the first panel before building a whole menu

If nothing appears, check script placement and execution, then PlayerGui and the created ScreenGui. If the panel appears in the wrong place, inspect its actual parent, AnchorPoint, Position, Size, and any layout influence. If the button does not change the label, check Output and whether another object covers the control.

For editable starting interfaces after this first exercise, try the three original Roblox UI templates with browser previews and downloadable LocalScripts.

Stop the practice test between runs and inspect both the interface and Output. The example is a starting point for local UI behavior, not a complete shop, inventory, saved-state system, or device-compatibility guarantee. Documentation checked November 8, 2026.

Frequently Asked Questions

Should Roblox UI always use scale instead of offset?▾

No. Scale is relative to the parent and offset adds pixels. Combine them deliberately and test the actual layout, text, constraints, and supported viewport sizes.

How does AnchorPoint affect centering?▾

With AnchorPoint and Position both set to 0.5, 0.5, the frame’s center is placed at its parent’s center. A top-left anchor would position that corner there instead.

Does the sample button award server-side currency?▾

No. It increments a local counter and changes a label. Gameplay actions and persistent progress need their own server-side rules and validation.

Ready to build your Roblox game?

Create, edit, preview, and export your game for free. No credit card required.

Try Obby — 100% Free →