Menus
How to Make a Roblox Main Menu GUI
The main menu is the first thing players see when they join your game. This guide builds one from scratch in Luau — a ScreenGui container, a centered panel, a title, and Play / Settings buttons stacked automatically with a UIListLayout. You can also start from the ready-made main-menu template in the editor and customize it.
Open the Main Menu template →1. Create the ScreenGui container
Every on-screen interface lives inside a ScreenGui. Put it in the local player's PlayerGui so it renders on their screen, and set ResetOnSpawn to false so the menu survives respawns.
local player = game:GetService("Players").LocalPlayer
local gui = Instance.new("ScreenGui")
gui.Name = "MainMenu"
gui.ResetOnSpawn = false
gui.IgnoreGuiInset = true
gui.Parent = player:WaitForChild("PlayerGui")2. Add a centered panel and title
A Frame acts as the menu background, a UICorner rounds it, and a TextLabel shows the game title. AnchorPoint 0.5,0.5 plus Position 0.5,0.5 centers the panel exactly on screen.
local panel = Instance.new("Frame")
panel.Size = UDim2.fromScale(0.4, 0.6)
panel.Position = UDim2.fromScale(0.5, 0.5)
panel.AnchorPoint = Vector2.new(0.5, 0.5)
panel.BackgroundColor3 = Color3.fromRGB(21, 23, 31)
panel.Parent = gui
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 18)
corner.Parent = panel
local title = Instance.new("TextLabel")
title.Size = UDim2.fromScale(1, 0.18)
title.BackgroundTransparency = 1
title.Text = "GAME TITLE"
title.Font = Enum.Font.GothamBlack
title.TextSize = 30
title.TextColor3 = Color3.fromRGB(153, 203, 255)
title.Parent = panel3. Stack the buttons with UIListLayout
Drop a UIListLayout into the panel and every child you add afterwards stacks itself — no manual positioning. Set Padding for spacing and HorizontalAlignment to center them.
local layout = Instance.new("UIListLayout")
layout.Padding = UDim.new(0, 10)
layout.HorizontalAlignment = Enum.HorizontalAlignment.Center
layout.Parent = panel4. Make the buttons do something
Each button is a TextButton. Connect MouseButton1Click to run code when the player taps it — here, PLAY hides the menu and starts the game.
local playBtn = Instance.new("TextButton")
playBtn.Size = UDim2.fromScale(1, 0.14)
playBtn.Text = "PLAY"
playBtn.Font = Enum.Font.GothamBold
playBtn.TextSize = 20
playBtn.Parent = panel
playBtn.MouseButton1Click:Connect(function()
gui.Enabled = false
-- start the game here
end)FAQ
How do I center the menu on screen?
Set the panel's AnchorPoint to Vector2.new(0.5, 0.5) and Position to UDim2.fromScale(0.5, 0.5). The panel then centers on its own midpoint instead of its top-left corner.
Why does my menu disappear when I respawn?
By default a ScreenGui resets on spawn. Set ResetOnSpawn = false on the ScreenGui to keep it persistent.