Hello everyone! I have a music queue system setup where it puts songs in a queue and plays them in order. It does this on the server so it is synchronized across all clients. The sound object is in the workspace and it simply loads the sound ID and then plays it, and since this is happening on the server and clients have access to the workspace, it is synchronized across all clients.
However, there is a problem that happens sometimes. The sound sometimes fails to load for only specific clients, and for the rest of the clients, it loads fine. Those “specific clients” have to rejoin to hear the music properly.
Is there any way to prevent this issue from happening? It can get really annoying sometimes.
1 Like
Hello, have you tried using PreloadAsync() to load the song before playing it? Here is a link to the Dev Hub where you can read more about it: ContentProvider | Documentation - Roblox Creator Hub
Hope it helps!
4 Likes
The thing is that it gets the songs from an external website, meaning the songs are practically undefined.
Actually, now that I think about it, since the song IDs aren’t undefined, I can pre-load every song in the music player. But how exactly would I do that?
You can make a table of all the ID’s and use PreloadAsync() to load them
Read this to get a better understanding: ContentProvider | Documentation - Roblox Creator Hub
Yes, I already put the IDs in a queue. A song is actually a table in my queue, containing the pitch, song ID, and song name for the song.
Make a table just for the song ID and then use PreloadAsync()
Okay, I have implemented this into the code. I haven’t fully tested it, but if any issues of this get reported, I’ll be sure to let you know! For now, I will mark your reply as a solution.
Thank you, if there are any errors, just ask me here
And the issue with failed to load still happens.
Is HTTP service enabled in your game?
Yes. HTTPService is enabled as I use several external web APIs.