[resolved] SelectionChanged firing twice when set up once

RESOLVED: SelectionChanged accounts for UNSELECTION too, not just SELECTION, which is why it appeared to be firing twice. Didn’t expect this, but I can work with it no problem.

game.Selection.SelectionChanged:connect(function() print("selection changed: "..math.random(1,1000)) end)

When that’s put in the command bar, I expect that I only get one output print whenever I change selection of one object (meaning I am only selecting one object, not a group). It prints once for the first selection, but for the rest it prints twice. It seems to always print (AmountSelected+1) times whenever I change selection (so if I select 2 things it prints 3 times)

What’s causing it to print that extra time? Is it a bug or? I think it should only print once per selection, trying to make a custom property viewer and I feel like selectionchanged overkill-firing would mess that process up.

Does this issue happen for anyone else? I’m sure I’m only setting it up once.

Turn off your plugins and try again. One of your plugins is probably doing it.

All plugins disabled, still happened.

Found why it’s firing twice though, SelectionChanged also accounts for UNSELECTION, so when I single-object something else, it’s also unselecting from the previous object and selecting the new object. This should work in order though, Unselect -> Select, so it shouldn’t mess up custom property viewers. Thanks though.