> ## Documentation Index
> Fetch the complete documentation index at: https://flux-docs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Add Flux to your place and confirm it loads on both the server and the client.

## Requirements

<ParamField path="Roblox Studio" type="recent version" required>
  Flux uses `UnreliableRemoteEvent`, `buffer`, and Luau require-by-string
  (`require("@self/Utils/Types")`). All three ship in current Studio.
</ParamField>

<ParamField path="Luau require-by-string" type="enabled" required>
  Flux's internal modules require each other by relative path rather than through
  `script.Parent`. If your place predates require-by-string, enable it under
  **File → Studio Settings → Luau → Require By String**, or the equivalent
  place-level flag, before requiring Flux.
</ParamField>

<Note>
  Flux does not depend on any other module, so there is nothing to install alongside
  it.
</Note>

## Setup The System

<Steps>
  <Step title="Insert the system">
    Drag both `FluxClient.rbxmx` and `FluxServerLoader.rbxmx` files into your roblox studio viewport,
  </Step>

  <Step title="Insert the core">
    Drop the `Flux` module into **ReplicatedStorage**. Do not rename it.
  </Step>

  <Step title="Instert the server">
    Drop the `FluxServer` module into **ServerScriptService**. Do not rename it.
  </Step>

  <Step title="Request Your Place ID">
    If you have not already, open a request access questionare.
    Once accepted you will need to send your placeID (e.g [https://www.roblox.com/games/PLACEID/your-game-name](https://www.roblox.com/games/PLACEID/your-game-name))
    Once you have been granted access the system will ONLY work in THAT place.
  </Step>
</Steps>

## Expected hierarchy

<Tree>
  <Tree.Folder name="ReplicatedStorage" defaultOpen>
    <Tree.File name="Flux (ModuleScript)" />
  </Tree.Folder>

  <Tree.Folder name="ServerScriptService" defaultOpen>
    <Tree.File name="FluxServer (ModuleScript)" />
  </Tree.Folder>
</Tree>

`Flux` is the module you require, with `require(ReplicatedStorage.Flux)`. Everything
beneath it is internal.

<Info>
  `Flux_Reliable` and `Flux_Unreliable` are parented to the `Remotes` ModuleScript
  itself, not to a folder. If they are missing, the server creates them on first use
  through [`Remotes.Create`](/api/internals/remotes#remotes-create). You never need to
  add them by hand.
</Info>

## Server must initialise first

The client resolves the remotes with `WaitForChild`, and the server creates them. If
no server code ever requires Flux, every client will hang on that `WaitForChild`
forever.

<CodeGroup>
  ```luau ServerScriptService/FluxBootstrap.server.luau theme={null}
  local ReplicatedStorage = game:GetService("ReplicatedStorage")
  local Flux = require(ReplicatedStorage.Flux)

  -- Constructing any server event initialises the transport and
  -- creates Flux_Reliable / Flux_Unreliable.
  Flux.Server("Bootstrap")

  print("Flux initialised")
  ```

  ```luau StarterPlayerScripts/FluxCheck.client.luau theme={null}
  local ReplicatedStorage = game:GetService("ReplicatedStorage")
  local Flux = require(ReplicatedStorage.Flux)

  Flux.Client("Bootstrap")

  print("Flux ready on the client")
  ```
</CodeGroup>

<Warning>
  Requiring the root `Flux` module on its own does not create the remotes. The
  transport is initialised lazily, the first time you call `Flux.Server` or
  `Flux.Client`. Make sure at least one server-side `Flux.Server(...)` call runs during
  startup.
</Warning>

## Rojo projects

If you sync with Rojo, map the module into `ReplicatedStorage` and keep `Utils` as a
real directory so the relative requires still resolve:

```json default.project.json theme={null}
{
  "name": "my-game",
  "tree": {
    "$className": "DataModel",
    "ReplicatedStorage": {
      "Flux": {
        "$path": "src/shared/Flux"
      }
    }
  }
}
```

<Tree>
  <Tree.Folder name="src" defaultOpen>
    <Tree.Folder name="shared" defaultOpen>
      <Tree.Folder name="Flux" defaultOpen />
    </Tree.Folder>
  </Tree.Folder>
</Tree>

<Note>
  Under Rojo, `Flux_Reliable` and `Flux_Unreliable` will not exist in the synced tree.
  That is fine, because the server creates them at runtime.
</Note>

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="bolt" href="/quickstart">
    Fire your first event in both directions.
  </Card>

  <Card title="Architecture" icon="sitemap" href="/concepts/architecture">
    Understand what each of the seven modules does.
  </Card>
</CardGroup>
