Skip to content
Saiko

saveinstance

Saves an instance and everything under it to a file in the executor workspace.

Signature

luau
saveinstance(instance: Instance, options: { FileName: string? }?): ()

Parameters

instanceInstance

The instance to save.

options{ FileName: string? }?

Optional. FileName is the name of the file to write.

Returns

Nothing.

Note

Example

luau
local part = Instance.new("Part")
part.Name = "Saved"

saveinstance(part, { FileName = "saved_part" })
task.wait(0.5)

for _, path in listfiles("") do
    if path:find("saved_part") then
        print("wrote", path)
    end
end