Why use ScreenGui?
ScreenGui is a container for on-screen interface objects. Each player receives a copy from StarterGui in PlayerGui; ResetOnSpawn controls what happens to that copy when the character respawns.
Try it in Roblox Studio
Put this LocalScript in StarterPlayerScripts. Start a Studio client and inspect PlayerGui in Explorer; this is a client interface, not server-side UI.
Syntax
screenGui.ResetOnSpawn = false
screenGui.Parent = player.PlayerGuiExamples
ScreenGui layers
Add a persistent HUD container and a small text label.
local Players = game:GetService("Players")
local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "PracticeHud"
screenGui.ResetOnSpawn = false
screenGui.Parent = playerGui
local label = Instance.new("TextLabel")
label.Size = UDim2.fromOffset(240, 40)
label.Text = "Practice HUD"
label.Parent = screenGui- PlayerGui is the local player’s interface container; ScreenGui makes its child UI appear on screen.
- ResetOnSpawn is inherited from LayerCollector and tells the UI to remain when the character respawns.
- The label uses pixel offsets for this small demonstration; production layouts should account for different screen sizes.
Best practices
- Use StarterGui for authored interfaces and PlayerGui for runtime client instances.
- Test UI at phone and desktop sizes.
Runtime & versions
Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Luau documentation