# Passing data to the loading screen with deferrals.handover

> Send data from the server to a FiveM loading screen with deferrals.handover and read it in JavaScript as window.nuiHandoverData: show the player’s name, queue position, rules version or announcements — with the security caveats.

Source: https://fam-tools.com/guides/fivem-loading-screen-handover-data · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 9 min

**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.

## Key points

- `deferrals.handover(table)` is called on the **server** during `playerConnecting`.
- The loading screen reads it as **`window.nuiHandoverData`**.
- `serverAddress` is added automatically.
- Call `handover` before `deferrals.done()`.
- Anything you hand over can be read by the player — never include secrets.

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*

```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](https://fam-tools.com/guides/fivem-deferrals-connecting-cards).

## Reading it in the loading screen

*script.js*

```javascript
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);
```

> **Always have a fallback** — When you open the page in a normal browser for testing, `nuiHandoverData` does not exist. Default to an empty object so the page still renders.

## Useful things to hand over

| Value | Why |
| --- | --- |
| Player name | A personal greeting |
| Queue position | Reassurance during long waits |
| Announcement | Events, updates, maintenance windows |
| Rules version | Prompt players when the rules changed |
| Player count | Social proof while loading |
| Whitelist status | Tell 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](https://fam-tools.com/guides/fivem-loading-screen-live-player-count).

## 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.

## 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.

## Related

- https://fam-tools.com/guides/fivem-deferrals-connecting-cards
- https://fam-tools.com/guides/fivem-loading-screen-live-player-count
- https://fam-tools.com/guides/fivem-loadscreen-manual-shutdown
- https://fam-tools.com/guides/fivem-loading-screen-progress-bar
