Setting up Discord Rich Presence for a FiveM server

11 min read6 sections · 6 questions answered
Short answer

Create an application in the Discord developer portal, upload your art (1024×1024), then in a client script call SetDiscordAppId with the application ID, SetDiscordRichPresenceAsset with the art’s key, SetRichPresence with a status line, and optionally SetDiscordRichPresenceAction for up to two buttons.

Every player on your server shows up in their friends’ Discord sidebar as “Playing FiveM”. With Rich Presence you replace that with your server’s logo, name, a live status line and up to two buttons — one of which can take their friends straight to your Discord. It is one small client script and a Discord application, and it is one of the cheapest growth tools a server has.

What players and their friends see

ElementSet withTypical content
Application nameThe Discord application itselfYour server name, e.g. “My City RP”
Large imageSetDiscordRichPresenceAssetYour logo or a city shot
Large image hover textSetDiscordRichPresenceAssetText“mycity.gg”
Small imageSetDiscordRichPresenceAssetSmallA job or rank badge
Status lineSetRichPresence“Patrolling as LSPD · 84/128 online”
Buttons (max 2)SetDiscordRichPresenceAction“Join Discord”, “Connect”

Create the Discord application

Open the Discord developer portal, create a new application and name it after your server — that name is what appears as “Playing …”.

  1. 1Create the application and copy its Application ID from General Information.
  2. 2Open the Rich Presence art assets section and upload your images.
  3. 3Give each image a short lowercase key such as logo or police — you reference the key in code.
  4. 4Upload at 1024×1024; Discord strongly recommends that size for Rich Presence art.

The client script

Create a small resource with a client script. The natives are client-side and only need to be set once, except the status line, which you refresh as things change.

client.lua
local APP_ID = '123456789012345678' -- your Application ID

CreateThread(function()
    SetDiscordAppId(APP_ID)

    SetDiscordRichPresenceAsset('logo')
    SetDiscordRichPresenceAssetText('mycity.gg')

    SetDiscordRichPresenceAssetSmall('badge')
    SetDiscordRichPresenceAssetSmallText('Serious RP')

    SetDiscordRichPresenceAction(0, 'Join our Discord', 'https://discord.gg/yourinvite')
    SetDiscordRichPresenceAction(1, 'Website', 'https://mycity.gg')

    while true do
        local players = #GetActivePlayers()
        SetRichPresence(('In the city · %d nearby'):format(players))
        Wait(15000)
    end
end)
fxmanifest.lua
fx_version 'cerulean'
game 'gta5'

client_script 'client.lua'

GetActivePlayers() on the client only returns players your client currently knows about (those in scope), not the server total. For the real online count, send it from the server — for example in a state bag or with a periodic event.

Buttons: rules and good uses

  • You get two buttons: index 0 and index 1.
  • Each button needs a label and an https:// URL.
  • Your own client never shows the buttons — they appear for other people viewing your profile. Test with a second account or ask a friend.
  • The best pair: your Discord invite and a website or cfx.re/join/ connect link.

A direct connect link lets friends join with one click. How the cfx.re join link works is covered in server connect links.

A status line people want to click

The status line is what makes Rich Presence feel alive. Keep it short (it truncates on narrow profiles) and make it about what the player is doing:

  • “On duty · LSPD” — read the job from your framework.
  • “Driving in Vinewood” — read the zone with GetNameOfZone and a label table.
  • “In the queue” — while loading, before the character spawns.

Troubleshooting

SymptomFix
Still says “Playing FiveM”Check the Application ID is correct and the resource started; the Discord desktop app must be running.
Image missingThe key must match the uploaded asset name exactly; new uploads can take minutes.
Buttons missingYour own profile never shows them — check from another account. URLs must be https.
Status never changesThe loop is not running or errors earlier — check the F8 console.

Common questions

How do I show my server name on Discord in FiveM?

Create a Discord application named after your server and call SetDiscordAppId with its ID from a client script. The application name replaces “FiveM” in the player’s status.

What size should Rich Presence images be?

Discord strongly recommends 1024×1024. Upload them to your application in the developer portal and reference them by key.

How many buttons can Rich Presence have?

Two, set with SetDiscordRichPresenceAction using index 0 and 1.

Why can I not see my own buttons?

Discord hides Rich Presence buttons on your own profile. Other people see them.

Can I use an image URL instead of an uploaded asset?

The classic FiveM natives take the asset key uploaded to your application. Uploading the art to the application is the reliable method.

Does Rich Presence work if the player does not have Discord open?

No. The Discord desktop client must be running on the player’s PC for FiveM to update their presence.

Want a loading screen you never have to debug?

Build it in the browser, export once, and edit it whenever — no HTML, no re-uploads.

Start free

More guides