Workspace & files

The folder your scripts can read and write, and the rules that keep it safe.

Every file function in the Lynx API, from readfile & writefile to listfiles, works inside one folder: the workspace. Scripts can't reach anything outside it.

Where it lives

The workspace is the Workspace folder under Files in the editor's sidebar. Settings → Client → Open Workspace opens it in File Explorer.

Paths

  • Paths are relative to the workspace root: "configs/settings.json", never "C:\Users\...".
  • Use forward slashes. Backslashes work too, but forward slashes keep scripts portable.
  • Paths that lead out of the workspace, such as absolute paths or .. segments, are rejected with an error.
  • makefolder & writefile both create missing parent folders.

Blocked file types

Scripts can read any file in the workspace, but can't write files Windows would run or unpack:

ExtensionsWhy
.exe .dll .com .scr .msi .cplPrograms, libraries & installers
.bat .cmd .ps1 .vbs .js .wsf .hta .jarScripts Windows can execute
.lnk .url .reg .infShortcuts & system files
.zip .rar .7z .cab .iso .img .xmlArchives, disk images & XML

writefile & appendfile raise an error for these extensions, and for a few rarer ones of the same kinds.

Saving script data

A common pattern: keep a script's settings as JSON in its own folder, with defaults when nothing is saved yet.

settings.luau
1local HttpService = game:GetService("HttpService")
2
3local FOLDER = "my-tool"
4local PATH = FOLDER .. "/settings.json"
5
6local defaults = { volume = 0.5, keybind = "RightShift", theme = "dark" }
7
8local function load()
9 if not isfile(PATH) then
10 return table.clone(defaults)
11 end
12 local ok, data = pcall(HttpService.JSONDecode, HttpService, readfile(PATH))
13 return if ok then data else table.clone(defaults)
14end
15
16local function save(settings)
17 if not isfolder(FOLDER) then
18 makefolder(FOLDER)
19 end
20 writefile(PATH, HttpService:JSONEncode(settings))
21end
22
23local settings = load()
24settings.volume = 0.8
25save(settings)

The Files sidebar

The sidebar's Files view lists Scripts, Workspace & AutoExec and follows the folders live. Click a script to open it in a tab. Right-click for Execute, Rename, Duplicate, View in Explorer & Delete. CtrlP finds an open tab or a recent script by name.