GuiService

Show Deprecated
Not Creatable
Service
Not Replicated

GuiService allows developers to control what GuiObject is currently being selected by the gamepad navigator, as well as check if Roblox's main menu is currently open.

Summary

Properties

  • If activated, the Select button on a Gamepad or Backslash will automatically set a GUI as the selected object.

  • Hidden
    Not Replicated
    Read Parallel

    Toggles whether or not objects in the CoreGui can be navigated using a Gamepad.

  • Used to enable and disable the default controller GUI navigation.

  • Read Only
    Not Replicated
    Read Parallel

    Returns true if any menu of CoreGui is open.

  • Read Only
    Not Replicated
    Read Parallel
  • Hidden
    Read Only
    Not Replicated
    Read Parallel

    Gets the user's preferred transparency as a number between 0 and 1, which indicates how opaque they want the backgrounds of certain UI elements to be. The recommended usage is as a multiplier of an element's BackgroundTransparency. Defaults to 1.

  • Hidden
    Read Only
    Not Replicated
    Read Parallel

    Returns true if the user has enabled reduced motion. Defaults to false.

  • Sets the GuiObject currently being focused on by the GUI Navigator (used for Gamepads).

  • Read Only
    Not Replicated
    Read Parallel

    Used to determine the absolute size and position of unobstructed area within top bar space.

  • Used to enable and disable touch controls and touch control display UI. Defaults to true.

  • Read Only
    Not Replicated
    Roblox Script Security
    Read Parallel

Methods

Events

Properties

AutoSelectGuiEnabled

Read Parallel

CoreGuiNavigationEnabled

Hidden
Not Replicated
Read Parallel

GuiNavigationEnabled

Read Parallel
Read Only
Not Replicated
Read Parallel

PreferredTextSize

Read Only
Not Replicated
Read Parallel

PreferredTransparency

Hidden
Read Only
Not Replicated
Read Parallel

Code Samples

Use Preferred Transparency

local DEFAULT_TRANSPARENCY = 0.5
local frame = script.Parent
local function setBackgroundTransparency()
frame.BackgroundTransparency = DEFAULT_TRANSPARENCY * GuiService.PreferredTransparency
end
GuiService:GetPropertyChangedSignal("PreferredTransparency"):Connect(setBackgroundTransparency)
setBackgroundTransparency()

ReducedMotionEnabled

Hidden
Read Only
Not Replicated
Read Parallel

Code Samples

Use Reduced Motion

local DEFAULT_TRANSPARENCY = 0.5
local frame = script.Parent
local endPosition = UDim2.fromScale(0.5, 0.8)
if GuiService.ReducedMotionEnabled then
frame.Position = endPosition
else
local moveTweenInfo = TweenInfo.new(0.5)
local moveTweenProps = {
Position = endPosition,
}
local moveTween = TweenService:Create(frame, slideInTweenInfo, slideInTweenProps)
moveTween:Play()
end

SelectedObject

Read Parallel

Code Samples

Printing When Gamepad Selection Changes

local GuiService = game:GetService("GuiService")
local function printChanged(value)
if value == "SelectedObject" then
print("The SelectedObject changed!")
end
end
GuiService.Changed:Connect(printChanged)

TopbarInset

Read Only
Not Replicated
Read Parallel

Code Samples

Responsive Frame Within Available Top Bar Space

local GuiService = game:GetService("GuiService")
local Players = game:GetService("Players")
local screenGui = Instance.new("ScreenGui")
screenGui.IgnoreGuiInset = true
screenGui.Parent = Players.LocalPlayer.PlayerGui
local frame = Instance.new("Frame")
frame.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
frame.Parent = screenGui
GuiService:GetPropertyChangedSignal("TopbarInset"):Connect(function()
local inset = GuiService.TopbarInset
frame.Size = UDim2.new(0, inset.Width, 0, inset.Height)
frame.Position = UDim2.new(0, inset.Min.X, 0, inset.Min.Y)
end)

TouchControlsEnabled

Read Parallel

ViewportDisplaySize

Read Only
Not Replicated
Roblox Script Security
Read Parallel

Methods

CloseInspectMenu

()

Returns

()

DismissNotification

Parameters

notificationId: string

Returns

GetEmotesMenuOpen


Returns

GetGameplayPausedNotificationEnabled


Returns

GetGuiInset


Returns

GetInspectMenuEnabled


Returns

InspectPlayerFromHumanoidDescription

()

Parameters

humanoidDescription: Instance
name: string

Returns

()

Code Samples

Opening an Inspect Menu with a HumanoidDescription

local GuiService = game:GetService("GuiService")
local humanoidDescription = Instance.new("HumanoidDescription")
humanoidDescription.HatAccessory = "3339374070"
humanoidDescription.BackAccessory = "3339363671"
GuiService:InspectPlayerFromHumanoidDescription(humanoidDescription, "MyPlayer")

InspectPlayerFromUserId

()

Parameters

userId: number

Returns

()

Code Samples

Opening the Inspect Menu for a UserId

local GuiService = game:GetService("GuiService")
GuiService:InspectPlayerFromUserId(772462)

IsTenFootInterface


Returns

Select

()

Parameters

selectionParent: Instance

Returns

()

Code Samples

Use Preferred Transparency

local DEFAULT_TRANSPARENCY = 0.5
local frame = script.Parent
local function setBackgroundTransparency()
frame.BackgroundTransparency = DEFAULT_TRANSPARENCY * GuiService.PreferredTransparency
end
GuiService:GetPropertyChangedSignal("PreferredTransparency"):Connect(setBackgroundTransparency)
setBackgroundTransparency()

SendNotification

Parameters

notificationInfo: Dictionary

Returns

SetEmotesMenuOpen

()

Parameters

isOpen: boolean

Returns

()

SetGameplayPausedNotificationEnabled

()

Parameters

enabled: boolean

Returns

()

SetInspectMenuEnabled

()

Parameters

enabled: boolean

Returns

()

Events