Sound Objects not Incorporating SFX Children when Destroyed and PlayOnRemove = true

I’ve recently came across a bug when adding SFX Objects to my games. This is present ingame as well as in studio.

For a Sound Object with any SFX Modifier, if you have PlayOnRemove set to true and play it through “Sound:Destroy()”, it plays the sound as if it has no children. I feel like this wasn’t intended. However, if you play the sound through ’ Sound:Play() ', it doesn’t have this issue.

Repro

  • Create/Open an empty baseplate in Studio
  • Run/Play the game
  • Run the code sample below in the command bar
--'This code plays the audio as if newSFX does not exist

local newSound = Instance.new("Sound")
newSound.Parent = workspace
newSound.SoundId = "rbxassetid://452267918"
newSound.PlayOnRemove = true
local newSFX = Instance.new("PitchShiftSoundEffect")
newSFX.Parent = newSound
newSFX.Octave = 2
newSound:Destroy()

--'If you replace newSound:Destroy() with newSound:Play() it will work as intended.

Here is the place file that replicates the bug. I’ve added some UI buttons to make it easier to demonstrate. However, they’re not required for the bug to work.
Sound_Inheritance_Bug.rbxl (21.9 KB)

Here is a game link of the file above to show that it’s in game as well as in studio:
https://www.roblox.com/games/4895052246/Sound-Inheritance-Bug

Try parenting it to nil before destroying it.

I think :Destroy() is destroying the children before the sound itself. Probably not, but maybe…