I have tried several different ways of writing this without being able to get it to work, and I have been scouring the wiki. What I have is a TTT SWEP that selects a target, and switches places with and kills the target player. I am attempting to make it play a sound when it successfully happens.
if SERVER then self:EmitSound("garrysmod/balloon_pop_cute.wav", 511, 100, 1, CHAN_AUTO) self:GetOwner():PrintMessage( HUD_PRINTTALK, "You killed " .. self.targEnt:Nick() .. " and switched places with him.") end
This is directly after the player is killed. If needed I can post the whole function, or file. Just trying to save space.
No sound is played, but everything else works fine. There are no LUA errors in console. Thinking maybe I am calling EmitSound the wrong way or something is wrong with my arguments. It’s also my understanding EmitSound is shared, so I should be able to call it from SERVER.