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
FiveM scripts done right
Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.
Browse Scripts →