(LUA) Play sound to only a specific player on event

What i am unable to find, is a code that when the function is called, it will play this sound, only to the player, example
there is team 1 and team 2
when a player dies from team 1, he is set to team 2
but when he dies, i would like it to play a certain sound i already have added to server to play, only to his client

Thanks in advance :slight_smile:

Not sure, but ply:EmitSound might work?

I did this

function playerDies( victim, weapon, killer )

ply:EmitSound("sound/infected.mp3")

end

hook.Add( “PlayerDeath”, “playerDeathTest”, playerDies )

And it didn’t work :confused: sorry

EDIT: I also tried Entity:EmitSound And that didn’t work either :confused:

That’s because ply isn’t defined. Try using victim instead.

I changed ply:EmitSound(“sound/infected.mp3”)
to victim:EmitSound(“sound/infected.mp3”)

Still not working, also, sound/infected.mp3 is the right location so it isn’t that

Maybe precache the sound and make sure it was downloaded?

it defiantly did download client, i have fresh gmod and i logged on and it downloaded

How do i precache the sound?

Edit: I found out how
util.PrecacheSound(“sound/infected.mp3”)

[editline]29th August 2013[/editline]

Nope, still no luck :confused:

[editline]29th August 2013[/editline]

SOLVED!

I had to convert the mp3 into a wav, with a 1411 bit rate