Play music when people join?

So on some servers you hear some music when you join the server,
I once saw a topic about this how to do it but I can’t find it anymore.
Could someone explain how you make a sound play when somebody joins?

[lua]
local path = “Your_sound_path.wav”
pl:ConCommand("play " … path )
[/lua]

Here’s how I would do it :

Serverside
[lua]hook.Add(“PlayerInitialSpawn”,“SpawnSound”,function(ply)
SendUserMessage(“PlayerConnectSound”)
end)[/lua]

Clientside
[lua]usermessage.Hook(“PlayerConnectSound”,function()
surface.PlaySound(“path/to/sound.wav”)
end)[/lua]

This plays a sound everyone will hear coming from their interface, which might or might not be what you want.

There’s also certainly a better way to do it.

Thanks mates.