When you load a sound into a player’s torso, for example (it can be any item in workspace), with the sound having its PlayOnRemove setting set to True, and then delete it (either by pressing Delete or by removing it via script), it doesn’t play. If you do the same from the player’s PlayerGui, however, it plays half the sound before stopping. Am I doing something wrong?
You startled me with the deprecation comment, but I’m glad it’s not an issue that’s unique to me. I can’t work on my sound system without them working properly.
I’m having the same issue since last client update. This also includes playing sounds in any instances within the character, even if it was created from a seperate source. PlayOnRemove doesn’t matter.
This has literally broke sounds on at least 1/2 of my games including my sound engine, pls revert/fix?
@ChadTheCreator
I’m trying it with code like this (Inside StarterCharacterScripts).
local test = Instance.new(“Sound”)
test.SoundId = “rbxassetid://487726169”
test.Parent = script.Parent.Torso
test.PlayOnRemove = true
print(test.IsLoaded)
test.Parent = nil
This does not work, the print is false and there is an error message in the console (onSoundLoaded cannot find SoundService…). Is this the problem you’re getting?
This is fixed by waiting until IsLoaded is true for the sound you’ve just created/cloned.
I’m saying you shouldn’t need a loop with a wait in it in order to tell when something happens. It’s a hacky alternative to events. Something like sound.Loaded:wait() sound:Destroy() would be nicer.
EDIT: yeah it does work, TimeLength is set when the sound is being loaded and that triggers the Changed event.
Try if you want:
local sound = Instance.new("Sound", workspace)
sound.SoundId = "rbxassetid://487726169"
sound.PlayOnRemove = true
while not sound.IsLoaded do sound.Changed:wait() end
sound:Destroy()
Won’t work without fourth line and it’ll work fine for both the wait() and .Changed:wait() versions.
For example, my animation engine makes parts within other parts in the character. When a sound is placed in one of these parts, preloaded, and played, it doesn’t work anymore. No errors, running in localscript. I’ll try to get a repo later when I get to a computer.
I’ve tried waiting until the sound is loaded, nothing seems to work. The sound won’t play in a test server, regardless of whether or not I’m using the PlayOnRemove way or the simple :Play() way.
For reference, this is what prints when I delete the sound (after waiting for it to load, with PlayOnRemove set to true): onSoundLoaded cannot find SoundService Sound(Fire3) SoundId(rbxassetid://166423137)
Update: Solved it. Apparently my sounds MinDistance was set to 0, which causes it to never play
Edit:
I have a repo. If you make a new sound in ANY part in workspace, it refuses to play. By placing it in a global area like Workspace by itself, it runs fine. MaxDistance/MinDistance are not making a difference.
I know this hasn’t been replied to for almost 4 years ago at the time of posting, but I genuently had this problem myself and could not find anywhere else where someone else had this specific problem and, therefore, had to figure it out myself. I’d now like to share this information with future developers having this exact problem and coming to this topic to seek answers.
The solution is to set EmitterSize to a positive integer. Simple, but hard to find at first glance.