Players cannot hear my sounds


net.Receive("KillCount", function()
	KillCount = net.ReadFloat()
	if KillCount == 1 then
		surface.PlaySound("killsounds/firstblood.wav")
		print("play the fucking sound")
	elseif KillCount == 2 then
		surface.PlaySound("killsounds/doublekill.wav")
	elseif KillCount == 5 then
		surface.PlaySound("killsounds/killingspree.wav")
	elseif KillCount == 10 then
		surface.PlaySound("killsounds/killingmachine.wav")
	elseif KillCount == 20 then
		surface.PlaySound("killsounds/ultrakill.wav")
	elseif KillCount == 30 then
		surface.PlaySound("killsounds/monsterkill.wav")
	elseif killCount == 50 then
		surface.PlaySound("killsounds/massacre.wav")
	end
end)

When the criteria of kills is met I receive this in the console “Failed to load sound “killsounds\firstblood.wav”, file probably missing from disk/repository”
I have my my sound files located in my addon “garrysmod/addons/myaddon/sound/killsounds/firstblood.wav”. Which should be correct according to the wiki.
I hope you guys can help! Thanks.

The file may be corrupted or unplayable. Could you send a link to one of the files just to test it?

There ya go!

Ok, after a lot of testing, I found you don’t need the filepath.



surface.PlaySound( "firstblood.wav" )


I just tried what you said, but it still didn’t work. It had the same error.
I’m running my server with the addon in SRCDS, maybe the client isn’t downloading the sound file?

If any of you think that this might be the issue, how would I force the client to download the sound files?

You have to add each file in downloads with

resource.AddFile

Yeah, that was it. I figured it out and came back to report this solved.
I put this in my server file. When the players join it works now. Then on the client side I used the same code above in the first post.


resource.AddFile("sound/killsounds/firstblood.wav")
resource.AddFile("sound/killsounds/doublekill.wav")
resource.AddFile("sound/killsounds/killingspree.wav")
resource.AddFile("sound/killsounds/killingmachine.wav")
resource.AddFile("sound/killsounds/ultrakill.wav")
resource.AddFile("sound/killsounds/monsterkill.wav")
resource.AddFile("sound/killsounds/massacre.wav")