I want to find the best solution to a gun being in full auto, how to mix the gunshot sounds after each bullet to not have as much echo, but also not be choppy.
with my current code, ive tried a medium ground by having 5 of the same audio, but with different speeds in order to mix up the variaiton in the sounds, but i experience choppiness effects too often
heres the function i used after i fire each bullet
function SoundHandler.playAudio()
local viewmodel = workspace.CurrentCamera:FindFirstChildWhichIsA("Model")
if not viewmodel then return end
local shot = viewmodel.Sounds.Fire:GetChildren() :: Sound
local ourShot = shot[math.random(1, 5)]
ourShot.PlaybackSpeed = math.random(97.5, 102.5) / 100
ourShot:play()
end
Check if the mouse is being held down and then change something, not really sure on how larger dev’s fix this.
im trying to figure out how to layer the sound without creating a new sound for every bullet, and not reusing the same sound, i can manually adjust the pitch in an external software, but im trying to not have 15 sounds playing at the same time
personally how i did it was that i created a new sound object for each shot, set the PlayOnDestroy property to true, then I destroyed the object. But the idea of having a table of a few sounds doesn’t sound terrible to me.
How i would do this would be to define the table of sounds outside of thd function, then when the shot is fired, take the last sound out of the table and play it, then once its done playing, you put it back in the table. This way you don’t need to get a new table everytime. One obvious drawback to this method however is that the higher a gun’s fire rate is, the more sounds it would need. For this reason i would go with the method i wrote above.
1 Like