# createEffect (Shared)

> Creates a particle effect in the world. On the server every client sees it; on a client, only that client does.

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

## Syntax

```lua
effect|false createEffect(string name, float x, y, z [, float rx, ry, rz = 0, 0, 0])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `name` | `string` | The effect's name, as a pack or `engineAddEffects` registered it. From 1 to 255 bytes. |
| `x, y, z` | `float` | Position in the world, three numbers or a vec3. |
| `rx, ry, rz` | `float` | Rotation in degrees, three numbers or a vec3. *(default: `0, 0, 0`)* |

## Returns

The created `effect` element, or `false` if it could not be created. On a client, also `false` when no effect has that name.

To make the effect follow an element, attach it with `attachElements`; the socket can be a ped's bone or a vehicle's or object's part. While the target is streamed out or the effect is outside the focused dimension, it waits and plays again with the same colour, scale and evolutions.

An effect a client created is destroyed once it is over or its target is gone. A server's effect stays until the server destroys it; a client joining later does not see a one-shot effect that is already over.

## Example

```lua
addCommandHandler("fogo", function()
    local pos = getElementPosition(localPlayer)
    local fire = createEffect("fire_large", pos.x, pos.y + 3, pos.z - 1)
    setTimer(stopEffect, 5000, 1, fire)
end)
```

### Coming from MTA

Takes only the name, position and rotation. Colour, scale and evolutions are changed afterwards with `setEffectColor`, `setEffectScale` and `setEffectEvolution`.

## See also

- [stopEffect (Shared)](https://wiki.mymp.gg/en/stopEffect.md): Stops an effect: it stops emitting and the particles already out finish.
- [setEffectColor (Shared)](https://wiki.mymp.gg/en/setEffectColor.md): Tints an effect with a colour.
- [attachElements (Shared)](https://wiki.mymp.gg/en/attachElements.md): Hangs one element on another. From then on it follows the target until it is detached.
- [engineAddEffects (Client)](https://wiki.mymp.gg/en/engineAddEffects.md): Registers the particle effects in a file of the resource, so createEffect can use them by name.
