This class is a Service! It is a top-level singleton which can be retrieved using the
This object cannot be created with the Instance.new constructor function.
The Selection service controls the
Instances that are selected in Roblox Studio.
This service is particularly useful when developing
Plugins, as it allows the developer to access and manipulate the current selection.
Instances can be obtained and set using the
Selection/Set functions. The
Selection/SelectionChanged event fires whenever the current selection changes.
For more information on using Selection and
Plugins please see
Articles/Intro to Plugins|this tutorial.
Selection is also often used in the command bar, to set hidden properties or run functions for selected
Instances. For example:
game.Selection:Get():SetPrimaryPartCFrame(CFrame.new()) -- move the selected model to the origin
Note this class only applies to Roblox Studio and has no applicability to games.
Returns an array of currently selected
Instances in Roblox Studio.
Sets the currently selected objects in Roblox Studio to
Instances in the given array.
Fires when the
Instances selected in Roblox Studio changes.