FragmentFragment

Installation

Get Fragment into your Roblox project.

Add the ModuleScript

In ReplicatedStorage, insert a new ModuleScript and name it Fragment.

Paste the source

Open the ModuleScript and paste the Fragment source code into it.

Create your project folder

Create a folder somewhere under StarterPlayerScripts — for example MySuperDuperUI. This is where your Handles, Stores, Hooks, Contexts and Components will live.


StarterPlayerScripts/
└── MySuperDuperUI/
    ├── FragmentLoad.client.luau
    ├── Stores/
    │   └── ...
    ├── Contexts/
    │   └── ...
    ├── Hooks/
    │   └── ...
    ├── Components/
    │   └── ...
    └── Handles/
        └── ...

Initialize Fragment

Create FragmentLoad.client.luau as a LocalScript inside your project folder. Pass a structured table to Fragment.load so every folder is required in the correct dependency order with no race conditions.

FragmentLoad.client.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Fragment = require(ReplicatedStorage.Fragment)

Fragment.load({ 
    Stores     = script.Parent.Stores, 
    Contexts   = script.Parent.Contexts, 
    Hooks      = script.Parent.Hooks, 
    Components = script.Parent.Components, 
    Handles    = script.Parent.Handles, 
}) 

Fragment.load walks every folder recursively, requires every ModuleScript it finds, then runs an initial render pass on all registered Handles. The structured form guarantees that Stores are registered before Contexts, Contexts before Hooks, Hooks before Components, and Components before Handles — so no module can reference something that has not been registered yet.

All keys are optional

You only need to include the folders that exist in your project. Omitting a key is safe.


Legacy single-folder usage

If you already have a project that loads a single folder, that call still works unchanged.

FragmentLoad.client.luau
Fragment.load(script.Parent.Handles)

On this page