---
name: "BIS_fnc_spawn"
type: function
status: ok
groups: ["Program Flow"]
arma3_since: "0.56"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_spawn
revid: 327596
updated: 2022-07-13T09:48:17Z
---

# BIS_fnc_spawn

*Function · Program Flow · Arma 3 v0.56*

Locality: executed with **spawn**

## Description

Execute given code with or without parameter.

> [!NOTE]
> **Arma 3:** Since Arma 3 v1.50, use [remoteExec](../commands/remoteExec.md)/[remoteExecCall](../commands/remoteExecCall.md) instead.

## Syntax

### Syntax 1

```sqf
[params, code] spawn BIS_fnc_spawn
```

**Parameters:**

- `params`: [Anything](../topics/Anything.md) - function arguments
- `code`: [Code](../topics/Code.md) - function code

**Returns:** [Nothing](../topics/Nothing.md)

### Syntax 2

```sqf
code spawn BIS_fnc_spawn
```

**Parameters:**

- `code`: [Code](../topics/Code.md)

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

Show a message for the current player:

```sqf
[["Hello"],  { hint (_this select 0) }] spawn BIS_fnc_spawn;
```

### Example 2

Show a message to all connected players:

```sqf
[[["Hello"], { hint (_this select 0) }], "BIS_fnc_spawn", true, false, false] call BIS_fnc_MP; // obsolete, use remoteExec

["Hello", { hint (_this select 0) }] remoteExec ["BIS_fnc_spawn"];    // since the introduction of remoteExec
["Hello", { hint (_this select 0) }] remoteExec ["spawn"];            // BIS_fnc_spawn is obsolete
["Hello"] remoteExec ["hint"];                                        // best solution here
```

### Example 3

```sqf
{ hint "Hello" } spawn BIS_fnc_spawn;
```

## See also

[remoteExec](../commands/remoteExec.md) · [remoteExecCall](../commands/remoteExecCall.md) · [BIS_fnc_execFSM](../functions/BIS_fnc_execFSM.md) · [BIS_fnc_execRemote](../functions/BIS_fnc_execRemote.md) · [BIS_fnc_execVM](../functions/BIS_fnc_execVM.md) · [BIS_fnc_call](../functions/BIS_fnc_call.md)

<sub>Source: [BI Community Wiki — BIS fnc spawn](https://community.bistudio.com/wiki/BIS_fnc_spawn) (revision 327596).</sub>
