saveinstance

Saves supported scene data to a VRTX file.

Syntax

Signature
saveinstance(OptionsOrPath: (table | string)?) -> (string, SaveReport)

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
OptionsOrPath(table | string)?Path, options table, or root instance table.

Returns

TypeDescription
stringActual saved path.
SaveReportTable with Instances, Skipped, ScriptsMissing, and ScriptsRecovered counts.

Notes

Pass a path string, an options table, or an instance to save as the root. Options accept FilePath, Root, and SaveScripts. FilePath defaults to Game.vrtx and SaveScripts defaults to true. Without a root, saves the available Workspace, Lighting, ReplicatedStorage, StarterPlayerScripts, and ServerScriptService trees.

An existing save is never replaced. The writer tries Game1.vrtx, Game2.vrtx, and later numbered names when needed. A .vrtx.json sidecar records warnings and omitted data. Unsupported assets, lights, surface textures, and unavailable script source are not invented.

Example

Luau
local Path, Report = saveinstance({FilePath = "Game.vrtx", SaveScripts = true})
print(Path, Report.Instances, Report.ScriptsMissing)