> ## Documentation Index
> Fetch the complete documentation index at: https://lua.wingless.one/llms.txt
> Use this file to discover all available pages before exploring further.

# Particles

## Functions

| Function | Returns | Description |
| - | - | - |
| `particle.create(path [, attach])` | `effect` | Create a particle effect. Default attach is `particle.attach.worldorigin` |
| `particle.precache(path)` | | Load a particle file ahead of time |
| `particle.override(game_path, file)` | `bool/nil, error` | Replace a game particle with one from `scripts/particles` |

## Attach modes

| Constant | Value |
| - | - |
| `particle.attach.absorigin` | 0 |
| `particle.attach.absorigin_follow` | 1 |
| `particle.attach.customorigin` | 2 |
| `particle.attach.customorigin_follow` | 3 |
| `particle.attach.point` | 4 |
| `particle.attach.point_follow` | 5 |
| `particle.attach.eyes_follow` | 6 |
| `particle.attach.overhead_follow` | 7 |
| `particle.attach.worldorigin` | 8 |
| `particle.attach.rootbone_follow` | 9 |

## Effect methods

| Method | Returns | Description |
| - | - | - |
| `effect:set_point(cp, vec)` | `self` | Set control point position. Also accepts `(cp, x, y, z)` |
| `effect:set_color(cp, col)` | `self` | Set control point as RGB color (converts to 0-255 floats) |
| `effect:bind(cp, entity [, follow, attachment])` | `self` | Bind control point to an entity |
| `effect:path(points)` | `self` | Set a path of positions (2+ vectors) |
| `effect:lifetime(seconds)` | `self` | Auto-destroy after `seconds` |
| `effect:destroy()` | | Destroy immediately |
| `effect:valid()` | `bool` | Whether the effect is still alive |
| `effect:index()` | `number?` | Internal particle system index |

## Example

```lua theme={null}
local fx = particle.create('particles/my_effect.vpcf')
fx:set_point(0, entity.local_pawn():origin())
fx:set_color(1, color(255, 0, 0))
fx:lifetime(3)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.