Service · inherits Instance
GuiService
Offers numerous properties and methods for working with
GuiObjects, player preferences, and other UI‑related tasks.
About GuiService
GuiService offers numerous properties and methods for working with
GuiObjects, player preferences, and other UI‑related tasks.
Properties 11
AutoSelectGuiEnabled
: booleanIf activated, the Select button on a gamepad or Backslash will automatically set a GUI as the selected object.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
GuiNavigationEnabledis enabled, but you will have to setSelectedObjectmanually to start navigation.MenuIsOpen
: booleanReadOnlyNotReplicatedReturnstrueif any menu ofCoreGuiis open.PreferredTextSize
: PreferredTextSizeReadOnlyNotReplicatedGets the player's preferred text size as anPreferredTextSizevalue.Gets the player's preferred text size as an
PreferredTextSizevalue ofMedium(default),Large,Larger, orLargest. This property maps to the Text Size setting available to players from the Roblox and in‑game Settings menus, and it can be combined withObject.GetPropertyChangedSignalto 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
UITextSizeConstraintwill not shrink below or expand above the setMinTextSize/MaxTextSize, regardless of the player's text size setting.When
TextScaledis enabled for aTextLabelorTextButton, the element's text will not be scaled by thePreferredTextSizevalue.UI elements with
AutomaticSizeenabled will shrink/grow asPreferredTextSizedecreases/increases (element bounds will resize to fit the resized text).When
TextWrappedis enabled for aTextLabelorTextButton, the element's text will wrap to additional lines asPreferredTextSizeincreases, within limits of the element's absolute size.The results returned by
TextService.GetTextSizeandTextService.GetTextBoundsAsynchonor changes related toPreferredTextSize.
PreferredTransparency
: floatHiddenReadOnlyNotReplicatedGets the player's preferred transparency as a number between0and1.Gets the player's preferred transparency as a number between
0and1. This property maps to the Background Transparency setting available to players from the Roblox and in‑experience Settings menus, and it can be combined withObject.GetPropertyChangedSignalto 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 of0indicates the player prefers fully opaque (non‑transparent) background transparency for improved readability and contrast. Multiplying a UI element'sBackgroundTransparencywithPreferredTransparencyis the recommended approach, such that backgrounds become more opaque asPreferredTransparencyapproaches0.ReducedMotionEnabled
: booleanHiddenReadOnlyNotReplicatedReturnstrueif the player has enabled reduced motion.Returns
trueif 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 for usage recommendations.SelectedObject
: GuiObjectSets theGuiObjectcurrently being focused on by the GUI navigator.Sets the
GuiObjectcurrently being focused on by the GUI navigator. This may reset tonilif the object is off screen.This property is changed by the
SelectionGainedandSelectionLostevents. If you would like to determine when this property changes without tracking these events for all GUI elements, you can use theChangedevent.TopbarInset
: RectReadOnlyNotReplicatedUsed to determine the absolute size and position of unobstructed area within top bar space.Returns a
Rectobject 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
Healthproperty, usage ofStarterGui.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 withObject.GetPropertyChangedSignal.TouchControlsEnabled
: booleanUsed to enable and disable touch controls and touch control display UI. Defaults totrue.ViewportDisplaySize
: DisplaySizeReadOnlyNotReplicatedRead-only property which represents the physical rendering size of the viewport.Read-only property which represents the physical rendering size of the viewport:
DisplaySize.Small— Most tablet/mobile/handheld devicesDisplaySize.Medium— Most laptops and monitorsDisplaySize.Large— Most TVs or larger
You can listen for changes to this property through the
GetPropertyChangedSignal()method to adapt UI to various display sizes.
Methods 14
CloseInspectMenu
() → ()Closes the avatar inspection menu, if open.This method closes the Avatar Inspect Menu, if open, when run from a
LocalScript.See Also
InspectPlayerFromHumanoidDescription()which allows the avatar inspection menu to appear showing the assets listed in aHumanoidDescriptionobject.InspectPlayerFromUserId()which allows the avatar inspection menu to appear showing the user that has the givenUserId.
DismissNotification
(notificationId: string) → booleanDismisses a notification previously shown bySendNotification().Dismisses the notification identified by
notificationId, which is the string returned when the notification was created withSendNotification(). If the notification was created with anOnDismisscallback, that callback is invoked. Returnstruewhen a matching notification is found and dismissed, orfalsewhen no active notification has the givennotificationId.GetEmotesMenuOpen
() → booleanChecks if the player emotes menu is open.Returns a boolean indicating whether or not the player emotes menu is open. You can open or close the emotes menu by calling the
SetEmotesMenuOpen()method.GetGameplayPausedNotificationEnabled
() → booleanReturns whether or not thePlayer.GameplayPausednotification has been disabled.This method returns whether or not the
Player.GameplayPausednotification has been disabled throughSetGameplayPausedNotificationEnabled().See also
Workspace.StreamingIntegrityModeandStreamingIntegrityModefor more details on when gameplay is paused.GetGuiInset
() → TupleReturns twoVector2values 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.Returns two
Vector2values 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
ScreenGuisthat have theirIgnoreGuiInsetproperty set tofalse.GetInsetArea
(screenInsets: ScreenInsets) → RectTakes anScreenInsetsvalue and returns aRectdescribing the inset region, relative to theCoreUISafeInsetsarea.Takes an
ScreenInsetsvalue and returns aRectdescribing the inset region relative to theCoreUISafeInsetsarea, effectively the usable rectangle for a particularScreenInsetsarea.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 forScreenInsets.Nonehas a top‑left corner59pixels left and58pixels up from the top‑left corner of the core UI area, and a bottom‑right corner792pixels right and334pixels down from the top‑left corner of the core UI area.GetInspectMenuEnabled
() → booleanReturns whether the avatar inspection menu is enabled.This method returns whether the Avatar Inspect Menu is currently enabled. The feature is enabled by default and can be disabled using the
SetInspectMenuEnabled()method.InspectPlayerFromHumanoidDescription
(humanoidDescription: Instance, name: string) → ()Allows the avatar inspection menu to appear showing the assets listed in aHumanoidDescriptionobject.This method allows the Avatar Inspect Menu to appear showing the assets listed in a
HumanoidDescriptionobject. This allows further customization with what is shown in the inspection menu when players inspect other players in your experience.See also
InspectPlayerFromUserId()which allows the avatar inspection menu to appear showing the user that has the givenUserId.InspectPlayerFromUserId
(userId: User) → ()Allows the avatar inspection menu to appear showing the user that has the givenUserId.This method allows the Avatar Inspect Menu to appear showing the user that has the given
UserId. This is especially useful when you want to inspect players who aren't in the current experience.See also
InspectPlayerFromHumanoidDescription()which allows you to bring up the avatar inspection menu showing the assets listed in aHumanoidDescriptionobject.Select
(selectionParent: Instance) → ()SetsGuiService.SelectedObjectto a child of a provided instance that is thePlayerGuior its descendants.When called on an instance
selectionParentthat is thePlayerGuior a descendant of it, the engine searches all available selectable, visible and on-screenGuiObjectsthat are descendants ofselectionParentand sets theSelectedObjectto theGuiObjectwith the smallestSelectionOrder.SendNotification
(notificationInfo: Dictionary) → stringDisplays a notification described bynotificationInfoand returns a unique identifier for it.Displays a notification built from the
notificationInfodictionary using Roblox's native notification UI, and returns a unique identifier string for the notification. The following fields ofnotificationInfoare recognized:The returned identifier can be passed to
DismissNotification()to dismiss the notification programmatically; an empty string is returned if the notification could not be queued.SetEmotesMenuOpen
(isOpen: boolean) → ()Opens or closes the player emotes menu.SetGameplayPausedNotificationEnabled
(enabled: boolean) → ()Lets you disable the built-in notification when a player's gameplay is paused.This method lets you disable the built-in notification when a player's gameplay is paused. You can then add in your own UI and customize it.
You can query whether the notification is enabled by calling the
GetGameplayPausedNotificationEnabled()method.See also
Workspace.StreamingIntegrityModeandStreamingIntegrityModefor more details on when gameplay is paused.SetInspectMenuEnabled
(enabled: boolean) → ()Allows you to enable or disable the avatar inspection menu.This method allows you to enable or disable the Avatar Inspect Menu. The feature is enabled by default.
Events 2
GuiService also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.