> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Configure Discord-Based Whitelisting in FiveM

> Establish a synchronized community ecosystem. Learn how to link your FiveM server whitelist and permissions directly to your Discord server roles.

## Modern Community Integration

The technical standard for managing community access has transitioned from manual SteamID entry to dynamic **Discord Role Synchronization**. By using Discord as your primary database for permissions, you ensure that if a player is granted a "Police" or "Staff" role within your Discord guild, they automatically receive the corresponding powers in-game. Conversely, if a player leaves your Discord server, their whitelist status is revoked instantaneously, providing an automated and highly secure management workflow.

<CardGroup cols={2}>
  <Card title="Difficulty" icon="gauge-low">
    Intermediate
  </Card>

  <Card title="Time" icon="clock">
    10 Minutes
  </Card>
</CardGroup>

***

## Technical Core Prerequisites

To establish the bridge between the CitizenFX engine and the Discord API, you require two fundamental community frameworks:

1. **Badger-Discord-API:** The underlying logic handler that retrieves player role metadata from your guild.
2. **DiscordAcePerms:** The configuration script that converts Discord roles into FiveM **ACE** (Access Control List) permissions.

***

## Step 1: Architecting the Discord Bot

Follow these steps to create the secure gateway for your server data.

<Steps>
  <Step title="Initialize Application">
    Visit the [Discord Developer Portal](https://discord.com/developers/applications) and create a **New Application**.
  </Step>

  <Step title="Configure Bot Presence">
    Navigate to the **Bot** tab. Ensure that the **Server Members Intent** toggle is enabled; without this, the bot cannot retrieve player role lists.
  </Step>

  <Step title="Deploy Tokens to cfg">
    Copy your **Bot Token** and **Guild (Server) ID**. Input these into your `server.cfg` using the following variables:

    ```cfg theme={null}
    set DiscordBotToken "YOUR_SECURE_TOKEN"
    set GuildID "YOUR_SERVER_ID"
    ```
  </Step>
</Steps>

***

## Step 2: Mapping Discord Roles to FiveM Groups

To translate your community hierarchy into game permissions, you must define the relationships within your permission script's `config.lua`.

<Steps>
  <Step title="Retrieve Role IDs">
    In Discord, right-click your desired role and select **Copy ID**.
  </Step>

  <Step title="Define Mapping Registry">
    Populate the `roleList` with your technical mappings:

    ```lua theme={null}
    roleList = {
        ['123456789012345'] = "group.admin",       -- Founder Role
        ['987654321098765'] = "group.whitelisted", -- Community Member Role
    }
    ```
  </Step>

  <Step title="Initialize the Bridge">
    **Restart** your server. Monitor the console to ensure the Badger-Discord-API successfully authenticates with the Discord gateway.
  </Step>
</Steps>

***

<Tip>
  ### Tactical Automated Onboarding

  using Discord-based whitelisting allows you to automate your entire onboarding process. By integrating a "Rules Verification" bot in Discord that assigns a role upon completion, you enable players to whitelist themselves for your FiveM server without requiring manual staff approval, significantly accelerating your community's growth.
</Tip>

***

<Note>
  ### Need Extra Help?

  If you encounter any issues, our support team is ready to assist:

  * **Live Chat:** Quick assistance via our website.
  * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
  * **Discord:** [Join our Community](https://discord.gg/freakhosting)
  * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)
</Note>

<Tip>
  ### Save on Your Hosting

  Ready to get a new server? Use code **KB20** at checkout for **20% off** your first month!
</Tip>

***

<div align="center">
  **Last Updated:** January 2026 | **FiveM:** Discord synchronization active.
</div>
