saveinstance
Saves the game, or part of it, to a file in your workspace folder that Roblox Studio can open.
Syntax
saveinstance(root: Instance | {Instance}?, options: SaveInstanceOptions | table?) -> ()
Parameters
| Parameter | Type | Description |
|---|---|---|
root | Instance or {Instance}? | What to save: one Instance, an array of Instances, or nothing for the whole game. |
options | SaveInstanceOptions or table? | How to save it. See the description. |
Description
With no options, or with an object from SaveInstanceOptions.new(), the file is binary: .rbxl for the game and .rbxm for anything else. With an ordinary table of options it is XML: .rbxlx or .rbxmx. The call yields until the file is complete; the file appears only once it has been fully written.
The options are FilePath (the file name, with or without extension), DecompileScripts (put decompiled source in scripts; default true), IgnoreArchivable, SaveNilInstances, SavePlayers, SavePlayerCharacters, SaveNonCreatable, IgnoreDefaultProperties, DisableCompression, IgnoreList (an array of Instances to leave out with their descendants) and the decompiler settings from DecompilerOptions.
Example
saveinstance()
saveinstance(workspace.Map, { FilePath = "Map" })
local options = SaveInstanceOptions.new()
options.SaveNilInstances = true
options.IgnoreList = { game.Players }
saveinstance(game, options)
Notes
- Large places take time; the game keeps running while the save proceeds.
These are Game executor contracts. Check build requirements and session lifetimes before using them.
