Sounds continue playing after being removed

This happens when a sound is already playing and it gets removed. Shouldn’t it stop playing? PlayOnRemove is disabled in this case.

4 Likes

Are you using :Remove or :Destroy?

Same thing happening here, it also happens if you :LoadCharacter() on a player.

I’m bringing up this bug again because it is happening to me right now.

The weird thing is in the script that is supposed to stop the sound, .Volume = 0 won’t even work.
(The sound is supposed to be playing from a part by the way.)

freddy.FakeHead.Music.Volume = 0
freddy.FakeHead.Music:Stop()
freddy.FakeHead.Music:Destroy()
freddy:Destroy()

But with other sounds in the same script, it will stop or turn the volume down. So basically this bug applies to one sound for me. And also, the bug only happens in a live server, doesn’t happen in play solo.

Sounds are just overall annoying to work with.

I’ve never used sounds before, but all I see among developers is a shared disgust with how they work.

So we don’t even have the capability to ensure that a sound stops playing?

1 Like

Bumping because this is still a problem that is happening in my game. Has anyone who has had this problem found a solution?

1 Like

This behavior is actually good imo. Since they updated sounds to where :Play() automatically stops any other sounds played from the same sound object, you have to create a new sound object each time you want to play a sound. Because we don’t want to have to deal with keeping track of these sounds, it’s common to do:

sound = Instance.new(“Sound”, obj)
sound.SoundId = soundId
sound:Play()
sound:Destroy()

That of course isn’t optimal, but with as common as that is thanks to the new sound behavior stopping sounds when they were destroyed would cause a bunch of games’ sounds to stop functioning.

I’ve been trying to make a physical radio that plays music for players nearby and automatically goes through a playlist:

while wait(1) do	
	if Model.Disco.Music.TimePosition == 0 and Model.Disco.Music.IsPlaying == false and Model.Disco.Music.IsPaused == true then
		Model.Disco.Music.SoundId = "http://roblox.com/asset?id="..Songs[math.random(1,#Songs)]
		Model.Disco.Music:Play()
	elseif Model.Disco.Music.TimePosition >= Model.Disco.Music.TimeLength - 0.1 then
		Model.Disco.Music:Stop()
	end
end

This code works PERFECTLY, exactly as intended into studio but as soon as I take it into an actual game, it calls :Play() every single cycle regardless of if a song is playing already or not. When the item is destroyed, it keeps playing the last song it was on until the song ends.

[quote] This behavior is actually good imo. Since they updated sounds to where :Play() automatically stops any other sounds played from the same sound object, you have to create a new sound object each time you want to play a sound. Because we don’t want to have to deal with keeping track of these sounds, it’s common to do:

sound = Instance.new(“Sound”, obj)
sound.SoundId = soundId
sound:Play()
sound:Destroy()

That of course isn’t optimal, but with as common as that is thanks to the new sound behavior stopping sounds when they were destroyed would cause a bunch of games’ sounds to stop functioning. [/quote]

A sound shouldn’t play if its associated object isn’t in a location that can play sounds (it’s the same thing as Scripts). What you should want is a “DestroyOnFinish” flag. PlayOnRemove is legacy cruft that should be deprecated.

Bringing this back up again cause I’m having issues with this as well. I have a wind turbine playing a looped sound in workspace, when I move the model with the sound into ReplicatedStorage or Lighting etc. the sound keeps playing as if it was there which doesn’t seem quite right…

1 Like

there is intentionally no behaviour of sounds not playing when under any specific parent or service (other than nil. they will stop playing when their ancestor is nil).

2 Likes

Bumping because we are in 2021 and this is still a thing, having a headache trying to solve this zzzzzz

Feel free to file a new bug report with the updated bug reporting format with a clear repro file – this bug report is very old and doesn’t meet current guidelines so likely won’t be investigated, so closing this.