エンジンクラス
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
end選択.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)イベント
SelectionChanged
コードサンプル
選択.SelectionChanged
local selection = game:GetService("Selection")
selection.SelectionChanged:Connect(function()
print("選択に含まれるアイテムは " .. #selection:Get() .. " 個です。")
end)