Skip to content

ScreenGui

A layer of on-screen UI: put GUI objects inside it.

  • Inherits: Instance
  • Creatable: Yes: new ScreenGui(), or Instance.new('ScreenGui', parent).
  • Replication: Replicated: clients get a copy, and changes the server makes reach them.

A ScreenGui covers the whole screen; the GUI objects inside it are laid out relative to it. Put ScreenGuis in StarterGui, so every player gets a copy when they join, or straight into a player’s PlayerGui. Only ScreenGuis directly inside a PlayerGui are drawn.

Type: boolean · Default: true · Access: read/write · Replicates: yes

When false, the layer and everything in it is hidden.

Type: number · Default: 0 · Access: read/write · Replicates: yes

Higher layers draw on top.

Rounded to a whole number.

Inherited from Instance: name, archivable, id, className, parent, destroyed

Inherited from Instance: getPropertyChangedSignal, setAttribute, getAttribute, getAttributes, getAttributeChangedSignal, getChildren, getDescendants, findFirstChild, findFirstChildOfClass, findFirstChildWhichIsA, findFirstAncestor, findFirstAncestorWhichIsA, waitForChild, isA, isDescendantOf, isAncestorOf, getFullName, clearAllChildren, destroy, clone, toString

Inherited from Instance: changed, childAdded, childRemoved, descendantAdded, descendantRemoving, ancestryChanged, destroying, attributeChanged

import {
Color3,
PlayerGui,
ScreenGui,
TextLabel,
Vector2,
task,
waitForChild,
waitForLocalPlayer,
} from '@rally/sdk';
task.spawn(async () => {
const me = await waitForLocalPlayer();
const playerGui = await waitForChild(me, 'PlayerGui', PlayerGui);
const hud = new ScreenGui();
hud.name = 'HUD';
const label = new TextLabel();
label.text = 'Find the exit!';
label.positionScale = new Vector2(0.5, 0); // top center
label.anchorPoint = new Vector2(0.5, 0);
label.position = new Vector2(0, 16);
label.size = new Vector2(260, 44);
label.backgroundColor = Color3.fromHex('#1d2b53');
label.textColor = Color3.white;
label.cornerRadius = 12;
label.parent = hud;
hud.parent = playerGui; // made on this device, so only this player has it
});