# Selection

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable, Service
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/Selection/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/Selection

The Selection service controls the [`Instances`](https://rapi.sleaze.dev/index/types/Instances.md) that are selected in Roblox Studio.

## Properties

### SelectionBoxThickness

```luau
Selection.SelectionBoxThickness: number
```

- Tags: Hidden, Read only, Roblox script security, Read capabilities: Basic, Save only

### SelectionLineThickness

```luau
Selection.SelectionLineThickness: number
```

- Tags: Hidden, Read only, Roblox script security, Read capabilities: Basic, Save only

### SelectionThickness

```luau
Selection.SelectionThickness: number
```

- Tags: Read only, Capabilities: Basic

The thickness of the selection highlight outline drawn around selected [`Instances`](https://rapi.sleaze.dev/index/types/Instances.md) in Roblox Studio's viewport.

### ActiveInstance

```luau
Selection.ActiveInstance: Instance
```

- Tags: Hidden, Read only, Roblox script security, Read capabilities: Basic

### RenderMode

```luau
Selection.RenderMode: Enum.SelectionRenderMode
```

- Tags: Hidden, Read only, Roblox script security, Read capabilities: Basic

### ShowActiveInstanceHighlight

```luau
Selection.ShowActiveInstanceHighlight: boolean
```

- Tags: Hidden, Not replicated, Roblox script security, Read capabilities: Basic

## Methods

### Add

```luau
Selection:Add(instancesToAdd: { Instance })
```

- Tags: Plugin security, Capabilities: Basic

Adds the given [`Instances`](https://rapi.sleaze.dev/index/types/Instances.md) to the current selection in Roblox Studio.

Parameters:

- `instancesToAdd`: An array of [`Instances`](https://rapi.sleaze.dev/index/types/Instances.md) to add to the current selection.

### AddFocusCallback

```luau
Selection:AddFocusCallback(priority: number, function: (...any) -> ...any): RBXScriptConnection
```

- Tags: Roblox script security, Capabilities: Basic

### ClearTerrainSelectionHack

```luau
Selection:ClearTerrainSelectionHack()
```

- Tags: Roblox script security, Capabilities: Basic

### Get

```luau
Selection:Get(): { Instance }
```

- Tags: Plugin security, Capabilities: Basic

Returns an array of currently selected [`Instances`](https://rapi.sleaze.dev/index/types/Instances.md) in Roblox Studio.

Returns: An array of currently selected [`Instances`](https://rapi.sleaze.dev/index/types/Instances.md).

### Remove

```luau
Selection:Remove(instancesToRemove: { Instance })
```

- Tags: Plugin security, Capabilities: Basic

Removes the given [`Instances`](https://rapi.sleaze.dev/index/types/Instances.md) from the current selection in Roblox Studio.

Parameters:

- `instancesToRemove`: An array of [`Instances`](https://rapi.sleaze.dev/index/types/Instances.md) to remove from the current selection.

### Set

```luau
Selection:Set(selection: { Instance })
```

- Tags: Plugin security, Capabilities: Basic

Sets the currently selected objects in Roblox Studio to [`Instances`](https://rapi.sleaze.dev/index/types/Instances.md) in the given array.

Parameters:

- `selection`: An array of [`Instances`](https://rapi.sleaze.dev/index/types/Instances.md) to set the current selection to.

### SetTerrainSelectionHack

```luau
Selection:SetTerrainSelectionHack(center: Vector3, size: Vector3)
```

- Tags: Roblox script security, Capabilities: Basic

## Events

### SelectionChanged

```luau
Selection.SelectionChanged: RBXScriptSignal<()>
```

- Tags: Capabilities: Basic

Fires when the [`Instances`](https://rapi.sleaze.dev/index/types/Instances.md) selected in Roblox Studio changes.

### SelectionChangedThisFrame

```luau
Selection.SelectionChangedThisFrame: RBXScriptSignal<()>
```

- Tags: Roblox script security, Capabilities: Basic

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
