saveinstance
Saves supported scene data to a VRTX file.
Syntax
Signature
saveinstance(OptionsOrPath: (table | string)?) -> (string, SaveReport)Aliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
OptionsOrPath | (table | string)? | Path, options table, or root instance table. |
Returns
| Type | Description |
|---|---|
string | Actual saved path. |
SaveReport | Table 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)