Klasa silnika
Selection
*Ta zawartość została przetłumaczona przy użyciu narzędzi AI (w wersji beta) i może zawierać błędy. Aby wyświetlić tę stronę w języku angielskim, kliknij tutaj.
Podsumowanie
Właściwości
Metody
Add(instancesToAdd: Instances):() |
Get():Instances |
Remove(instancesToRemove: Instances):() |
Set(selection: Instances):() |
Zdarzenia
Przykłady kodu
Wybór
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
endMateriały referencyjne dotyczące interfejsów API
Właściwości
Metody
Add
Selection:Add(instancesToAdd:Instances):()
Parametry
instancesToAdd:Instances |
Zwroty
()
Get
Selection:Get():Instances
Zwroty
Instances
Przykłady kodu
Wybór
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
endZmiana.Wybór
local selection = game:GetService("Selection")
selection.SelectionChanged:Connect(function()
print("Wybór zawiera " .. #selection:Get() .. " elementów.")
end)Remove
Selection:Remove(instancesToRemove:Instances):()
Parametry
instancesToRemove:Instances |
Zwroty
()
Set
Selection:Set(selection:Instances):()
Parametry
selection:Instances |
Zwroty
()
Przykłady kodu
Zestaw wyboru
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)Zdarzenia
SelectionChanged
Przykłady kodu
Zmiana.Wybór
local selection = game:GetService("Selection")
selection.SelectionChanged:Connect(function()
print("Wybór zawiera " .. #selection:Get() .. " elementów.")
end)