saveinstance
Saves an instance (or the game) to a file.
Syntax
saveinstance(options: table?) -> voidParameters
| Parameter | Type | Description |
|---|---|---|
options | table | (Optional) Save options |
Options
| Option | Type | Description |
|---|---|---|
FilePath | string | Output file path |
Object | Instance | Instance to save (default: game) |
ExtraInstances | table | Additional instances to include |
NilInstances | boolean | Include nil-parented instances |
RemovePlayerCharacters | boolean | Exclude player characters |
Mode | string | "optimized", "full", or "scripts" |
Returns
This function does not return a value.
Description
saveinstance exports an instance hierarchy to an RBXL/RBXM file, which can be opened in Roblox Studio.
Example
-- Save the entire game
saveinstance({
FilePath = "game.rbxl"
})
-- Save a specific model
saveinstance({
FilePath = "model.rbxm",
Object = workspace.MyModel
})
-- Save with options
saveinstance({
FilePath = "full_game.rbxl",
NilInstances = true,
Mode = "full"
})Notes
- File is saved to the workspace folder
- Large games may take time to save
- Some instances may not save properly
Related Functions
saveplace- Shorthand for saving game