Skip to main content
Guides
GuidesFiveMRoles

A Discord Bot for a FiveM Server: What the Connection Actually Gives You

Sync roles, check a whitelist, run server commands from Discord. What is worth having, what to leave alone, and what to watch when setting it up.

Published on by AlphaCloud3 min read

Almost every FiveM server has a Discord server beside it. Usually the two sit next to each other unconnected: roles are handed out in Discord and then again by hand in game, somebody maintains the whitelist in a text file, and running a server command means having access to the server panel.

Connecting the two solves exactly these three things. What it does not solve is further down.

What you need first

The connection runs through a script on your FiveM server plus a secret the script uses to identify itself with us. Without both, nothing happens, including for the features where you would not expect it, such as the in-game notifications.

One thing genuinely matters when generating the secret: you see it exactly once. Copy it straight into config.lua. Closing the window means generating a new one and entering that instead, which is harmless as long as you know it and annoying if you spend ten minutes looking for it.

The full step by step setup is in the FiveM documentation.

Syncing roles

The feature most people start for. You create mappings, each one a Discord role to a FiveM group, and on connect the player gets the matching group. Anyone who matches nothing lands in user.

One detail decides between success and confusion here: the mappings are checked top to bottom, and the first match wins. Your administrator almost certainly also has the supporter role. If supporter sits higher, your administrator is a supporter in game, and troubleshooting takes exactly as long as it takes somebody to look at the order.

So: highest role at the top, then test once with an account that holds several roles. Not your own, yours has everything.

Whitelist

Instead of a maintained list of identifiers, the Discord role decides who may connect. For roleplay servers with an application process that is the real win: whoever is accepted gets a role, and that was the entire procedure.

The part most people skimp on is the rejection message. It appears in the connection window, and it is often the only thing a rejected player ever reads from your server. "You are not whitelisted" is a dead end. Write where to apply, ideally with a link. It costs two minutes once and saves your team the same question in a ticket.

RCON from Discord

/fivemrcon lets your team run server commands straight from Discord, without access to the server panel.

This is the feature where I would most encourage a think before switching it on. RCON is full access to server commands. Two things are therefore not options but requirements:

  • Only allow groups you genuinely trust. Not "the whole team", but the groups that would have the access anyway.
  • Set a log channel. Every command issued lands there. Without it you have created a way to control your server where nobody can reconstruct afterwards who did what.

If you are unsure about either question, leave RCON off. The other features run independently of it.

The two small extras

Giveaways in game. When a giveaway starts in Discord, players see an interface to join for one minute, and winners are shown in game too. Useful because it reaches exactly the people who are playing and therefore not looking at Discord.

Support notification in game. When somebody joins a support voice channel, staff with the matching role get a notice in game. The cooldown there is not meant as optional: without it, a player switching channels twice in a row turns into a notification series.

What the connection is not

It replaces no admin system, no economy management and no player database. It connects identities and permissions between two systems that otherwise have to be maintained separately, and makes a few Discord events visible in game. Nothing more, and that is deliberate.

If you are just starting, the order that has proven itself: set up role sync first and verify it with a test account, then the whitelist if you need it, and RCON last, if at all.

More articles