# This file is automatically generated. Please don't edit it manually. # To submit a bug report on the content, see # https://devforum.roblox.com/c/bug-reports/documentation-issues/72 name: Selection type: class memory_category: Instances summary: | The Selection service controls the `Class.Instance|Instances` that are selected in Roblox Studio. description: | The Selection service controls the `Class.Instance|Instances` that are selected in Roblox Studio. This service is particularly useful when developing `Class.Plugin|Plugins`, as it allows the developer to access and manipulate the current selection. Currently selected `Class.Instance|Instances` can be obtained and set using the `Class.Selection:Get()` and `Class.Selection:Set()` functions. The `Class.Selection.SelectionChanged` event fires whenever the current selection changes. For more information on using `Class.Selection` and `Class.Plugin|Plugins`, see `Class.Plugin`. Selection is also often used in the command bar, to set hidden properties or run functions for selected `Class.Instance|Instances`. Note this class only applies to Roblox Studio and has no applicability to games. code_samples: - Selection1 inherits: - Instance descendants: [] tags: - NotCreatable - Service deprecation_message: '' properties: - name: Selection.SelectionThickness summary: '' description: '' code_samples: [] type: float tags: - ReadOnly - NotReplicated deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Appearance serialization: can_load: false can_save: false capabilities: [] methods: - name: Selection:Add summary: '' description: '' code_samples: [] parameters: - name: instancesToAdd type: Instances default: summary: '' returns: - type: () summary: '' tags: [] deprecation_message: '' security: PluginSecurity thread_safety: Unsafe capabilities: [] - name: Selection:Get summary: | Returns an array of currently selected `Class.Instance|Instances` in Roblox Studio. description: | Returns an array of currently selected `Class.Instance|Instances` in Roblox Studio. If no `Class.Instance|Instances` are selected, the array returned will be empty. This function can be used in conjunction with the `Class.Selection.SelectionChanged` event to get the selection whenever it changes. Note, this function can only be used in `Class.Plugin|Plugins` or the command line. For changing the current selection, please see `Class.Selection:Set()`. code_samples: - Selection1 - Selection-SelectionChanged1 parameters: [] returns: - type: Instances summary: | An array of currently selected `Class.Instance|Instances`. tags: [] deprecation_message: '' security: PluginSecurity thread_safety: Unsafe capabilities: [] - name: Selection:Remove summary: '' description: '' code_samples: [] parameters: - name: instancesToRemove type: Instances default: summary: '' returns: - type: () summary: '' tags: [] deprecation_message: '' security: PluginSecurity thread_safety: Unsafe capabilities: [] - name: Selection:Set summary: | Sets the currently selected objects in Roblox Studio to `Class.Instance|Instances` in the given array. description: | Sets the currently selected objects in Roblox Studio to `Class.Instance|Instances` in the given array. Calling this function will cause the `Class.Selection.SelectionChanged` event to fire, unless the new selection set is identical to the previous selection. Note this function overwrites the existing selection. However, using `Class.Selection:Get()` an `Class.Instance` can be added to the existing selection like so: ``` local selected = Selection:Get() table.insert(selected, object) Selection:Set(selected) ``` code_samples: - SelectionSet1 parameters: - name: selection type: Instances default: summary: | An array of `Class.Instance|Instances` to set the current selection to. returns: - type: () summary: '' tags: [] deprecation_message: '' security: PluginSecurity thread_safety: Unsafe capabilities: [] events: - name: Selection.SelectionChanged summary: | Fires when the `Class.Instance|Instances` selected in Roblox Studio changes. description: | Fires when the `Class.Instance|Instances` selected in Roblox Studio changes. Note this event does not give the new selection. Developers will need to use the `Class.Selection:Get()` function to obtain the current selection. Although this event can be used outside of plugins and the command bar, it only applies to the selection in Roblox Studio and therefore has no functionality outside of Studio. To change the selection use the `Class.Selection:Set()` function. code_samples: - Selection-SelectionChanged1 parameters: [] tags: [] deprecation_message: '' security: None capabilities: [] callbacks: []