We use cookies on this site to enhance your user experience

Selection

Selection

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.

Currently selected Instances can be obtained and set using the Selection/Get and 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()[1]:SetPrimaryPartCFrame(CFrame.new()) -- move the selected model to the origin

Note this class only applies to Roblox Studio and has no applicability to games.

Functions

Name Type Description

Get

Objects

Returns an array of currently selected Instances in Roblox Studio.

Set

void

Sets the currently selected objects in Roblox Studio to Instances in the given array.

Inherited from Instance

ClearAllChildren Clone Destroy FindFirstAncestor FindFirstAncestorOfClass FindFirstAncestorWhichIsA FindFirstChild FindFirstChildOfClass FindFirstChildWhichIsA GetChildren GetDebugId GetDescendants GetFullName GetPropertyChangedSignal IsA IsAncestorOf IsDescendantOf WaitForChild

Events

Name Type Description

Fires when the Instances selected in Roblox Studio changes.

Inherited from Instance

AncestryChanged Changed ChildAdded ChildRemoved DescendantAdded DescendantRemoving