Hey guys! So I’ve been working on scripting and stuff the last few weeks for my new server but I’m having troubles with my Rich Presence on discord. As you see in the pictures below there are two names that say “nil nil” and i’m trying to figure out how to fix that to where it says their ! any help would be supported! Also here is Free to use Rich Presence, qbcore and esx ready!

discord_presence.rar (3.0 KB)
Can you attach the code in a block?
```lua
code
```
how do that brotha
ggdfg
opa
boa tarde
1 Like
function Discord:updateStatus(key, value)
if self[key] ~= value then
self[key] = value
end
local playerID <const> = PlayerId()
local discordAction = string.format(
"Players: %s/%s\n %s [%s] - %s",
self.count or GlobalState.playersCount,
tostring(GetConvarInt("sv_maxclients", 128)),
self.identity or GetPlayerName(playerID),
GetPlayerServerId(playerID),
self.role
)
SetRichPresence(discordAction)
end
function Discord:initRichPresence(firstName, lastName, group)
local presenceSettings = Discord.RichPresence
SetDiscordAppId(presenceSettings.AppID)
SetDiscordRichPresenceAsset(presenceSettings.largeIcon)
SetDiscordRichPresenceAssetText(presenceSettings.largeIconText)
if presenceSettings.smallIcon and presenceSettings.smallIconText then
SetDiscordRichPresenceAssetSmall(presenceSettings.smallIcon)
SetDiscordRichPresenceAssetSmallText(presenceSettings.smallIconText)
end
SetDiscordRichPresenceAction(0, presenceSettings.buttons[1].label, presenceSettings.buttons[1].url)
SetDiscordRichPresenceAction(1, presenceSettings.buttons[2].label, presenceSettings.buttons[2].url)
local fullName <const> = string.format("%s %s", firstName, lastName)
Discord:updateStatus("identity", fullName)
Discord:updateStatus("role", formattedRole)
end
AddStateBagChangeHandler(“playersCount”, “global”, function(_, _, newValue)
local firstTimer = GetGameTimer()
local delay = 3000
repeat
Wait(1000)
until (firstTimer + delay) < GetGameTimer()
Discord:updateStatus(“count”, GlobalState.playersCount == newValue and newValue or GlobalState.playersCount)
end)