Q: Why doesn't resource.AddWorkshop() use collections?

I was wondering why resource.AddWorkshop doesn’t have collection support. When I go into my server, it does a [TEST][Mounting…<addon name>] then it says an error about AddWorkshop being a nil field. Is this a Steam thing or a Gmod thing?

Try this: http://wiki.garrysmod.com/page/Workshop_for_Dedicated_Servers

Thank you!


The only issue I have is I use NFO and I don’t know where to put that command line.

Under the “Easy Setup” tab there is a Gmod Specific section where you can input your API Key and Steam Collection ID

I have that, but when people join, they get errors on some things which means they didn’t download it. Or do they have to restart GMod every time?

Well, the rate of workshop actually working properly is sadly not that high.

You will still need to add the workshop resources for each addon for them to download.

Yep, you add the collection in your command line ‘+host_workshop_collection WORKSHOPID -authkey YOURKEYGOESHERE’ and then each individual addon in your resources.lua file.

As far as I know you can’t get a client to download a whole collection.

Here is how I have my gamemode add every addon in the servers collection for clients to download. It spawns a bot on server start so that the server can perform atleast one tick operation which will cause the timers to fire off and automatically add everything in a collection for people to download on join.

function resource.AddWorkshopCollection( id )

http.Fetch( "http://steamcommunity.com/sharedfiles/filedetails/?id=" .. id, function( page )

	timer.Destroy( "loadresources" );

	-- Credits to Kogitsune
	for k in page:gmatch( [[&lt;div id="sharedfile_(.-)" class="collectionItem"&gt;]] ) do

		resource.AddWorkshop( k );


end );


local function LoadWorkshop()

resource.AddWorkshopCollection( "CollectionID" );


local function SpawnTickBot()

if( #player.GetAll() == 0 ) then

	game.ConsoleCommand( "bot

" );



local function KickTickBot()

for k,v in pairs( player.GetAll() ) do

	if( v:IsBot() ) then

		v:Kick( "Kicking Tick Bot" );




hook.Add( “InitPostEntity”, “ResourceInitPost”, function()


timer.Create( "loadresources", 5, 0, LoadWorkshop );
timer.Create( "kicktickbot", 10, 1, KickTickBot );

end );