Music playing when a player finished joining game

First of all, hello everybody :=)

I was wondering if that was possible that a music launches when the player finished joining, like CSS by exemple.
Isn’t this possible with some lua coding? I’m not lua coder, so that is why I post it here, because if that is possible for Gmod, did someone allrealy made it? Or can someone can make a script? Thanks in advance.

Also sorry if my english is bad, I’m french ^^’

Salut!

It’s quite easy, add this to a client-side file. That could mean the cl_init.lua of your gamemode or lua/autorun/client.

[lua]
local function SpawnMusic()
surface.PlaySound( “path/to/your/sound.wav” )
end
hook.Add( “InitPostEntity”, “SpawnMusic”, SpawnMusic)
[/lua]

To have the clients download the music if they don’t have it use this serverside :

[lua]resource.AddFile(“path/to/your/sound.wav”)
[/lua]

D’accord thanks man, I’ll test it out.