Don't destroy a variable when changing scene

How can I keep the music that plays when I change scene, but after some scenes (e.g. the fourth one) the music stops?

you can use “DontDestroyOnLoad(gameObject);” and use if(Application.loadedLevel == “your level name were you want the music to stop”){ audio.Stop();}

try it out it should work!

it’s ok that you are destroying the music else you can simply
use isEnabled = false; and your music will be disabled…This works with gameobjects,3d text etc…as well…Cheers