Passing data to the loading screen with deferrals.handover

9 min read4 sections · 4 questions answered
Short answer

In the server’s playerConnecting handler, call deferrals.handover({ key = value }) before deferrals.done(). In the loading screen, read the values from window.nuiHandoverData — FiveM also adds serverAddress automatically. Send small, non-sensitive values only; everything handed over is visible to the player.

A loading screen that greets the player by name, shows today’s announcement or tells them they are 12th in the queue feels alive. FiveM has a built-in way to hand data from the server to the loading screen while the player connects: deferrals.handover. It is a few lines on each side.

The server side

server.lua
AddEventHandler('playerConnecting', function(name, setKickReason, deferrals)
    local src = source
    deferrals.defer()
    Wait(0)

    deferrals.handover({
        name = name,
        announcement = 'Double pay for EMS this weekend',
        rulesVersion = '2026-09',
        online = #GetPlayers(),
    })

    deferrals.done()
end)

Deferrals pause a connecting player while your server does work — whitelist checks, bans, queues — and handover attaches data to that connection for the loading screen. How deferrals work in full is in deferrals and connecting cards.

Reading it in the loading screen

script.js
const data = window.nuiHandoverData || {};

document.querySelector('#welcome').textContent =
  data.name ? `Welcome back, ${data.name}` : 'Welcome';

if (data.announcement) {
  document.querySelector('#announcement').textContent = data.announcement;
}

console.log('connected to', data.serverAddress);

Useful things to hand over

ValueWhy
Player nameA personal greeting
Queue positionReassurance during long waits
AnnouncementEvents, updates, maintenance windows
Rules versionPrompt players when the rules changed
Player countSocial proof while loading
Whitelist statusTell an applicant their application is pending

Live values that change while the player loads — a player count that keeps updating — are better fetched by the page from an HTTP endpoint, as in live player counts.

What not to hand over

The loading screen runs on the player’s PC, so everything in nuiHandoverData is visible to them. Never include API keys, webhook URLs, other players’ data or anything you would not print on their screen.

Common questions

How do I show the player’s name on the FiveM loading screen?

In playerConnecting, call deferrals.handover({ name = name }), then read window.nuiHandoverData.name in the loading screen’s JavaScript.

What is nuiHandoverData?

The object FiveM exposes to the loading screen containing the values passed with deferrals.handover, plus serverAddress.

Do I need deferrals to use handover?

Yes. handover is a method of the deferrals object in playerConnecting. Call deferrals.defer() first and deferrals.done() after.

Can I update handover data after the player connects?

No, it is set during connection. For values that change while loading, have the page fetch them from an HTTP endpoint.

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