เรียนรู้
Engine Class
GuiService
ไม่สามารถสร้าง
บริการ
ไม่ซ้ำ

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่


สรุป
วิธีการ
AddSelectionParent(selectionName: string,selectionParent: Instance):()
เลิกใช้แล้ว
AddSelectionTuple(selectionName: string,selections: Tuple):()
เลิกใช้แล้ว
IsTenFootInterface():boolean
เลิกใช้แล้ว
RemoveSelectionGroup(selectionName: string):()
เลิกใช้แล้ว
Select(selectionParent: Instance):()
สมาชิกที่ได้รับทอด

เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
AutoSelectGuiEnabled
อ่านพร้อมๆ กัน
ความสามารถ: UI, Input
GuiService.AutoSelectGuiEnabled:boolean

CoreGuiNavigationEnabled
ซ่อนอยู่
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: UI, Input
GuiService.CoreGuiNavigationEnabled:boolean

GuiNavigationEnabled
อ่านพร้อมๆ กัน
ความสามารถ: UI, Input
GuiService.GuiNavigationEnabled:boolean

IsModalDialog
เลิกใช้แล้ว

IsWindows
เลิกใช้แล้ว

MenuIsOpen
อ่านอย่างเดียว
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: UI
GuiService.MenuIsOpen:boolean

PreferredTextSize
อ่านอย่างเดียว
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: UI
GuiService.PreferredTextSize:Enum.PreferredTextSize
ตัวอย่างโค้ด
ตรวจจับ/ใช้การเปลี่ยนแปลงขนาดข้อความที่ต้องการ
local GuiService = game:GetService("GuiService")
local TextService = game:GetService("TextService")
local FONT_SIZE = 25
local PADDING = 8
local textLabel = Instance.new("TextLabel")
textLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
textLabel.AnchorPoint = Vector2.new(0.5, 0.5)
textLabel.AutomaticSize = Enum.AutomaticSize.X
textLabel.TextSize = FONT_SIZE + PADDING
textLabel.Text = "การทดสอบป้ายข้อความ"
textLabel.Parent = script.Parent
local function applyAddedTextHeight()
local finalTextHeight = TextService:GetTextSize("", FONT_SIZE, Enum.Font.BuilderSans, Vector2.new(math.huge, math.huge)).Y
local addedTextHeight = finalTextHeight - FONT_SIZE
print("PreferredTextSize เพิ่ม", addedTextHeight, " ไปยังขนาดข้อความเริ่มต้น")
textLabel.Size = UDim2.new(0, 0, 0, FONT_SIZE + addedTextHeight + PADDING)
end
applyAddedTextHeight()
GuiService:GetPropertyChangedSignal("PreferredTextSize"):Connect(applyAddedTextHeight)

PreferredTransparency
ซ่อนอยู่
อ่านอย่างเดียว
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: UI
GuiService.PreferredTransparency:number
ตัวอย่างโค้ด
ตรวจจับ/ปรับเปลี่ยนการโปร่งใสที่ต้องการ
local GuiService = game:GetService("GuiService")
local CollectionService = game:GetService("CollectionService")
local TAG = "TransparentBack"
local transparentBackObjects = {}
local function onInstanceAdded(object)
if object.BackgroundTransparency then
local defaultTransparency = object.BackgroundTransparency
transparentBackObjects[object] = defaultTransparency
object.BackgroundTransparency = defaultTransparency * GuiService.PreferredTransparency
end
end
local function onInstanceRemoved(object)
transparentBackObjects[object] = nil
end
-- เก็บอินสแตนซ์ที่ถูกแท็กเริ่มต้น
for _, object in CollectionService:GetTagged(TAG) do
onInstanceAdded(object)
end
-- ตรวจจับเมื่ออินสแตนซ์ที่ถูกแท็กถูกเพิ่มหรือลบ
CollectionService:GetInstanceAddedSignal(TAG):Connect(onInstanceAdded)
CollectionService:GetInstanceRemovedSignal(TAG):Connect(onInstanceRemoved)
-- เมื่อตั้งค่าในเกมเปลี่ยนแปลง ให้ปรับอินสแตนซ์ที่ถูกแท็ก
GuiService:GetPropertyChangedSignal("PreferredTransparency"):Connect(function()
for object, defaultTransparency in transparentBackObjects do
object.BackgroundTransparency = defaultTransparency * GuiService.PreferredTransparency
end
end)

ReducedMotionEnabled
ซ่อนอยู่
อ่านอย่างเดียว
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: UI
GuiService.ReducedMotionEnabled:boolean

SelectedObject
อ่านพร้อมๆ กัน
ความสามารถ: UI, Input
GuiService.SelectedObject:GuiObject
ตัวอย่างโค้ด
การพิมพ์เมื่อการเลือก Gamepad เปลี่ยน
local GuiService = game:GetService("GuiService")
local function printChanged(value)
if value == "SelectedObject" then
print("SelectedObject ถูกเปลี่ยนแปลง!")
end
end
GuiService.Changed:Connect(printChanged)

