You are here:

/

April 23, 2023

FiveM Server Tutorial: Create Discord Whitelist

Introduction

In this tutorial you will learn how to create a Discord whitelist for your FiveM server. A whitelist allows you to limit access to your server to specific players who are members of your Discord server. This can help increase the quality of players on your server and reduce unwanted behavior. We will cover all the necessary steps in this guide to set up a working Discord whitelist for your FiveM server.

Video

YouTube video

Step 1: Requirements

Before you begin, make sure you meet the following requirements:

  • A working FiveM server (see our guide to creating a FivePD server if you don't already have one)
  • A Discord server where you can use the whitelist want to manage
  • Administrator rights on both servers
  • Basic knowledge of using Discord and FiveM

Step 2: Create a Discord bot

To manage the Discord whitelist, you need a Discord bot. Go to https://discord.com/developers/applications and log in with your Discord account. Click “New Application” and enter a name for your bot. After creating the application, click “Bot” in the left menu and then click “Add Bot”. Make a note of the token generated for your bot as you will need it later.

Step 3: Add Discord bot to server

To add your Discord bot to the server, go to your application's OAuth2 page and select bot under Scopes. Under “Bot Permissions,” select the permissions your bot requires. In this case, the bot should have at least the “View Channels” and “Manage Roles” permissions. Copy the generated link and paste it into your browser's address bar. Select the Discord server where you want to install the bot and click “Authorize.”

Step 4: Download DiscordWhitelist script

Visit the DiscordWhitelist Script for FiveM GitHub page (https://github.com/ThymonA/fivem-discord-whitelist) and download the script by clicking on “Code” and then “Download ZIP”. Extract the ZIP file on your computer.

Step 5: Build Discord whitelist script in FiveM server

Copy the extracted “discord-whitelist-master” folder to the “resources” directory of your FiveM server. Rename the folder to “discord-whitelist” to make installation easier. Open your FiveM server's "server.cfg" file with a text editor and add the following line to the end of the file:

ensure discord whitelist


Step 6: Configure DiscordWhitelist script

Find the “discord-whitelist” folder in the “resources” directory of your FiveM server and locate the “config.lua” file. Open this file with a text editor to configure the script.

Paste your Discord bot token into the appropriate line:

Config.DiscordToken = 'Your_Bot_Token'

Set the Discord role required to access the FiveM server:

Config.WhitelistRole = 'Discord_role_name'

You can also adjust optional settings, such as sending a message to players not on the whitelist or enabling debug output. Save the changes and close the text editor.

Step 7: Create and assign Discord role

Create a new role on your Discord server with the name you specified in the “config.lua” file. Assign this role to the members who should have access to your FiveM server. Make sure the role is visible to players and does not grant them additional permissions that are not needed.

Step 8: Restart FiveM server

Restart your FiveM server for the changes to take effect. Make sure the server loads the DiscordWhitelist script successfully and does not display any error messages.

Step 9: Test whitelist

To check the functionality of the Discord whitelist, connect to your FiveM server and ensure that only players with the assigned Discord role have access. Temporarily remove the role from your own account and try connecting to the server again to ensure access is denied.

Step 10: Discord whitelist maintenance and management

To effectively manage the Discord whitelist, you should regularly check whether the Discord bot is online and working properly. Also, make sure your Discord role is configured correctly and only assigned to the members you want. You can also add additional commands or features to your Discord bot to make whitelist management easier.

Conclusion

A Discord whitelist is a great way to improve the quality of players on your FiveM server and keep unwanted guests out. With this step-by-step guide, you've learned how to create and manage a working Discord whitelist for your server. Have fun playing and good luck managing your new Discord whitelist!