Kingdoms Connected roleplay server: installing protected scripts
Latch team · 2026-12-05 · 5 min read
Kingdoms Connected is a free multiplayer mod for Kingdom Come: Deliverance II, built on MafiaHub technology. It puts up to 512 players in the game's Bohemia on community-hosted dedicated servers, and game modes are scripted in JavaScript or TypeScript. A roleplay server is mostly its resources: jobs, economy, factions, menus, admin tools.
Some of those resources come from developers who protect them with Latch. This guide covers the server owner side: getting access, installing a protected resource, adding your key, keeping it updated and running a second server for testing.
Before you start
You need a working Kingdoms Connected server first. The official hosting guide covers it: every release has a server/ folder for Windows and a server-linux/ folder for Linux, the first start of KCDCServer writes server.json, and players connect over UDP 27015. Resources are folders in the server's resources/ directory, as shown in Write your first resource.
Once the server starts and you can join it, add protected resources the same way you add any other, with one extra line of config.
1. Create an account and find your account ID
Sign up at heylatch.app. Your account ID is in Settings and looks like LA-7K2M-9QXD. It never changes, so you can share it with any developer whose script you want to run.
Access is given to your account, not to a server. Once a developer grants it, the script shows up in your Library and works on every server you run with your keys. There's no separate step to assign a script to a key.
2. Get access to a script
There are two ways a script reaches your Library:
- From the developer. You agree with the developer on their own channel, such as their Discord or website, and send them your account ID. Latch doesn't sell scripts and isn't part of that deal; it only applies the access the developer grants.
- From Explore. Explore is a public directory of studios and the scripts they choose to show. Some are marked free to use, and you can add those to your Library in one click while signed in.
If a script depends on other resources, its download page lists them. Install those as well.
3. Get your free key
A key is your server's identity. Every account gets one free, and you'll find it on the Keys page in the dashboard. A few rules worth knowing:
- One key runs on one server at a time.
- A key isn't tied to a script. It unlocks every script your account has access to on that server.
- A key is tied to the machine, not the IP address, so a changing IP is fine.
4. Download and install
- Open the script from your Library and click Download.
- Extract the zip into the server's
resources/folder. The folder name should be the script's short name. - Don't edit anything inside the package. It's encrypted, and modified packages won't run. If the developer left a config file readable for you to change, that one is safe to edit.
5. Add your key to the env file
Put the key in the env file in the server's root folder, next to server.json and resources/. That's server.env if it exists, or a .env you create there:
LATCH_LICENSE=LT-XXXX-XXXX-XXXX-XXXX
You write this line once. Every protected script on that server uses the same key.
6. Start the server and read the console
Start the server the way you normally do. Each protected resource prints a line when its license is verified, and then runs like any other resource.
If a script doesn't start, the console says why. The most common messages, from the troubleshooting page:
| Message | What to do |
|---|---|
| License key not found | The key line is missing from the env file or the name is wrong. It must be LATCH_LICENSE. |
| Key already active on another server | The same key is running elsewhere. Stop that server or use an extra key. After moving machines, wait about 10 minutes. |
| This account has no access to this script | The developer hasn't granted your account, or removed it. Check your Library and contact them. |
| Could not reach the license server | Allow outbound HTTPS (443) to api.heylatch.app in your firewall. |
| This package is damaged or was modified | Download the package again and don't edit what's inside. |
Keeping scripts up to date
When a developer ships a new version, the script is marked "Update available" in your dashboard and you get an email. Download it, replace the old folder and restart. You don't touch the env file.
If you run a lot of scripts, the CLI can install and update everything in your Library in one command. Create an account API key (lta_…) in Settings under API keys, add it to the env file as LATCH_API_KEY, and run this in the server folder:
npx -y @heylatch/cli pull --all --to resources
Scripts already on their newest version are skipped, and --keep config.json keeps files you've changed. The CLI needs Node.js 20 or newer. The Kingdoms Connected server carries its own JavaScript runtime, so you may need to install Node.js separately for this. The simplest place for it is the top of the script that starts your server, so the server always boots on the newest versions. The updates page has ready-made start scripts, a cron line and a GitHub Actions workflow.
A test server needs its own key
If you run a second copy of your server to try new resources before players see them, that copy needs its own key, because a key runs on one server at a time. You get one from the Keys page, it's billed monthly (see pricing), and it goes in the test server's own env file. Your access doesn't change: every script you can run on the main server also runs on the test server.
Two other key situations, from the keys page:
- Moving to a new machine. Shut the old server down first. About 10 minutes after it stops checking in, the key opens on the new machine.
- A key got out. Regenerate it on the Keys page. The old value stops working immediately, and you put the new one on your server.
What happens if access ends
If a developer revokes your access, or you revoke a key, the affected scripts stop at their next check. The server itself keeps running, along with your other resources. If the license server can't be reached while a script is running, it keeps running and retries; it only stops after 30 minutes without contact.
Optional: run it from LatchAdmin
LatchAdmin is a free, open-source (MIT) web panel for MafiaHub servers on Windows and Linux. It can install a Kingdoms Connected server from the official MafiaHub release or take over a server folder you already have, and it gives you a live console, game updates with a backup first, statistics and team permissions.
You don't need a Latch account to use it. If you link one, you can install your Latch scripts on each server from the panel and choose how they update: when you click Update, at the next restart, or right away.
If you're setting up your first protected resource, the install guide has the short version of these steps, and Explore is a good place to see what's already available. Your first key is free.