How do I stop a singleton music track on certain scenes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By CuriosJammer

I want to stop a singleton track. It will mostly be the one the player will hear, but I want to make a script that when the player is on a certain scene, that track will stop and other will play. And if other of the scenes where it should play it’s entered, the track is resetted and starts again. How do I do this?

You could probably just assign a new AudioStream to the underlying AudioStreamPlayer when/as necessary. But really, it depends on what your current singleton code looks like. Maybe edit your question and post that code? If you do that, be sure to use the {} buttons to formatted the pasted code.

jgodfrey | 2023-02-04 19:14

:bust_in_silhouette: Reply From: Gluon

There is a stream pause option which you can use the following


If true, the playback is paused. You can resume it by setting stream_paused to false.

Documentation is found here