Compiling for Roblox✎

How a graph becomes a Luau file that Rojo syncs into Studio.

Pending review

This page is about graphs whose Target is Roblox. The bar along the top of the canvas says which, and a new graph takes the project's. For Lune, the answer is a different one and it is on Compiling for Lune.

A graph is a .nodescript under .roswaal/scripts. Compiling it writes a .luau file to the same place under src, and Rojo syncs that into Studio. Roswaal never talks to Studio itself.

Folders carry across: .roswaal/scripts/ReplicatedStorage/Shared/Greeter.nodescript writes src/ReplicatedStorage/Shared/Greeter.luau. Both directories are project settings.

What a graph compiles to

The file is named after the graph, and its ending comes from the script kind, chosen in the Inspector with nothing selected. The ending is how Rojo knows which class of instance to make.

KindFileIn Studio
ScriptGreeter.server.luauA Script, running on the server
LocalScriptGreeter.client.luauA LocalScript, running on a player's machine
ModuleScriptGreeter.luauA ModuleScript, run by whatever requires it

Compiling

What it compiles
Compile script, or Ctrl + SThe open graph
Compile projectEvery graph, then every node map
Compile: DynamicEach graph as you edit it, and each graph whose file changes on disk, such as after a git pull
roswaal compileEverything, or the one graph or map you give it
roswaal watchThe same, without the editor

A graph with errors writes nothing; warnings do not stop it. With format on and StyLua on your PATH, the file is formatted as it is written. If StyLua refuses it, it is written unformatted and the compile says why.

In either mode, an open graph whose file changes on disk takes the new version. If it has edits that are not saved yet, you are asked which to keep.

Generated files

A generated file starts with a header naming its graph and a hash of what was written. Roswaal will not overwrite a file whose hash no longer matches — one edited by hand — or a file it did not write.

Danger

To overwrite one anyway, click overwrite in the compile results, or run roswaal compile --force. The hand edit is lost.

Moving and deleting graphs

Rename a graph, move it or change its kind, and its next compile removes the file it used to write.

A generated file whose graph is gone is stale, and Rojo goes on syncing it. The compile results list stale files with a remove link. From the command line, roswaal prune lists them and roswaal prune --yes removes them.

Where each file lands in Studio is set by a node map, on Rojo projects and node maps.

Not reviewed yet