erlc.js is a fully-typed TypeScript wrapper for the Roblox Emergency Response: Liberty County private server API. This guide gets you from zero to a running bot.
#Create a server key
Open Roblox and join your ER:LC private server. Open the server settings panel (owner or co-owner required), go to Server API, and generate a key. Keep it secret.
#Create a project
mkdir erlc-bot
cd erlc-bot
npm init -ySet "type": "module" in package.json if you want to use ESM imports.
#Install the core package
npm install @erlcjs/coreYou can also use pnpm add @erlcjs/core, yarn add @erlcjs/core, or bun add @erlcjs/core.
#Write your first script
Create index.js:
import { Client, ERLCEvents } from '@erlcjs/core';
const client = new Client({
servers: ['YOUR_SERVER_API_KEY'],
polling: { enabled: true },
});
client.on(ERLCEvents.playerJoin, (player) => {
console.log(`[JOIN] ${player.username}`);
player.message('Welcome to the server! Have fun.');
});
client.on('error', (err) => {
console.error('erlc.js error:', err);
});
console.log('erlc.js is running...');#Run it
node index.js Polling is the simplest start
Polling needs no public IP, port forwarding, or tunnel. Add the webhook gateway later if you want near-real-time emergency calls and in-game custom commands.
#What just happened?
Clientholds one or more ER:LC servers.polling: { enabled: true }fetches full server state every five seconds.- Events such as
playerJoinare emitted from the cached state, fully typed. - Commands like
player.message()go back through the REST API.
#Next steps
- Instantiating the Client — options, polling, and webhooks
- Managing Players — kicks, messages, and player data
- Server & Commands — server info and console commands
- Handling Events — the full event reference
- Accessing the Cache — where every structure lives