# GameModule

## Installation

Click this ![](https://3676259257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVUU2n77rqU9V23f4W1Tt%2Fuploads%2FWYMhK1amJb5JLAL3KDWj%2Fimage.png?alt=media\&token=6af5c0da-44ad-41c3-ae58-5c574585d6b3) button (top-right)\
It will insert the module into `ReplicatedStorage`

## Usage

To Initialize the module, just require it

```luau
local vfx = require(game:GetService("ReplicatedStorage").vfx)
-- Now shared.vfx and shared.fx are available in any script
-- All the add-ons in the module will be initialized too
-- Any instance with the tag 'EnabledVFX' will be .enable()d
```

{% hint style="info" %}
shared API is available in edit mode for use in add-ons and other plugins (like moon animator)
{% endhint %}

## API

<table><thead><tr><th width="229"> Function</th><th>Description</th></tr></thead><tbody><tr><td><code>emit(vfx: Instance)</code></td><td>same as the Emit button</td></tr><tr><td><code>enable(vfx: Instance)</code></td><td>same as the Enable button</td></tr><tr><td><code>disable(vfx: Instance)</code></td><td>same as the Disable button</td></tr></tbody></table>

<table><thead><tr><th width="227">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>temp</code></td><td>The <code>TempVFX</code> folder</td></tr><tr><td><code>util</code></td><td>Reference to the <code>util</code> module</td></tr><tr><td><code>classes</code></td><td>All the vfx instances classes like containers</td></tr></tbody></table>

<table><thead><tr><th width="301">Function</th><th>Description</th></tr></thead><tbody><tr><td><code>rescale(vfx, scale, origins?)</code></td><td>the Scale slider</td></tr><tr><td><code>recolor(vfx, H, S, L, origins?)</code></td><td>the Hue, Saturation, Lightness sliders</td></tr><tr><td><code>retime(vfx, timeScale, origins?)</code></td><td>the Retime slider (doesn't use <code>TimeScale</code> property)</td></tr><tr><td><code>tween(obj, info, goals, yield?)</code></td><td>Tweens any property and attribute of any datatype</td></tr></tbody></table>

<table><thead><tr><th width="329">Function</th><th></th></tr></thead><tbody><tr><td><code>getCFrame(vfx, class?): CFrame</code></td><td>gets the cframe of any effect like particles</td></tr><tr><td><code>maxLifetime(obj, noAttrs?)</code></td><td>max lifetime of VFX (wip)</td></tr><tr><td><code>destroyAfter(obj, delay?, callback?)</code></td><td>delayed destroy (default: <code>maxLifetime(obj)</code>)</td></tr></tbody></table>

{% code lineNumbers="true" %}

```luau
shared.fx.add({
    ...
})
```

{% endcode %}

<table><thead><tr><th width="114">Member</th><th>Description</th></tr></thead><tbody><tr><td><code>emit</code></td><td>adds an emitter function called with <code>.emit(vfx)</code></td></tr><tr><td><code>enable</code></td><td>adds an enabler function called with <code>.enable(vfx)</code></td></tr><tr><td><code>disable</code></td><td>adds a disabler function called with <code>.disable(vfx)</code></td></tr><tr><td><code>retime</code></td><td>adds a retime function called with <code>.retime(vfx)</code></td></tr><tr><td><code>recolor</code></td><td>adds a recolor function called with <code>.recolor(vfx)</code></td></tr><tr><td><code>rescale</code></td><td>adds a scaling function called with <code>.rescale(vfx)</code></td></tr><tr><td><code>selector</code></td><td>the <code>:QueryDescendants()</code> selector for the functions above</td></tr></tbody></table>

{% hint style="info" %}
This is how add-ons add more functionality to the module
{% endhint %}
