When listening for changes to a sound’s EmitterSize property, GetPropertyChangedSignal does not fire.
This happens in both play mode and run mode (unsure when the bug started happening).
Edit: this happens in both the old and new lua vm.
Repro script:
local sound = Instance.new("Sound", workspace)
sound:GetPropertyChangedSignal("EmitterSize"):Connect(function()
warn("Emitter size changed: "..sound.EmitterSize)
end)
sound:GetPropertyChangedSignal("MaxDistance"):Connect(function()
warn("Max distance changed: "..sound.MaxDistance)
end)
sound.EmitterSize = 100 --doesn't print anything, but the property is changed (from the default of 10)
sound.MaxDistance = 200 --prints the new max distance
After looking into it with the Changed event, the EmitterSize carries the name “MinDistance”, so it will work if you connect it to that property.
This code will work.
It might be related to physics for 3D sound. It is normal for the Changed event to not fire on some properties.
“This event does not fire for physics-related changes, like when the CFrame , Velocity , RotVelocity , Position , Orientation and CFrame properties of a BasePart change due to gravity.”
Strange that this works, since Sound.MinDistance has been deprecated since 2016 and was renamed to EmitterSize. Whats even stranger is that the GetPropertyChangedSignals for both Pitch (also deprecated) and PlaybackSpeed fire when the sound’s PlaybackSpeed is changed.
Now the question remains, do I use MinDistance as a working alternative, or do I not since its deprecated?
I don’t think it’s bad practise to use MinDistance since Pitch still works. You could alternatively connect to both MinDistance and EmitterSize with a debounce if you can’t maintain the code later on.