Audio Buggy - Game Lag

Hello,
I’ve recently been experiencing issues with audio and lag in my game. We haven’t made any adjustments, but the problems seem to affect the walking sounds and gun sounds in particular. I believe this might be a Roblox-side issue, since we haven’t changed anything on our end. Additionally, the game has started lagging unexpectedly.
I can provide a game file to roblox staff if needed.
Same issue as: Major audio issues, stutters, and heavy lag

Expected behavior

The walking sounds should not sound disrupted.
Gun sounds should not cut out while firing.

A private message is associated with this bug report

I can attach a video if needed or the game link.

Hey @James_Watermelons – if this is the same problem as the linked thread, there was an update which unintentionally made assigning Sound.SoundId always re-load the underlying audio asset – even if the new SoundId is equal to the existing SoundId.

This is being fixed in the next version of engine – but until then, you can work around it by adding guard code like

local oldId = theSound.SoundId
if oldId ~= newId then
    theSound.SoundId = newId
else
    -- don't assign SoundId to anything it already is
end

Alright, thanks. Since there’s quite a lot to replace, I’ll wait for the next update. When it arrives, will the lag caused by this issue go away as well?

We believe so, yes – loading & unloading assets is semi-expensive, so if you’re e.x. reassigning the SoundId in a loop multiple times per frame per sound, that can add up.

Alright, thank you for the response. I will wait for the engine update. If I still experience any issues after the new engine update , I’ll submit another bug report etc.