How to add a Workshop collection to a Garry's Mod server
Make your Garry's Mod server download addons from a Steam Workshop collection, and make clients download them too with resource.AddWorkshop.
Updated · 2 min read
Create a public collection on the Steam Workshop, put its ID in your server's Workshop collection Startup variable (which sets host_workshop_collection), and restart. The server then downloads and mounts every addon in the collection.
Step 1: create a collection
- In Steam, open the Garry's Mod Workshop.
- Create a new collection and add the addons you want: maps, weapons, models, tools and so on.
- Set the collection's visibility to Public. Private or friends-only collections can't be downloaded by the server.
- Copy the collection's ID. It's the number at the end of the collection's URL, after
?id=.
Step 2: add it to your server
- Open your server's Startup settings in the Schokr console.
- Paste the number into the Workshop collection ID variable.
- Restart the server.
On start, the console shows the server downloading each Workshop item. The first start after adding a large collection can take a while.
If the collection doesn't download, a few older setups also need a Steam Web API key passed as -authkey. You can create one at steamcommunity.com/dev/apikey. Ask in Discord if your template doesn't have a variable for it.
Step 3: make players download the addons
The server having the addons isn't enough. Players need them too, or they'll see missing textures and errors. Tell clients to download them with resource.AddWorkshop.
Create a Lua file in the file manager:
garrysmod/lua/autorun/server/workshop.lua
Add one line per addon that has content players need (models, materials, sounds, maps):
resource.AddWorkshop("123456789")
resource.AddWorkshop("987654321")
Use each addon's own Workshop ID, not the collection ID. Restart the server. Players now download those items from Steam when they join, which is much faster than downloading from the server.
You don't need resource.AddWorkshop for addons that are only server-side Lua.
Workshop maps
If the collection contains a map, set the map name (not the Workshop ID) in your map Startup variable once the server has downloaded it, for example rp_downtown_v4c_v2. The map name is shown on the Workshop page or in the console after download.
Keeping it small
Every addon uses disk space and adds to load times. On Schokr's free package your team shares 10 GB of disk, so:
- Remove addons you don't use from the collection.
- Avoid huge content packs unless you need them.
- Check disk usage in the console after the first download.
Troubleshooting
- Addons not downloading on the server: check the collection is public and the ID is right. The console prints Workshop errors at startup.
- Players see purple and black checkers or ERROR models: add
resource.AddWorkshoplines for the content addons, or players are missing a game the content depends on, like Counter-Strike: Source. - Changes to the collection not appearing: restart the server. It checks the collection on boot.
Still stuck?
Post your Workshop download errors in the Schokr Discord.