GuiService
Show Deprecated
Summary
Properties
Methods
Properties
AutoSelectGuiEnabled
CoreGuiNavigationEnabled
GuiNavigationEnabled
MenuIsOpen
PreferredTextSize
PreferredTransparency
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
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
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
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
ViewportDisplaySize
Methods
CloseInspectMenu
()
Returns
()
InspectPlayerFromHumanoidDescription
()
Parameters
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
Default Value: ""
Returns
()
Code Samples
Opening the Inspect Menu for a UserId
local GuiService = game:GetService("GuiService")
GuiService:InspectPlayerFromUserId(772462)
Select
()
Parameters
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()