Help with teams and sounds, client and globably, Please help!

pretty basic, i have achieved this before, but lost the code, i have tried looking for it on pc and google, no luck
i think it’s something like

function playerDies( victim, weapon, killer )
victim:SetTeam( 1 )
victim:EmitSound(“infected.wav”, 50, 100)
if team.GetPlayers(2) >= 1 then
for k,v in pairs(player.GetAll()) do
hook.Add( “PlayerDeath”, “playerDeathTest”, playerDies )

(For halorun.mp3 i want that to globably play halorun.mp3 when there is only one person on team_2
for infected.wav i want that only for client and if they die from team_2)

Also, i have attempted to make it so when you die, it says “Infected” But i couldn’t achieve to make it only for the person that died, if there is a way
so that when someone dies, only they hear “Infected”,
One last thing,
I only want it to say “Infected” If they are on team 2 and die

Thanks in advance! :slight_smile:

The only thing i have gotten close to, for client side hearing a sound is this
ply:EmitSound(“infected.wav”, 50, 100)

But, if someone is really close they can still hear it :confused: someone help!