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

SelectionChanged

Fires when the Instances selected in Roblox Studio changes.

Note this event does not give the new selection. Developers will need to use Selection's 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 Selection/Set function.


Code Samples


Selection.SelectionChanged

This example prints the number of selected items whenever SelectionChanged is fired:

local selection = game:GetService("Selection")
selection.SelectionChanged:Connect(function()
	print("Selection contains " .. #selection:Get() .. " items.")
end)