# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: GuiService
type: class
memory_category: Instances
summary: |
Offers numerous properties and methods for working with
`Class.GuiObject|GuiObjects`, player preferences, and other UI‑related tasks.
description: |
`GuiService` offers numerous properties and methods for working with
`Class.GuiObject|GuiObjects`, player preferences, and other UI‑related tasks.
code_samples: []
inherits:
- Instance
descendants: []
tags:
- NotCreatable
- Service
- NotReplicated
deprecation_message: ''
properties:
- name: GuiService.AutoSelectGuiEnabled
summary: |
If activated, the Select button on a gamepad or
Backslash will automatically set a GUI as the selected object.
description: |
If activated, the Select button on a gamepad or
Backslash will automatically set a GUI as the selected object.
Disabling this means that GUI navigation will still work if
`Class.GuiService.GuiNavigationEnabled|GuiNavigationEnabled` is enabled,
but you will have to set `Class.GuiService.SelectedObject|SelectedObject`
manually to start navigation.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- Input
- name: GuiService.CoreGuiNavigationEnabled
summary: |
Toggles whether or not objects in the `Class.CoreGui` can be navigated
using a gamepad.
description: |
Toggles whether or not objects in the `Class.CoreGui` can be navigated
using a gamepad.
code_samples: []
type: boolean
tags:
- Hidden
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- UI
- Input
- name: GuiService.GuiNavigationEnabled
summary: |
Used to enable and disable the default controller GUI navigation.
description: |
Used to enable and disable the default controller GUI navigation.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- Input
- name: GuiService.IsModalDialog
summary: |
Indicates whether a modal dialog is visible.
description: |
This property tells whether or not a modal dialog is visible, such as the
game menu or a purchase prompt.
code_samples: []
type: boolean
tags:
- ReadOnly
- NotReplicated
- Deprecated
deprecation_message: |
This item is deprecated. Do not use it for new work.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- UI
- name: GuiService.IsWindows
summary: |
Indicates whether the user is playing on a computer running Windows.
description: |
The IsWindows property defines if the user is playing on a computer
running Windows.
code_samples: []
type: boolean
tags:
- ReadOnly
- NotReplicated
- Deprecated
deprecation_message: |
This item is deprecated. Do not use it for new work.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- UI
- name: GuiService.MenuIsOpen
summary: |
Returns `true` if any menu of `Class.CoreGui` is open.
description: |
Returns `true` if any menu of `Class.CoreGui` is open.
code_samples: []
type: boolean
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: true
capabilities:
- UI
- name: GuiService.PreferredTextSize
summary: |
Gets the player's preferred text size as an `Enum.PreferredTextSize`
value.
description: |
Gets the player's preferred text size as an `Enum.PreferredTextSize` value
of `Enum.PreferredTextSize.Medium|Medium` (default),
`Enum.PreferredTextSize.Large|Large`,
`Enum.PreferredTextSize.Larger|Larger`, or
`Enum.PreferredTextSize.Largest|Largest`. This property maps to the
**Text Size** setting available to players from the Roblox and
in‑game **Settings** menus, and it can be combined with
`Class.Object.GetPropertyChangedSignal()` to detect text size setting
changes for purposes of adjusting UI.
When working with UI elements, note the following behaviors:
- Text that is constrained to a minimum and/or maximum size through a
`Class.UITextSizeConstraint` will **not** shrink below or expand above
the set
`Class.UITextSizeConstraint.MinTextSize|MinTextSize`/`Class.UITextSizeConstraint.MaxTextSize|MaxTextSize`,
regardless of the player's text size setting.
- When `Class.TextLabel.TextScaled|TextScaled` is enabled for a
`Class.TextLabel.TextScaled|TextLabel` or
`Class.TextButton.TextScaled|TextButton`, the element's text will
**not** be scaled by the
`Class.GuiService.PreferredTextSize|PreferredTextSize` value.
- UI elements with `Class.GuiObject.AutomaticSize|AutomaticSize` enabled
will shrink/grow as
`Class.GuiService.PreferredTextSize|PreferredTextSize`
decreases/increases (element bounds will resize to fit the resized
text).
- When `Class.TextLabel.TextWrapped|TextWrapped` is enabled for a
`Class.TextLabel.TextWrapped|TextLabel` or
`Class.TextButton.TextWrapped|TextButton`, the element's text will wrap
to additional lines as
`Class.GuiService.PreferredTextSize|PreferredTextSize` increases, within
limits of the element's absolute size.
- The results returned by `Class.TextService:GetTextSize()` and
`Class.TextService:GetTextBoundsAsync()` honor changes related to
`Class.GuiService.PreferredTextSize|PreferredTextSize`.
code_samples:
- GuiService-PreferredTextSize
type: PreferredTextSize
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- UI
- name: GuiService.PreferredTransparency
summary: |
Gets the player's preferred transparency as a number between `0` and `1`.
description: |
Gets the player's preferred transparency as a number between `0` and `1`.
This property maps to the **Background Transparency** setting
available to players from the Roblox and in‑experience **Settings** menus,
and it can be combined with `Class.Object.GetPropertyChangedSignal()` to
detect transparency setting changes for purposes of adjusting UI.
A value of `1` (default) indicates the player prefers the default
background transparency, while a value of `0` indicates the player prefers
fully opaque (non‑transparent) background transparency for improved
readability and contrast. Multiplying a UI element's
`Class.GuiObject.BackgroundTransparency|BackgroundTransparency` with
`Class.GuiService.PreferredTransparency|PreferredTransparency` is the
recommended approach, such that backgrounds become more opaque as
`Class.GuiService.PreferredTransparency|PreferredTransparency` approaches
`0`.
code_samples:
- GuiService-PreferredTransparency
type: float
tags:
- Hidden
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- UI
- name: GuiService.ReducedMotionEnabled
summary: |
Returns `true` if the player has enabled reduced motion.
description: |
Returns `true` if the player has enabled reduced motion, indicating that
they want motion effects and animations to be reduced or completely
removed. This property maps to the **Reduce Motion** toggle available
from the Roblox and in‑experience **Settings** menus. See
[accessibility guidelines](../../../production/publishing/accessibility.md#reduced-motion)
for usage recommendations.
code_samples: []
type: boolean
tags:
- Hidden
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- UI
- name: GuiService.SelectedObject
summary: |
Sets the `Class.GuiObject` currently being focused on by the GUI
navigator.
description: |
Sets the `Class.GuiObject` currently being focused on by the GUI
navigator. This may reset to `nil` if the object is off screen.
This property is changed by the
`Class.GuiObject.SelectionGained|SelectionGained` and
`Class.GuiObject.SelectionLost|SelectionLost` events. If you would like to
determine when this property changes without tracking these events for all
GUI elements, you can use the `Class.Object.Changed|Changed` event.
code_samples:
- printing-when-gamepad-selection-changes
type: GuiObject
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- Input
- name: GuiService.TopbarInset
summary: |
Used to determine the absolute size and position of unobstructed area
within top bar space.
description: |
Returns a `Datatype.Rect` object representing the unoccupied area between
the Roblox left-most controls and the edge of the device safe area.
The value is dynamic and can be expected to change based on the visibility
of UI controls such as changing the local player's
`Class.Humanoid.Health|Health` property, usage of
`Class.StarterGui:SetCoreGuiEnabled()`, changing the size and position of
Roblox UI Controls, and/or others. For this reason, it's recommend that
you detect and react to changes of this property with
`Class.Object:GetPropertyChangedSignal()`.
code_samples:
- GuiService-TopbarInset
type: Rect
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- UI
- name: GuiService.TouchControlsEnabled
summary: |
Used to enable and disable touch controls and touch control display UI.
Defaults to `true`.
description: |
Used to enable and disable touch controls and touch control display UI.
Defaults to `true`.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- UI
- Input
- name: GuiService.ViewportDisplaySize
summary: |
Read-only property which represents the physical rendering size of the
viewport.
description: |
Read-only property which represents the physical rendering size of the
viewport:
- `Enum.DisplaySize.Small` — Most tablet/mobile/handheld devices
- `Enum.DisplaySize.Medium` — Most laptops and monitors
- `Enum.DisplaySize.Large` — Most TVs or larger
You can listen for changes to this property through the
`Class.Object:GetPropertyChangedSignal()|GetPropertyChangedSignal()`
method to adapt UI to various display sizes.
code_samples:
- GuiService-ViewportDisplaySize
type: DisplaySize
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities:
- UI
methods:
- name: GuiService:AddSelectionParent
summary: |
Creates a selection group where gamepad GUI navigation will only consider
selectable objects that are within the group.
description: |
Creates a selection group where gamepad GUI navigation will only consider
selectable objects that are within the group (children of
`selectionParent`). An example is when you have a menu pop open and there
are other selectable objects on the screen, possibly from previous menus,
but you want the user to only be able to select GUI objects in the new
menu.
code_samples: []
parameters:
- name: selectionName
type: string
default:
summary: |
A unique name identifying this selection group.
- name: selectionParent
type: Instance
default:
summary: |
The `Class.GuiObject` whose selectable descendants form the navigation
group.
returns:
- type: ()
summary: ''
tags:
- Deprecated
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:AddSelectionTuple
summary: |
**AddSelectionTuple** works similarly to
`Class.GuiService:AddSelectionParent()`, but you can give it a tuple of
`Class.GuiObject` that you want to be contained in the group.
Beware that the second argument is _not_ a table, but rather the first of
several `Class.GuiObject` in the tuple. To pass the contents of a table,
use `unpack`/`table.unpack`:
```lua
local frame = script.Parent
-- Passing various GuiObject individually
GuiService:AddSelectionTuple("InventoryButtons", frame.Sort, frame.Trash, frame.Drop)
-- Unpacking a table of GuiObject (unpack/table.unpack are equivalent)
local inventoryButtons = { frame.Sort, frame.Trash, frame.Drop }
GuiService:AddSelectionTuple("InventoryButtons", unpack(inventoryButtons))
```
description: |
Functions similarly to `Class.GuiService:AddSelectionParent()`, but you
can give it a tuple of `Class.GuiObject` that you want to be contained in
the group.
code_samples: []
parameters:
- name: selectionName
type: string
default:
summary: |
The name of the added selection.
- name: selections
type: Tuple
default:
summary: |
The selection(s) added.
returns:
- type: ()
summary: ''
tags:
- Deprecated
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:CloseInspectMenu
summary: |
Closes the avatar inspection menu, if open.
description: |
This method closes the
[Avatar Inspect Menu](../../../players/avatar-inspect-menu.md), if open,
when run from a `Class.LocalScript`.
#### See Also
- `Class.GuiService:InspectPlayerFromHumanoidDescription()|InspectPlayerFromHumanoidDescription()`
which allows the avatar inspection menu to appear showing the assets
listed in a `Class.HumanoidDescription` object.
- `Class.GuiService:InspectPlayerFromUserId()|InspectPlayerFromUserId()`
which allows the avatar inspection menu to appear showing the user that
has the given `Class.Player.UserId|UserId`.
code_samples: []
parameters: []
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:DismissNotification
summary: |
Dismisses a notification previously shown by
`Class.GuiService:SendNotification()|SendNotification()`.
description: |
Dismisses the notification identified by `notificationId`, which is the
string returned when the notification was created with
`Class.GuiService:SendNotification()|SendNotification()`. If the
notification was created with an `OnDismiss` callback, that callback is
invoked. Returns `true` when a matching notification is found and
dismissed, or `false` when no active notification has the given
`notificationId`.
code_samples: []
parameters:
- name: notificationId
type: string
default:
summary: |
The identifier returned by
`Class.GuiService:SendNotification()|SendNotification()` for the
notification to dismiss.
returns:
- type: boolean
summary: |
`true` if a matching notification was found and dismissed; `false` if
no active notification has the given `notificationId`.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:GetEmotesMenuOpen
summary: |
Checks if the player emotes menu is open.
description: |
Returns a boolean indicating whether or not the player emotes menu is
open. You can open or close the emotes menu by calling the
`Class.GuiService:SetEmotesMenuOpen()|SetEmotesMenuOpen()` method.
code_samples: []
parameters: []
returns:
- type: boolean
summary: |
Whether the emotes menu is open.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:GetGameplayPausedNotificationEnabled
summary: |
Returns whether or not the `Class.Player.GameplayPaused` notification has
been disabled.
description: |
This method returns whether or not the `Class.Player.GameplayPaused`
notification has been disabled through
`Class.GuiService:SetGameplayPausedNotificationEnabled()|SetGameplayPausedNotificationEnabled()`.
See also `Class.Workspace.StreamingIntegrityMode` and
`Enum.StreamingIntegrityMode` for more details on when gameplay is paused.
code_samples: []
parameters: []
returns:
- type: boolean
summary: |
Whether or not the `Class.Player.GameplayPaused` notification has been
disabled.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:GetGuiInset
summary: |
Returns two `Datatype.Vector2` values representing the inset of user GUIs
in pixels, from the top‑left corner of the screen and the bottom‑right
corner of the screen respectively.
description: |
Returns two `Datatype.Vector2` values representing the inset of user GUIs
in pixels, from the top‑left corner of the screen and the bottom‑right
corner of the screen respectively.
Note that the inset values supplied by this method only take effect on
`Class.ScreenGui|ScreenGuis` that have their
`Class.ScreenGui.IgnoreGuiInset|IgnoreGuiInset` property set to `false`.
code_samples:
- GuiService-GetGuiInset
parameters: []
returns:
- type: Tuple
summary: |
A tuple of two `Datatype.Vector2` values describing the current
specified GUI inset.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:GetInsetArea
summary: |
Takes an `Enum.ScreenInsets` value and returns a `Datatype.Rect`
describing the inset region, relative to the
`Enum.ScreenInsets.CoreUISafeInsets|CoreUISafeInsets` area.
description: |
Takes an `Enum.ScreenInsets` value and returns a `Datatype.Rect`
describing the inset region relative to the
`Enum.ScreenInsets.CoreUISafeInsets|CoreUISafeInsets` area, effectively
the usable rectangle for a particular `Enum.ScreenInsets` area.
On a mobile device screen, for example, querying
`GetInsetArea(Enum.ScreenInsets.None)` may return a result such as
`-59, -58, 792, 334`, meaning the usable rectangle for
`Enum.ScreenInsets.None` has a top‑left corner `59` pixels left and `58`
pixels up from the top‑left corner of the core UI area, and a bottom‑right
corner `792` pixels right and `334` pixels down from the top‑left corner
of the core UI area.
code_samples:
- GuiService-GetInsetArea
parameters:
- name: screenInsets
type: ScreenInsets
default:
summary: |
The `Enum.ScreenInsets` value indicating which inset area to query.
returns:
- type: Rect
summary: |
A `Datatype.Rect` of the usable region for the specified
`Enum.ScreenInsets` area.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:GetInspectMenuEnabled
summary: |
Returns whether the avatar inspection menu is enabled.
description: |
This method returns whether the
[Avatar Inspect Menu](../../../players/avatar-inspect-menu.md) is
currently enabled. The feature is enabled by default and can be disabled
using the
`Class.GuiService:SetInspectMenuEnabled()|SetInspectMenuEnabled()` method.
code_samples: []
parameters: []
returns:
- type: boolean
summary: |
Whether the avatar inspection menu is enabled.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:InspectPlayerFromHumanoidDescription
summary: |
Allows the avatar inspection menu to appear showing the assets listed in a
`Class.HumanoidDescription` object.
description: |
This method allows the
[Avatar Inspect Menu](../../../players/avatar-inspect-menu.md) to appear
showing the assets listed in a `Class.HumanoidDescription` object. This
allows further customization with what is shown in the inspection menu
when players inspect other players in your experience.
See also
`Class.GuiService:InspectPlayerFromUserId()|InspectPlayerFromUserId()`
which allows the avatar inspection menu to appear showing the user that
has the given `Class.Player.UserId|UserId`.
code_samples:
- opening-an-inspect-menu-with-a-humanoiddescription
parameters:
- name: humanoidDescription
type: Instance
default:
summary: |
A `Class.HumanoidDescription` object that contains the assets to show
in the inspection menu.
- name: name
type: string
default:
summary: |
The name of the player being inspected to show in the menu.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- AvatarAppearance
- name: GuiService:InspectPlayerFromUserId
summary: |
Allows the avatar inspection menu to appear showing the user that has the
given `Class.Player.UserId|UserId`.
description: |
This method allows the
[Avatar Inspect Menu](../../../players/avatar-inspect-menu.md) to appear
showing the user that has the given `Class.Player.UserId|UserId`. This is
especially useful when you want to inspect players who aren't in the
current experience.
See also
`Class.GuiService:InspectPlayerFromHumanoidDescription()|InspectPlayerFromHumanoidDescription()`
which allows you to bring up the avatar inspection menu showing the assets
listed in a `Class.HumanoidDescription` object.
code_samples:
- opening-the-inspect-menu-for-a-userid
parameters:
- name: userId
type: User
default:
summary: |
The `Class.Player.UserId|UserId` of the player to inspect.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- AvatarAppearance
- name: GuiService:IsTenFootInterface
summary: |
Returns `true` if the client is using the ten foot interface, a special
version of Roblox's UI exclusive to consoles.
description: |
Returns `true` if the client is using the ten foot interface, a special
version of Roblox's UI exclusive to consoles.
Note that you should **not** use this property in an attempt to verify if
the player is on a console or not. Instead, consider reading
`Class.GuiService.ViewportDisplaySize|ViewportDisplaySize`. This method is
hardcoded to return `true` whenever the client runs on a console,
regardless of how the player is actually interacting with the device,
making it an unreliable proxy for rendering context.
code_samples: []
parameters: []
returns:
- type: boolean
summary: |
`true` if the client is using the ten foot interface (console UI
mode); `false` otherwise.
tags: []
deprecation_message: |
This method has been superseded by the
`Class.GuiService.ViewportDisplaySize|ViewportDisplaySize` property which
represents the internally‑categorized rendering size of the viewport.
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:RemoveSelectionGroup
summary: |
Removes a group that was created with
`Class.GuiService:AddSelectionParent()|AddSelectionParent()` or
`Class.GuiService:AddSelectionTuple()|AddSelectionTuple()`.
description: |
Removes a group that was created with
`Class.GuiService:AddSelectionParent()|AddSelectionParent()` or
`Class.GuiService:AddSelectionTuple()|AddSelectionTuple()`.
code_samples: []
parameters:
- name: selectionName
type: string
default:
summary: |
The name of the selection group to remove.
returns:
- type: ()
summary: ''
tags:
- Deprecated
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:Select
summary: |
Sets `Class.GuiService.SelectedObject` to a child of a provided instance
that is the `Class.PlayerGui` or its descendants.
description: |
When called on an instance `selectionParent` that is the `Class.PlayerGui`
or a descendant of it, the engine searches all available selectable,
visible and on-screen `Class.GuiObject|GuiObjects` that are descendants of
`selectionParent` and sets the
`Class.GuiService.SelectedObject|SelectedObject` to the `Class.GuiObject`
with the smallest `Class.GuiObject.SelectionOrder|SelectionOrder`.
code_samples: []
parameters:
- name: selectionParent
type: Instance
default:
summary: |
The parent of selection whose descendants are searched.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: GuiService:SendNotification
summary: |
Displays a notification described by `notificationInfo` and returns a
unique identifier for it.
description: |
Displays a notification built from the `notificationInfo` dictionary using
Roblox's native notification UI, and returns a unique identifier string
for the notification. The following fields of `notificationInfo` are
recognized:
| Field | Type | Description |
|---|---|---|
Title |
string |
The notification's title text. |
Text |
string |
The notification's body text. |
Icon |
string |
An image asset to display with the notification. |
Buttons |
{[ButtonInfo]} |
An array of button definitions. Each entry is a table with a Text (string), a ButtonType (Enum.NotificationButtonType), and an OnActivated (function) callback invoked when the button is pressed. |
OnDisplay |
function |
Invoked when the notification is shown. |
OnDismiss |
function |
Invoked when the notification is dismissed. |