How to make music keep playing while changing scene ?

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

In my game i have a scene called “Level1”. If player players dies i reload the same scene again with get_tree().change_scene(“res://Level1.tscn”) to make player replay the same level . Problem is everytime player dies the music resets and its kinda annoying. Is there a way to make stream_player dont reset while changing scenes.

:bust_in_silhouette: Reply From: godot_dev_

The way I got that to work is I have a root scene that never changes and I added the music player to that scene. Every time I add a or change scene (Level1 in your case), I instance the scene and add it to the root, removing the old scene.

This way my root scene can have the music player, and the music won’t stop when you change level scenes since the root scene will always exist.