エンジンクラス
Selection
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
概要
プロパティ
コードサンプル
選択
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
endSelection.SelectionChanged
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)設定
local selected = Selection:Get()
table.insert(selected, object)
Selection:Set(selected)イベント
SelectionChanged
コードサンプル
Selection.SelectionChanged
local selection = game:GetService("Selection")
selection.SelectionChanged:Connect(function()
print("選択には " .. #selection:Get() .. " アイテムが含まれています。")
end)