Song to play when a client joins the server

Is there anything that already does this?
If not could someone help me make one?

[LUA]
hook.Add(“PlayerInitialSpawn”, “86865866986878”, function( ply )
ply:EmitSound("<sound path here>")
end)[/LUA]

Why emit sound? I am pretty sure we don’t need people around us. Have the client do:

[lua]
local sound = “music/file.mp3”;

ply:ConCommand("play "…sound);
[/lua]

Or if you want, make a usermessage and have it do surface.PlaySound

So if I the client to play a sound file called “gamefire” I would put:
[lua]
resource.AddFile(“sound/gamefire.mp3”)
local sound = “sound/gamefire.mp3”;
ply:ConCommand(“play sound/GameFire.mp3”);
[/lua]

Remove the sounds/ part.

From every part of the code?

EDIT:
[lua]
resource.AddFile(“gamefire.mp3”)
local sound = “gamefire.mp3”;
ply:ConCommand(“play gamefire.mp3”);
[/lua]

no
Addfile starts at garrysmod folder…
“play” command at sound folder


resource.AddFile("sound/gamefire.mp3")
ply:ConCommand("play gamefire.mp3")

autorun\client right? If so it doesn’t want to work.

It’s serverside.

Still not working

Lua does not simply read your mind.

[lua]
local soundFile = “gamefire.mp3”
resource.AddFile( “sound/” … soundFile )

local function joinSound( pl ) – Our function to be called, pl is the player object.
pl:ConCommand( "play " … soundFile )
end
hook.Add( “PlayerInitialSpawn”, “sound_spawn”, joinSound ) – Hook the function so it gets called everytime a player spawns for the first time.
[/lua]