PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Selection

Show deprecated

Selection

Show deprecated

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.

Properties

Functions

Objects

Get ( )

Returns an array of currently selected Instances in Roblox Studio.

void

Set ( Objects selection )

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

Events

RBXScriptSignal

SelectionChanged ( )

Fires when the Instances selected in Roblox Studio changes.