I need help with making a sound play when my SWEP primary fires.
This is my code.
self:EmitSound(Sound("single.wav"))
single.wav is located in garrysmod/addons/weapon_idk/lua/weapons
Where should I put it? I've tried where I could think of
Do I need to precache the sound or something?
The lua folder is for lua files only.
Put your sound in garrysmod/addons/weapon_idk/sound/ then in a unique folder name, then change the path in your code to reflect that.
Thanks, I'll try it
Get rid of the word sound in the path
the string used should be the filepath to the sound you want to play relative to the garrysmod/garrysmod/sound directory.
if you wanted to play the sound "GarrysMod/garrysmod/sound/phx/eggcrack.wav" you would just put "phx/eggcrack.wav".
also you should really be calling the Sound( ) global outside of a function like this and put it somewhere like an init function or an autorun so you arent constantly calling for a precache whenever you want to play the sound even when the sound is already precached.
works!
It works, but I need to make a custom sound
Do i put the sound in garrysmod/sound/blah/blah/sound.wav
Sorry, you need to Log In to post a reply to this thread.