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

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


สรุป
คุณสมบัติ
วิธีการ
Add(instancesToAdd: Instances):()
Get():Instances
Remove(instancesToRemove: Instances):()
Set(selection: Instances):()
เหตุการณ์
สมาชิกที่ได้รับทอด
ตัวอย่างโค้ด
การเลือก
local Selection = game:GetService("Selection")
for _, object in pairs(Selection:Get()) do
if object:IsA("BasePart") then
object.CFrame = object.CFrame * CFrame.Angles(0, math.pi / 2, 0)
end
end

เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
SelectionThickness
อ่านอย่างเดียว
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Selection.SelectionThickness:number

วิธีการ
Add
การรักษาความปลอดภัยของปลั๊กอิน
ความสามารถ: Basic
Selection:Add(instancesToAdd:Instances):()
พารามิเตอร์
instancesToAdd:Instances
ส่งค่ากลับ
()

Get
การรักษาความปลอดภัยของปลั๊กอิน
ความสามารถ: Basic
Selection:Get():Instances
ส่งค่ากลับ
Instances
ตัวอย่างโค้ด
การเลือก
local Selection = game:GetService("Selection")
for _, object in pairs(Selection:Get()) do
if object:IsA("BasePart") then
object.CFrame = object.CFrame * CFrame.Angles(0, math.pi / 2, 0)
end
end
การเปลี่ยนแปลงการเลือก
local selection = game:GetService("Selection")
selection.SelectionChanged:Connect(function()
print("การเลือกมี " .. #selection:Get() .. " รายการ.")
end)

Remove
การรักษาความปลอดภัยของปลั๊กอิน
ความสามารถ: Basic
Selection:Remove(instancesToRemove:Instances):()
พารามิเตอร์
instancesToRemove:Instances
ส่งค่ากลับ
()

Set
การรักษาความปลอดภัยของปลั๊กอิน
ความสามารถ: Basic
Selection:Set(selection:Instances):()
พารามิเตอร์
selection:Instances
ส่งค่ากลับ
()
ตัวอย่างโค้ด
การเลือกชุด
local Selection = game:GetService("Selection")
local newSelection = {}
for _, object in pairs(workspace:GetDescendants()) do
if object:IsA("BasePart") and object.BrickColor == BrickColor.new("Bright red") then
table.insert(newSelection, object)
end
end
Selection:Set(newSelection)

เหตุการณ์
SelectionChanged
ความสามารถ: Basic
Selection.SelectionChanged():RBXScriptSignal
ตัวอย่างโค้ด
การเปลี่ยนแปลงการเลือก
local selection = game:GetService("Selection")
selection.SelectionChanged:Connect(function()
print("การเลือกมี " .. #selection:Get() .. " รายการ.")
end)

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