Sound PlayOnRemove does not work in Studio

Deleting a sound with PlayOnRemove should play it, however when in Studio (not Playtesting), the sound does not play.

Steps to reproduce:

  1. Open/Create a place.
  2. Create a sound.
  3. Give it a SoundId that you can hear and let it load on your client.
  4. Check PlayOnRemove.
  5. Delete it.
    You will notice you do not hear it.

PlayOnRemove works correctly when the game is running, and when running in Studio Play Solo. It is specifically just when you are not playing.

This is used for a few reasons, and one of those is my workflow has a Team Create plugin that publishes notifications to everyone in the session. Now, it is impossible for everyone who is in Team Create to hear the sound effect. Using a plugin to run SoundService:PlayLocalSound() is a local sound, only 1 person can hear it.

Expected behavior

I expect in Studio that PlayOnRemove will actually play the sound when it’s removed.

6 Likes

I think they prob removed it so break those freemodels who have a sound with PlayOnRemove ticked, so when you removed it it will play a loud noise (like a scream or smth)

2 Likes

Hey Raterix, this is actually intended behavior. In the editor, time is halted, which prevents Sound.TimePosition from advancing as normal – Sound.PlayOnRemove and SoundService:PlayLocalSound do not bypass this.

That said, we recognize that this hampers usability in plugins, so there’s an exception for Sounds that are descendants of a PluginGui – Sounds that are descendants of a PluginGui are always playable, as if time weren’t stopped. Does that help for your use case?

1 Like

It is impossible to distribute a sound to other users connected to the Team Create session plugin gui unless I create my own custom plugin, and it then listens to an external http network webhook, which significantly complicates the process.

1 Like

I see; so you’re storing the Sounds somewhere in the DataModel so that they replicate to other users in TeamCreate?

The newer AudioPlayer API that we announced at RDC is playable in edit-mode – that might make this a bit easier to script. It is enabled, but not officially released yet, so there might be some quirks. Let me know if you use it and encounter any issues

1 Like

It’s a very good system, especially the loop regions.

In previous builds in studio however, I really just needed to create a sound, and check PlayOnRemove, and everyone in the session heard it, simple as that.

1 Like

I remember this worked some time ago. When was this change made?

1 Like

Around October of last year I believe.

1 Like

Sound.PlayOnRemove and SoundService:PlayLocalSound both operate by creating a “detached copy” of the sound (that’s separate from the associated instance). But, before doing that, they check whether time is progressing; otherwise it’d be possible to create a detached copy that plays forever; its TimePosition would never be nonzero.

That effectively prevents them from playing in the studio editor – if this used to play the sound on removal, it was likely a bug on our part, not intended behavior :sweat:

These detached copies have been – generally – a bit buggy. For example, they can’t loop for similar reasons – there’s no instance to call :Stop on! This might’ve been inadvertently patched-out during a different bugfix

2 Likes