Whenever I start a new audio for the first time, there's a large lag spike. My entire screen freezes for a few seconds.
I tried preloading the sounds, but it did not makes a difference.
I was wondering if there was any way to prevent this lag. I will not post my code, because it works fine, all I need to know is if this is possible, and if so how to do it.
This is actually quite simple to do! Roblox implemented some API in order to Preload assets, like sounds and images, so that it doesn't have to in the future (why you get the lag spikes).
local ContentProvider = Game:GetService("ContentProvider") local assetList = {} -- I suggest creating a table of asset ids (Ex: 130758889) for _, assetId in pairs(assetList) do ContentProvider:Preload("http://www.roblox.com/asset/?id=" .. assetId) end