# async.wait (Shared)

> Pauses the current async thread for `ms` milliseconds. The rest of the game keeps running.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Timers and async
- **URL**: https://wiki.mymp.gg/en/async.wait

## Syntax

```lua
nil|false async.wait(float ms)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `ms` | `float` | Milliseconds to pause. A negative value counts as 0. |

## Returns

Nothing when the thread resumes. Only works inside an async thread. Outside one, it logs an error and returns `false`.

## Example

```lua
async.thread(function()
    while true do
        outputDebugString("players online: " .. #getElementsByType("player"))
        async.wait(60000)
    end
end)
```

## See also

- [async.yield (Shared)](https://wiki.mymp.gg/en/async.yield.md): Pauses the current async thread until the scripts' next update, to split long work into pieces.
- [async.thread (Shared)](https://wiki.mymp.gg/en/async.thread.md): Runs a function in a new async thread, right away. The call returns when the function ends or first pauses, as with async.wait.
- [setTimer (Shared)](https://wiki.mymp.gg/en/setTimer.md): Calls a function after an interval, once or repeatedly.
