Storage
Storage is a regular Lua table containing local data for the current module. It is client-only; the global Storage value is nil in a Reflex server.lua.
Storage has no interface of its own and is not synchronized with the server or other players. Only this module’s code on the current client sees the values; render them through UI or ImGui when the player needs to see them.
How data is persisted
Section titled “How data is persisted”While the module runs, Storage is a regular table in its Lua environment. When module state is saved, the client module manager serializes supported values and restores them into a new table on the next load. Unsupported values do not become persistent.
Assignment changes local state only. It does not emit an event, update Config, or notify other code automatically.
Quick example
Section titled “Quick example”if Storage.Settings == nil then Storage.Settings = { ShowHints = true, Scale = 1 }end
Storage.Settings.Scale = 1.25Storage is isolated by module. Another module does not receive this table.
Supported values
Section titled “Supported values”| Lua value | Persisted |
|---|---|
string |
✅ |
number |
✅ |
boolean, including false |
✅ |
nested table |
✅ |
nil |
deletes the key |
Vector2, Vector3, Color, and other userdata |
❌ |
function |
❌ |
Unsupported values are silently discarded during serialization.
Store a structure such as Vector3 as separate numbers:
local position = Vector3.new(10, 2, 5)
Storage.Position = { x = position.x, y = position.y, z = position.z}
local saved = Storage.Positionlocal restored = Vector3.new(saved.x, saved.y, saved.z)When data is saved
Section titled “When data is saved”The game saves Storage when the module is disabled normally and loads it the next time the module is enabled.
Deleting data
Section titled “Deleting data”Assign nil, then disable the module normally:
Storage.LegacyValue = nilStorage.OldSettings = nilThe removed keys remain nil after the next enable.
Recommended structure
Section titled “Recommended structure”Keep data under one versioned key to make migrations easier:
if Storage.Data == nil or Storage.Data.Version ~= 1 then Storage.Data = { Version = 1, Enabled = true, Opacity = 0.8 }endCommon mistakes
Section titled “Common mistakes”Storing userdata directly
Section titled “Storing userdata directly”Storage.Position = Vector3.one works in the live Lua table, but the value disappears during serialization. Convert the vector to a table of numbers.
Testing a boolean with if not
Section titled “Testing a boolean with if not”When false is a valid stored value, distinguish it from a missing key:
if Storage.Enabled == nil then Storage.Enabled = trueendStructured values such as Vector2, Vector3, and Color must be stored as number tables.