Engine-klasse
Selection
*Deze inhoud is vertaald met behulp van AI (bèta) en kan fouten bevatten. Klik hier om deze pagina in het Engels te bekijken.
Samenvatting
Eigenschappen
Methoden
Add(instancesToAdd: Instances):() |
Get():Instances |
Remove(instancesToRemove: Instances):() |
Set(selection: Instances):() |
Evenementen
Codevoorbeelden
Selectie
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-referentie
Eigenschappen
Methoden
Add
Selection:Add(instancesToAdd:Instances):()
Parameters
instancesToAdd:Instances |
Teruggaves
()
Get
Selection:Get():Instances
Teruggaves
Instances
Codevoorbeelden
Selectie
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("Selectie bevat " .. #selection:Get() .. " items.")
end)Remove
Selection:Remove(instancesToRemove:Instances):()
Parameters
instancesToRemove:Instances |
Teruggaves
()
Set
Selection:Set(selection:Instances):()
Parameters
selection:Instances |
Teruggaves
()
Codevoorbeelden
Selectiegroep
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)Instellen
local selected = Selection:Get()
table.insert(selected, object)
Selection:Set(selected)Evenementen
SelectionChanged
Codevoorbeelden
Selection.SelectionChanged
local selection = game:GetService("Selection")
selection.SelectionChanged:Connect(function()
print("Selectie bevat " .. #selection:Get() .. " items.")
end)