Yuari
Documentation
Docs/Miscellaneous/saveinstance

saveinstance(pathOrOptions?) / savegame(pathOrOptions?)

Serializes the DataModel tree to a Luau file and returns the file name.

Syntax

saveinstance(options: { FileName: string? }?) -> string?

Parameters

ParameterTypeDescription
pathOrOptionsstring | tableOptional file name or { FileName = "..." }.

Returns

TypeDescription
string?File name written in the workspace (savefile.lua by default), or nil on failure.

Description

Walks game:GetChildren recursively and writes a Luau reconstruction script with instance classes, names and common part properties.

Logic change: the return value is now the written file name instead of a boolean, and child instances are serialized correctly (the previous negative stack index caused children to be skipped, producing a 178-byte file).

Example

local file = saveinstance({ noscripts = true })
print(isfile(file), #readfile(file) > 1000)

Notes

  • The generated script is a reconstruction, not a binary place file.