hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
60 lines (29 loc) • 1.16 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [server](./server.md) > [Player](./server.player.md) > [setPersistedData](./server.player.setpersisteddata.md)
## Player.setPersistedData() method
Set the persisted data for the player. This data can later be retrieved using [Player.getPersistedData()](./server.player.getpersisteddata.md)<!-- -->, even if a player disconnects and rejoin a game in the future, or joins a different HYTOPIA managed lobby of your game.
**Signature:**
```typescript
setPersistedData(data: Record<string, unknown>): Promise<Record<string, unknown> | void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
data
</td><td>
Record<string, unknown>
</td><td>
The data to set.
</td></tr>
</tbody></table>
**Returns:**
Promise<Record<string, unknown> \| void>
The persisted data for the player.
## Remarks
This method is asynchronous and returns a promise that resolves to the player data.