TopbarInset
อ่านอย่างเดียว
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: UI
GuiService.TopbarInset:Rect
ตัวอย่างโค้ด
กรอบที่ตอบสนองภายในพื้นที่แถบด้านบนที่มีอยู่
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
อ่านพร้อมๆ กัน
ความสามารถ: UI, Input
GuiService.TouchControlsEnabled:boolean

ViewportDisplaySize
อ่านอย่างเดียว
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: UI
GuiService.ViewportDisplaySize:Enum.DisplaySize
ตัวอย่างโค้ด
การเปลี่ยนแปลงขนาดการแสดงผลของ Viewport
local GuiService = game:GetService("GuiService")
local function updateUI()
if (GuiService.ViewportDisplaySize == Enum.DisplaySize.Small) then
-- อัปเดต UI ให้เหมาะกับหน้าจอขนาดเล็ก
elseif (GuiService.ViewportDisplaySize == Enum.DisplaySize.Large) then
-- อัปเดต UI ให้เหมาะกับหน้าจอขนาดใหญ่
else
-- อัปเดต UI ให้เหมาะกับหน้าจอขนาดกลาง/ค่าปกติ
end
end
GuiService:GetPropertyChangedSignal("ViewportDisplaySize"):Connect(updateUI)
updateUI()

วิธีการ
AddSelectionParent
เลิกใช้แล้ว

AddSelectionTuple
เลิกใช้แล้ว

CloseInspectMenu
ความสามารถ: UI
GuiService:CloseInspectMenu():()
ส่งค่ากลับ
()

DismissNotification
ความสามารถ: UI
GuiService:DismissNotification(notificationId:string):boolean
พารามิเตอร์
notificationId:string
ส่งค่ากลับ

GetEmotesMenuOpen
ความสามารถ: UI
GuiService:GetEmotesMenuOpen():boolean
ส่งค่ากลับ

GetGameplayPausedNotificationEnabled
ความสามารถ: UI
GuiService:GetGameplayPausedNotificationEnabled():boolean
ส่งค่ากลับ

GetGuiInset
ความสามารถ: UI
GuiService:GetGuiInset():Tuple
ส่งค่ากลับ

GetInsetArea
ความสามารถ: UI
GuiService:GetInsetArea(screenInsets:Enum.ScreenInsets):Rect
พารามิเตอร์
screenInsets:Enum.ScreenInsets
ส่งค่ากลับ

GetInspectMenuEnabled
ความสามารถ: UI
GuiService:GetInspectMenuEnabled():boolean
ส่งค่ากลับ

InspectPlayerFromHumanoidDescription
ความสามารถ: UI, AvatarAppearance
GuiService:InspectPlayerFromHumanoidDescription(
humanoidDescription:Instance, name:string
):()
พารามิเตอร์
humanoidDescription:Instance
name:string
ส่งค่ากลับ
()
ตัวอย่างโค้ด
การเปิดเมนูตรวจสอบด้วย HumanoidDescription
local GuiService = game:GetService("GuiService")
local humanoidDescription = Instance.new("HumanoidDescription")
humanoidDescription.HatAccessory = "3339374070"
humanoidDescription.BackAccessory = "3339363671"
GuiService:InspectPlayerFromHumanoidDescription(humanoidDescription, "MyPlayer")

InspectPlayerFromUserId
ความสามารถ: UI, AvatarAppearance
GuiService:InspectPlayerFromUserId(userId:User):()
พารามิเตอร์
userId:User
ส่งค่ากลับ
()
ตัวอย่างโค้ด
การเปิดเมนูตรวจสอบสำหรับ UserId
local GuiService = game:GetService("GuiService")
GuiService:InspectPlayerFromUserId(772462)

IsTenFootInterface
เลิกใช้แล้ว

RemoveSelectionGroup
เลิกใช้แล้ว

Select
ความสามารถ: UI
GuiService:Select(selectionParent:Instance):()
พารามิเตอร์
selectionParent:Instance
ส่งค่ากลับ
()

SendNotification
ความสามารถ: UI
GuiService:SendNotification(notificationInfo:Dictionary):string
พารามิเตอร์
notificationInfo:Dictionary
ส่งค่ากลับ

SetEmotesMenuOpen
ความสามารถ: UI
GuiService:SetEmotesMenuOpen(isOpen:boolean):()
พารามิเตอร์
isOpen:boolean
ส่งค่ากลับ
()

SetGameplayPausedNotificationEnabled
ความสามารถ: UI
GuiService:SetGameplayPausedNotificationEnabled(enabled:boolean):()
พารามิเตอร์
enabled:boolean
ส่งค่ากลับ
()

SetInspectMenuEnabled
ความสามารถ: UI
GuiService:SetInspectMenuEnabled(enabled:boolean):()
พารามิเตอร์
enabled:boolean
ส่งค่ากลับ
()

เหตุการณ์
MenuClosed
ความสามารถ: UI
GuiService.MenuClosed():RBXScriptSignal

MenuOpened
ความสามารถ: UI
GuiService.MenuOpened():RBXScriptSignal

©2026 Roblox Corporation. Roblox, โลโก้ Roblox และ Powering Imagination เป็นส่วนหนึ่งของเครื่องหมายการค้าที่จดทะเบียน และไม่ได้จดทะเบียนของเราในสหรัฐฯ และประเทศอื่นๆ