# setConvar (Server)

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

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Server
- **Category**: Convars
- **URL**: https://wiki.mymp.gg/en/setConvar-server
- **Counterpart**: Also exists on the client, with its own implementation: [setConvar (Client)](https://wiki.mymp.gg/en/setConvar-client.md)

## Syntax

```lua
bool setConvar(string name, string value [, bool synced = false])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `name` | `string` | The convar's name. |
| `value` | `string` | The value. |
| `synced` | `bool` | Sync it to the clients. A `setConvar` without it stops syncing the convar. *(default: `false`)* |

## Returns

`true`.

## Example

```lua
setConvar("weather_cycle", "1", true)
```

### Note

A secret convar, such as `password` or `server_key`, cannot be synced: the call raises an error. A synced convar's name and value hold at most 4000 bytes together.

## See also

- [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.
- [getConvar (Shared)](https://wiki.mymp.gg/en/getConvar.md): Reads a convar as text. On a client, a convar the server syncs comes before the client's own.
