Sound will not play after being played repeatedly

So I am creating a gun and everything seems to work except the sound. The gun shooting sound doesn’t play after being played 10 times (after 1 mag)

I’ve tried using ContentProvider but that doesn’t seem to work.
Here’s the code for the ContentProvider:

local ContentProvider = game:GetService("ContentProvider")
local sounds = {}

for _, v in ipairs(weapon:GetDescendants()) do
	if v:isA("Sound") then
		table.insert(sounds,v)
	end
end
ContentProvider:PreloadAsync(sounds)

Here is the video:

Am I doing something wrong? If I am can someone please tell me how to fix it?

If this is happening after you reload the weapon, mind showing how your reload works? or at least how its fired?

A couple questions for you. How are you using Content provider? Are you loading after each shot? Or each set of 10 shots? Or once overall? (Seeing that code I am assuming once, but you could have wrapped it in a function to be called more then once) I used content provider and have only needed for it to run once for it to load. An idea too, is to load the SoundId instead of the Sound Instance, by changing it to table.insert(sounds,v.SoundId). I also know roblox studio acts weird and just does an infinite yield in the Studio test, but works fine in roblox player (still need a solution to this for me. I’m not sure why yet… Maybe its a group owned game or a Team created experience that causes this? I really don’t know why)

Let me know the answer to these. Also sharing more of your script can be useful!

1 Like

It’s probably some issue with the code which plays the sound. Could you show it?

My bad. I was playing my sounds from the server side script and it plays when triggered by a localscript. Remote event didn’t fire the server.

Thanks for trying to help me though :))))

1 Like