A mistake. Music keeps doubling with every room

in game tab, I added this to the start script:

js = "function isMobilePlayer(){"
  js = js + "if (typeof(currentTab) === 'string'){return true;}return false;};"
src = GetFileURL("piano music.ogg")
JS.eval (js)
JS.eval ("var songVar = new Audio();songVar.src = '"+src+"';songVar.load();songVar.play();")
JS.eval ("var controlsOpt = '';if(isMobilePlayer()){controlsOpt = 'controls';}")
JS.eval ("addText (\"<audio autoplay loop \" + controlsOpt + \" src='" + src + "' />\");")

and I added this to the script when entering every room:
JS.eval ("scrollToEnd = function () {}")

It works well on Quest desktop but now when I play my game on browser, the one audio starts doubling and overlapping each other with every room I enter. what am I doing wrong here? please help


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums