I created a Derma Menu that when a player access it he can play a sound for everyone to hear.(making a taunt menu for Prop Hunt)
But I failed in creating a server side ply.EmitSound() that will create a fade effect as other players go further from the player who initialized the taunt.
Basically the taunt should play on the Player1 last location or will follow the player as he moves as long as it’s playing, while others who hear the taunt will get it in a lower volume as they go further away from Player1.
Here’s an example of my server side code:
//Custom Taunt Delay Variables local t_delay_p1_b1 = -1.5 //Boom Headshot! util.AddNetworkString("send_p1_B1") net.Receive( "send_p1_B1", function( _, ply ) local taunt = net.ReadString() local tsound = SoundDuration(taunt) local curTime = CurTime() if curTime - ( ply.LastTaunt or 0 ) >= TAUNT_DELAY then ply.LastTaunt = CurTime() + t_delay_p1_b1 for _, ply in pairs( player.GetAll() ) do ply:EmitSound(taunt,ply:GetPos(),100) print("Playing sound:",taunt," Size:",tsound," Old Time:",curTime," New Time:",ply.LastTaunt) //Debugging Console Print end else print("Wait until the taunt is finished playing.") end end )
** I came up with “t_delay_p1_b1” variable after I noticed that SoundDuration() gave a random delay time(sometimes longer & sometimes shorter), if you can give me a hint how to make it more simple I am all ears.
So any tips on how can I create such an effect?
Appreciate the help!