So I have a music system, which is basically 2 modules and a controller. One module contains a playlist and one module contains the authorized users who can execute commands and manage the songs. The controller basically mixes all of this and makes the sounds play.
Now let’s get to the problem:
The sounds are being played in parts (speakers) inside a folder. The controller takes a random ID, turns it into an instance (Sound), creates the instances in the parts (speakers) and plays them at the same time. The problem is that when the script plays all the sounds, some sounds are being played at different times, with a difference of a few ms. The code is a bit large, so if you need to see some parts of the code, I’m willing to send it to you.
I’m having some headache with this, if you can help me, I’ll be very grateful to you
Perhaps you can use ContentProvider:PreloadAsync() to load the sounds beforehand on the client so it would be able to play without having to load the sounds on the spot and delay the sounds.
local function preloadSound(songID)
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://" .. songID
local success, err = pcall(function()
ContentProvider:PreloadAsync({sound})
end)
if success then
log("Successfully preloaded sound: " .. sound.SoundId)
else
warn("[MUSICSYS] Failed to preload sound: " .. sound.SoundId .. " | Error: " .. tostring(err))
end
sound:Destroy() -- cleans the instance after being loaded
end
Unfortunately, it didn’t worked. Some sounds are still playing in different times.