sound.Play() is not playing custom sound file in Garry's Mod

558 Views Asked by At

No custom sound files are played, but in-game sound files are played. Sound file has 44100Hz I have tried stereo and mono mp3 and ogg I have also tried

local soundFile = "addons/testaddon/sound/testsound.wav"

hook.Add("KeyPress", "myTestAddon", function(ply, key)
    if key == IN_JUMP then
        sound.Play(soundFile, ply:GetPos(), 75, 100, 1)
        print("Test")
    end
end)
1

There are 1 best solutions below

0
Luke100000 On

This should be [...] a file path relative to the sound/ folder.

https://wiki.facepunch.com/gmod/sound.Play

In your case just use "testsound.wav".