player console command play

I’m trying to make a player play a song I forced them to download.

on there computer the file is in “Steam\steamapps<username>\garrysmod\garrysmod\downloads\sound\music_player
on the server the file is in “Gmod13\orangebox\garrysmod\sound\music_player

if i run “Music_Play” with the file arg of “music_player/<song>.mp3
the client console says “Failed to load sound music_player&lt;song>.mp3", file probably missing from disk/repository

whats going wrong? Am I making the clients download the sound files wrong or?


function Music_Play(pl, command, args) --Music_Play
local File = args[1]

print("~Playin: "..File..".mp3")

for k, v in pairs(player.GetAll()) do
	v:ConCommand("play " .. File .. ".mp3")

concommand.Add( “Music_Play”, Music_Play )

Your code looks alright, and your function works ingame, at least for local files. I can see a couple of possible problems here. When using music_play, are you including the .mp3 extension in your filename argument, or is that just a mistake when posting? Seems obvious, but bear in mind that your function adds “.mp3” to the string, so if you’re doing that, then you’ll be playing <song>.mp3.mp3. Try having the file locally accessible to a client (as in, copy the file outside of the game) and see if your code then works. If it does, then it is likely the download part that’s going wrong.

I believe in the console you have to use a forward slash (/)?

It works if “music_player/<song>.mp3” is in “Steam\steamapps<username>\garrysmod\garrysmod\sound\music_player”
but not if “music_player/<song>.mp3”
is in
“Steam\steamapps<username>\garrysmod\garrysmod\down loads\sound\music_player”

How do I make the client download then songs to