Step 1: Make the UI
- Open Roblox Studio
- In the Explorer, go to StarterGui
- Insert a ScreenGui and rename it to
MainMenuGui - Inside
MainMenuGui, insert a Frame and rename it toMainFrame -
Inside
MainFrame, insert:- A TextLabel named
Title - A TextButton named
PlayButton
- A TextLabel named
UI settings you should change
- MainFrame
- Size:
{1, 0}, {1, 0} - BackgroundColor3: dark gray or whatever you want
- BorderSizePixel:
0
- Title
- Text:
MY GAME - TextScaled:
true - Size:
{0.6, 0}, {0.2, 0} - Position:
{0.2, 0}, {0.15, 0} - BackgroundTransparency:
1
- PlayButton
- Text:
PLAY - TextScaled:
true - Size:
{0.3, 0}, {0.12, 0} - Position:
{0.35, 0}, {0.5, 0}
At this point, if you press Play in Studio, you should see the menu.
Step 2: Main menu script
- Insert a LocalScript
- Put it inside
MainMenuGui
Script code
local player = game.Players.LocalPlayer
local gui = script.Parent
local mainFrame = gui:WaitForChild("MainFrame")
local playButton = mainFrame:WaitForChild("PlayButton")
playButton.MouseButton1Click:Connect(function()
mainFrame.Visible = false
print("Game Started")
end)
How this script works
- LocalScripts run on the player’s computer, which is required for UI
-
script.Parentis the ScreenGui -
WaitForChildmakes sure the UI exists before using it -
MouseButton1Clickruns when the button is clicked - Setting
Visibleto false hides the menu instantly
No tricks, no magic.
Step 3: Lock the player until Play is pressed (optional)
If you want the player to not move until they click Play, do this.
- Go to StarterPlayer
- Open StarterPlayerScripts
- Insert a LocalScript
Script code
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
local gui = player.PlayerGui:WaitForChild("MainMenuGui")
local frame = gui:WaitForChild("MainFrame")
frame:GetPropertyChangedSignal("Visible"):Wait()
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
What this script is doing
- Player spawns
- Movement is disabled
- Script waits until the menu frame becomes invisible
- Once Play is clicked, movement is restored
This is a very standard Roblox setup.
Top comments (0)