# getServerPassword (Server)

> Returns the password a player has to give to join.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Server
- **Category**: Server
- **URL**: https://wiki.mymp.gg/en/getServerPassword

## Syntax

```lua
string|nil getServerPassword()
```

## Returns

The password, or `nil` if the server has none.

## Example

```lua
if getServerPassword() then
    print("the server is locked")
end
```

## See also

- [setServerPassword (Server)](https://wiki.mymp.gg/en/setServerPassword.md): Changes the password to join the server. Players already in stay.
