# onPlayerJoin (Server)

> Fired when a player has finished joining and has received the server's initial state.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Event
- **Side**: Server
- **Category**: Players and accounts
- **URL**: https://wiki.mymp.gg/en/onPlayerJoin

## Syntax

```lua
addEventHandler("onPlayerJoin", root, function() ... end)
```

## Source

The player that joined.

## Example

```lua
addEventHandler("onPlayerJoin", root, function()
    spawnPlayer(source, 2495.1, -1687.4, 13.5, 0, "male01")
end)
```

## See also

- [onPlayerConnect (Server)](https://wiki.mymp.gg/en/onPlayerConnect.md): Fired when a connection is about to be admitted, before the player exists. Cancelling the event refuses it.
- [onPlayerQuit (Server)](https://wiki.mymp.gg/en/onPlayerQuit.md): Fired when a player leaves the server, before their element is destroyed.
- [spawnPlayer (Server)](https://wiki.mymp.gg/en/spawnPlayer.md): Places the player in the world, with health at 100, no armour, in interior 0 and with no weapons.
