In short
A FiveM whitelist lets only approved players join your server. The easiest setup is to enable txAdmin's Discord bot integration and set the whitelist mode to “Discord Server Roles.” When a player passes the application and interview, staff give them the whitelist role in Discord, and removing the role cuts off access. If you need custom rules, use a Lua script that checks roles through the Discord API on the playerConnecting event.
In this guide
A FiveM whitelist is an access control that lets only players you approve connect to your server. On roleplay servers, the most common and easiest method to manage is tying approval to a Discord role: the player applies, passes an interview, staff give them the whitelist role in Discord, and they can join the server. When the role is removed, access closes automatically. In this guide, we set up txAdmin's built-in whitelist modes, a custom Lua check script and an application and interview flow, step by step.
How does a Discord role whitelist work?
When a player connects, FiveM sends the server several identifiers: license:, fivem:, steam: and, if the Discord desktop app is running on the player's PC, their Discord user ID starting with discord:. The whitelist system takes that Discord ID, queries the player's roles on your Discord server through the Discord API and, if the required role is missing, rejects the connection with an explanation message.
This approach has three concrete benefits:
- One place to manage everything: Your staff team controls access just by giving or removing roles in Discord, without ever joining the game server.
- Instant revocation: Once you remove a rule-breaker's role, they cannot get in on their next connection attempt.
- Records and transparency: Discord's audit log shows who gave a role and when.
txAdmin whitelist modes
txAdmin is the official management panel for FiveM servers, and the whitelist feature is built in. In the Player Manager section of the settings screen, you pick one of these modes:
| Mode | How it works | Best for |
|---|---|---|
| Disabled | Anyone can connect. | Public servers with no whitelist. |
| Admin-only | Only txAdmin admins can join. | Maintenance, updates and pre-launch testing. |
| Approved License | On the first attempt, the player sees a request code; staff approve the request from the txAdmin panel or the Discord bot. | Small communities that don't want to require Discord. |
| Discord Server Member | Anyone who is a member of your Discord server can join. | A light filter; for catching ban evaders on Discord. |
| Discord Server Roles | Only members with one of the role IDs you specify can join. | Roleplay servers that use applications and interviews. |
Setting up a Discord role whitelist with txAdmin
- Create a Discord application. Create a new application in the Discord Developer Portal, copy the bot token from the Bot tab and enable Server Members Intent on the same page. If this intent is off, the bot cannot read members' roles.
- Invite the bot to your server. In the OAuth2 section, generate an invite link with the
botscope and add the bot to your Discord server. - Collect the IDs. In Discord, turn on Settings > Advanced > Developer Mode. Right-click the server name to copy the server ID, then go to Server Settings > Roles, right-click the whitelist role and copy the role ID. txAdmin needs the role ID, not its name.
- Connect the txAdmin Discord bot. In the Discord Bot tab of txAdmin's settings, enable the bot, enter the token and server ID, and save. The bot should show as online in Discord.
- Choose the whitelist mode. In the Player Manager section, set the mode to Discord Server Roles, add the role IDs and put the name of your application channel in the rejection message players will see.
- Test it. Try connecting with a second account that doesn't have the role, then give it the role and try again. Also test connecting with the Discord app closed; this is the most common problem players run into.
txAdmin's bot runs inside the txAdmin process, so you don't need a separate server just for the whitelist. For the game server itself, though, you need a plan that comfortably handles a roleplay framework, a database and dozens of scripts at once; the OB-FIVEM-3 FiveM server with 4 CPU cores and 6 GB DDR5 RAM is a balanced starting point for a mid-sized whitelisted RP server.
Alternative: your own Lua whitelist script
If you want role-based priority, different messages for different roles or custom routing based on application status, you can write the check yourself. The example below defers the connection in the playerConnecting event, looks up the member through the Discord API and rejects the player with a reason if the role is missing.
resources/[yerel]/discord_whitelist/fxmanifest.lua:
fx_version 'cerulean'
game 'gta5'
server_script 'server.lua'server.lua:
local GUILD_ID = GetConvar('wl_guild_id', '')
local BOT_TOKEN = GetConvar('wl_bot_token', '')
local ALLOWED_ROLE = GetConvar('wl_role_id', '')
local function getDiscordId(src)
for _, id in ipairs(GetPlayerIdentifiers(src)) do
if id:sub(1, 8) == 'discord:' then
return id:sub(9)
end
end
end
AddEventHandler('playerConnecting', function(name, setKickReason, deferrals)
local src = source
deferrals.defer()
Wait(0)
deferrals.update('Discord rolünüz kontrol ediliyor...')
local discordId = getDiscordId(src)
if not discordId then
deferrals.done('Discord bulunamadı. Discord uygulamasını açıp FiveM\'i yeniden başlatın.')
return
end
local url = ('https://discord.com/api/v10/guilds/%s/members/%s'):format(GUILD_ID, discordId)
PerformHttpRequest(url, function(status, body)
if status ~= 200 then
deferrals.done('Discord sunucumuzda üye değilsiniz.')
return
end
local member = json.decode(body)
for _, role in ipairs(member.roles or {}) do
if role == ALLOWED_ROLE then
deferrals.done()
return
end
end
deferrals.done('Whitelist rolünüz yok. Başvuru için Discord sunucumuzdaki #basvuru kanalını kullanın.')
end, 'GET', '', { ['Authorization'] = 'Bot ' .. BOT_TOKEN })
end)Add to server.cfg:
set wl_guild_id "DISCORD_SUNUCU_ID"
set wl_role_id "WHITELIST_ROL_ID"
set wl_bot_token "BOT_TOKENINIZ"
ensure discord_whitelistTwo security rules are critical:
- Always define the token with
set.setrreplicates the variable to clients, which hands your token to everyone. - Never put the token in client scripts or a public Git repository. If you suspect it has leaked, reset it right away in the Developer Portal.
During busy launch hours, every connection sends a request to the Discord API. On servers with many players, caching the result in a short-lived table keeps you from hitting Discord's rate limit. txAdmin's built-in mode already handles this for you; unless you have a special need, use it instead.
Application form and interview flow
The technical side of a whitelist takes about half an hour; the application process is what really sets the quality. A well-run flow looks like this:
- Application channel: Create a read-only #applications channel in Discord and pin the rules and the form link.
- Form: Ask for age, roleplay experience, character name and a short backstory, plus 2-3 rules questions such as “What is metagaming?” If you collect the form with an application bot that uses Discord modal windows, all applications pile up neatly in one channel.
- Screening: Staff read the applications, filter out copy-paste answers and give suitable candidates an “Awaiting Interview” role.
- Voice interview: In a 10-15 minute call, ask scenario questions: “You're being held at gunpoint. What do you do?” tests their understanding of fear RP, and “Would you use information you heard on Discord in the game?” checks their awareness of metagaming.
- Decision and role: Approved players get the whitelist role; rejected players get a short reason and the waiting period before they can reapply.
Having two staff members in each interview and using a simple scoring sheet greatly reduces complaints about favoritism. To keep the application bot and the interview queue running 24/7, use one of the Discord Bot VDS plans instead of a home PC, so applications don't get lost when the bot goes offline. For the steps to move your bot to a server, see the guide to deploying a Discord.js bot on a VDS with PM2.
Extra measures that strengthen your whitelist
A whitelist guards the door, but it doesn't solve every problem on its own. These small tweaks make the system noticeably more robust:
- Discord account age check: To cut down on ban evaders using freshly created accounts, check the account creation date in your application bot and flag very new accounts for extra review.
- Separate role tiers: Keep “Applied,” “Awaiting Interview” and “Whitelist” as separate roles. That way you can see who is at which stage right from the Discord member list.
- Ban sync: When a player is banned in-game, remove their Discord whitelist role too; otherwise they slip back in unnoticed once the ban expires.
- Connection logs: Sending rejected join attempts to a Discord log channel lets you spot accounts that keep trying without the role. For setup, see the FiveM Discord log system guide.
Common whitelist problems
- “Discord not found” error: The player's Discord desktop app is closed, or they are using Discord in a browser. They need to open the app and restart FiveM.
- Role given but still can't join: Check that the role ID is entered correctly, that the bot has Server Members Intent enabled and that the player is connecting with the right Discord account.
- Everyone can get in: The whitelist mode may not have been saved, or a second connection script on the server may be finishing the deferral early.
- Connection stuck on the “checking your Discord role” screen: A script is exiting without calling
deferrals.done(). Make sure every code path ends withdone.
Next step
Once the whitelist is ready, the next job is your staff team's in-game permissions; follow the FiveM ACE permissions guide for that. If you're building your server from scratch, you can launch your FiveM server with automatic setup on OyunBulut's Istanbul-based OB-FIVEM-3 plan and run your application and log bots on a separate Discord bot server, so the game server's resources go to players only. If you get stuck, you can get help in Turkish through an OyunBulut support ticket.
Frequently asked questions
Do I need a Discord bot for a FiveM whitelist?
For a Discord role-based whitelist, yes; txAdmin's built-in Discord bot or your own bot must be able to read roles. If you don't want to require Discord, txAdmin's Approved License mode lets you approve request codes from the panel.
A player gets a “Discord not found” error. What should they do?
FiveM only passes the Discord ID while the Discord desktop app is running on the PC. The player should open the app and restart FiveM.
If I remove the whitelist role, does the player get kicked from the game?
No, the check happens at connection time. If the player is already in, you need to kick them from txAdmin; they won't be able to connect next time because they no longer have the role.
Is it safe to keep the bot token in server.cfg?
server.cfg stays on the server side, but you must define the token with set. setr sends the variable to clients and exposes your token.
Can I set more than one role as a whitelist role?
Yes. In txAdmin's Discord Server Roles mode, you can enter multiple role IDs; the player only needs to have one of them.