As it currently stands, it is impossible to stop, pause, or resume sounds or otherwise modify their properties such as volume, time position, etc. from a plugin. Since Sound:Play() does not work outside of runtime, plugins are forced to use SoundService:PlayLocalSound(). Due to the way this was set up, it unfortunately does not allow plugins to have any sort of influence over the sound. This is an issue, as some plugin may revolve around audio. In my specific use-case, I planned to make an audio library plugin, but I discovered that was not reasonably possible shortly thereafter. By addressing this issue, developers will be able to properly manipulate audio via plugins, as they are currently unable to.
I can actually see huge use-cases to fixing this, it would allow for audio visualizer plugins where you can manipulate sounds and see how they react. You can still do it in studio without any plugin, but it’s difficult and not very user-friendly.
Hey Bobytoeburrito,
Since time is essentially halted in the studio editor, Sound
s are not playable. This unfortunately restricts a lot of other behavior, including plugin usage. We are aware that we need a better solution to this.
However, it looks like there is a special exception for plugins – Sounds are playable if they are descendants of a PluginGui
. Does this help your use-case?
Yes, that’s a viable workaround. Thank you so much! Is this information documented anywhere? I can imagine such obscure information could be beneficial to developers.
(also why does this exception occur?)
Yeah I was going to say that then it would be impossible to play via properties.
It doesn’t look like it’s documented – we’ll get that added to the docs. This exception was added to permit Plugins to play sounds (bypassing the typical restrictions) – but it’s not ideal, since it enforces hierarchy restrictions on Sounds in order to be playable
A hacky method is to use widgets. It literally works somehow. Parent a sound to a widget, boom.