I have been scratching my head for a while due to my AudioPlayer works fine in Roblox Studio but not in-game.
What I’ve been trying to achieve is to make a seamless transition music player that is playing in-sync with every player in the game.
I’ve noticed all you need would be AudioPlayer.Stop(), change the asset ID to the new song, then AudioPlayer.Start() correct?
When I debug using AudioPlayer:TimePosition(), in the server it works flawlessly even without any deferring, example if an Audio asset is 60 seconds long, the TimePosition will reset from 60 to 0 then play the next Audio asset.
But when I debug on the client, it somehow disrespect the AudioPlayer.Stop() and continue to play the next Audio asset starting at 61 TimePosition, where if the Audio asset is less than or equal to 60 seconds then it would just break or stop on its entirety and have to wait for the server to finish this next Audio asset.
What I did was only adding a small defer on the server after AudioPlayer.Stop() and I found a minimum of 3 seconds would be enough for everything to be working perfectly fine. But the question is: now the Audio playing from asset to another asset is not seamless! Anyone has experience with this?
PS: I have made sure to preload the next Audio asset beforehand