# getConvar (Shared)

> Reads a convar as text. On a client, a convar the server syncs comes before the client's own.

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

## Syntax

```lua
string|any getConvar(string name [, any default = false])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `name` | `string` | The convar's name. |
| `default` | `any` | What to return when the convar does not exist or is empty. *(default: `false`)* |

## Returns

The convar's value. If it does not exist or is empty, `default`.

## Example

```lua
local mode = getConvar("gamemode", "freeroam")
```

## See also

- [getConvarInt (Shared)](https://wiki.mymp.gg/en/getConvarInt.md): Reads a convar as an integer.
- [setConvar (Server)](https://wiki.mymp.gg/en/setConvar-server.md): Sets a convar on the server, creating it if it does not exist. With synced, the value goes to every client, including those who join later, and their getConvar reads it.
- [setConvar (Client)](https://wiki.mymp.gg/en/setConvar-client.md): Sets a convar on this client only. It is never sent to the server. With persist, the value is kept for this server and comes back in the next session.
