SelectionChanged fires once for every selected instance when grouping

Bug
When grouping or ungrouping instances, all the selected instances will be selected and unselected one at a time. As a result, the SelectionChanged event fires off every time.

Expected behavior
It is expected that the SelectionChanged event will only fire once with all the ungrouped parts selected or the newly grouped model selected.


Video demonstrating bug


Repro place
Repro.rbxl (20.7 KB)

Code snippet to print selection changes

game:GetService("Selection").SelectionChanged:Connect(function()
	local selectedInstances = game:GetService("Selection"):Get()
	print(#selectedInstances.." instances selected")
end)
10 Likes

Going to put this on our internal tracker, thanks for the find!

4 Likes

A fix for this is in the pipeline and will hopefully come in a few weeks. It may still call more than once, but should be at most twice or so, and definitely not per instance.

2 Likes

Awesome! Glad to hear a fix for this is coming out as I’ve noticed that when selecting thousands of instances it can still hang studio up temporarily.

To be fair I’m not sure if that’ll be fixed–it’s still going to select everything, but it won’t count as N selections if there’s N instances.

1 Like

I think a lot of the issues on my end are plugins that are listening to SelectionChanged so they end up doing a lot of work when selecting thousands of parts right now.

I don’t know if it will 100% fix all the performance issues, but I’m sure it will still help a good amount at a minimum.

1 Like

Apologies on the delay, I just flipped on my fix for this today.

3 Likes