요약
메서드
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
endAPI 참조
속성
메서드
Add
Selection:Add(instancesToAdd:Instances):()
매개 변수
instancesToAdd:Instances |
반환
()
Get
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
Selection:Remove(instancesToRemove:Instances):()
매개 변수
instancesToRemove:Instances |
반환
()
Set
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
코드 샘플
선택.선택변경됨
local selection = game:GetService("Selection")
selection.SelectionChanged:Connect(function()
print("선택에는 " .. #selection:Get() .. " 항목이 있습니다.")
end)