ScriptsAboutBlogToolsKnowledge BaseReviewsFAQBasketDocsSupport
QBCoreclient

QBCore:Client:OnPlayerLoaded

QBCore client documentation with a FiveM Lua example.

Summary

Client event fired when the player is fully loaded into QBCore. The correct place to first read PlayerData — reading it earlier gives nil/empty data.

Returns

event

Example

RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
  PlayerData = QBCore.Functions.GetPlayerData()
  -- now safe to read job, money, etc.
end)

Common pitfalls

  • Reading PlayerData before this event is the #1 cause of 'attempt to index a nil value (field job)'.
  • Also handle QBCore:Client:OnPlayerUnload to clear your cached data on logout.
  • Keep job in sync with QBCore:Client:OnJobUpdate / OnPlayerUpdated.

Related functions

Related guides

Managing jobs on your server?

Viper Multi-Job lets players hold several jobs and switch between them with grade, salary and duty handled — QBCore, QBox and ESX, validated server-side.

See Viper Multi-Job →