Lesson 1
Where UI lives
Goal: Find, show and hide a ScreenGui from code.
about 5 min3 practice exercises
On-screen UI lives in a ScreenGui. You build it in StarterGui. When a player joins and their character first spawns, Roblox copies it into that player's PlayerGui.
That copy is why UI is client work. In Roblox's words, all on-screen UI objects and code are stored and changed on the client. A LocalScript reaches it like this:
local Players = game:GetService("Players")
local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
local shop = playerGui:WaitForChild("Shop")
shop.Enabled = false
Four ScreenGui properties you will set often:
| Property | What it does |
|---|---|
| Enabled | When false, nothing in it shows, takes input or updates |
| DisplayOrder | Higher numbers draw in front of other ScreenGuis |
| ResetOnSpawn | True by default: the UI is deleted and copied again on every respawn |
| ScreenInsets | How far content stays from the top bar and device cutouts |
ResetOnSpawn surprises people. A shop that closes itself and forgets its state whenever the player dies has it left on. Turn it off for UI that should survive a respawn.
Sources
Checked against Roblox's documentation on . The lesson is in our own words; these pages are the source of truth.