UniversalSynSaveInstance
This module saves the current place, one Instance (a Roblox object), or a
group of Instances to a .rbxl/.rbxm (binary) or .rbxlx/.rbxmx (XML)
file.
All options are optional. See UniversalSynSaveInstance.SaveInstanceOptions for all options. Option names are not case-sensitive. Old names from UniversalSynSaveInstance.OptionsAliases and UniversalSynSaveInstance.OptionsAliasesInverse also work. The most common options are at the top of UniversalSynSaveInstance.SaveInstanceOptions. Related options are grouped together, and advanced or rarely used options are at the bottom.
Types
SaveInstanceOptions
interface SaveInstanceOptions {mode: string--
What to save. optimized saves the most important services (Workspace, Players, Lighting, ReplicatedStorage, StarterGui, and others). full saves everything under game. scripts saves only the top-level parts that contain a LuaSourceContainer (a script object). It saves the whole part, not just the script. Any other value saves only ExtraInstances (and Object, if set). If Object is set, optimized becomes full. Default: optimized
Binary: boolean--
Save a binary file (.rbxl/.rbxm) instead of an XML file (.rbxlx/.rbxmx). Binary files are smaller and load faster. If the executor cannot write binary data correctly, the script uses XML. Set the old option XML = true to force XML. Default: true
CompressionMode: string | boolean--
How to compress (make smaller) the binary file: "zstd", "lz4", or false for no compression. true means "zstd". The old option DisableCompression = true means false. Default: "zstd"
CompressionLevel: number--
Compression level for zstd, from -7 to 22. A higher level makes a smaller file but takes longer. This is ignored for lz4 and when compression is off. Default: 9
FilePath: string | false--
File name to save to. You can include a folder. If the name has no extension, the script adds one based on Binary and IsModel. If you set this, the script overwrites an existing file and ignores AvoidFileOverwrite. Default: false
SafeMode: boolean--
Disconnect the LocalPlayer from the game when saving starts. This turns on KillAllScripts and BoostFPS unless you set them yourself. HIGHLY RECOMMENDED. Default: false
KillAllScripts: boolean--
Close or disable other running scripts before saving. SafeMode turns this on. Some games stop responding to input after this. That is normal. HIGHLY RECOMMENDED. Default: false
BoostFPS: boolean--
Turn off 3D rendering while saving, then turn it back on. SafeMode turns this on. Default: false
Object: Instance | false--
Save this Instance instead of the whole place. The script saves a model if you do not set IsModel = false. If you pass game, it saves the place and uses full mode. You must pass an Instance, not a name. Default: false
IsModel: boolean--
Save a model (.rbxm/.rbxmx) instead of a place (.rbxl/.rbxlx). Object turns this on unless you set it yourself. Passing a list of Instances as an argument also turns it on. Default: false
ShowStatus: boolean--
Show a status label on the screen. It shows the size while saving, then the final size and time. Default: true
ReadMe: boolean--
Add a README script to the save. It contains save details (place ID, date, time, platform, executor, recovered scripts, warnings) and tips. Default: true
Decompile: boolean--
Turn the compiled script back into source code (decompile). This replaces the Source of each LuaSourceContainer with decompiled code. If this is off, Source says decompiling is disabled. Default: true
SaveBytecode: boolean--
If the executor supports getscriptbytecode, add the compiled script data (bytecode) to Source as a comment. You can decompile it later. This respects DecompileIgnore. Default: false
DecompileTimeout: number--
How many seconds one decompile call can take. If it takes longer, the script stops waiting and writes a timeout message in Source. Set to -1 to disable the timeout. Default: 10
BytecodeTimeout: number--
How many seconds a getscriptbytecode call can take. If it takes longer, the script stops waiting and skips the bytecode for that script. Set to -1 to disable the timeout. Default: 3
DecompileIgnore: {Instance | string} | {[Instance | string]: boolean | {[string]: boolean}}--
Skip decompiling matched Instances and their children. Source becomes a short ignored message. You can pass an Instance, a class name, or ClassName = {Name1, Name2}. Set an Instance to false to skip only that instance, not its children. Default: {TextChatService}
SourceCache: {[Instance]: string} | false--
Source text to use for these scripts as-is instead of decompiling them. Default: false
DecompileJobless: boolean--
Only use scripts that are already in the decompile cache. Missing scripts get a short not-found message. This turns on scriptcache. Default: false
scriptcache: boolean--
If the executor supports getscriptbytecode, cache decompiled code. This avoids decompiling the same script twice. The cache stays after the script reloads. Default: true
RecoverScriptsFromAssets: boolean--
Recover the original Source of scripts that were published as assets. Changes made after publishing are not included. Default: true
IsolatePlayers: boolean--
Put every Player under a top-level "Players" Folder instead of inside the Players service. This turns on SaveNotCreatable. If both are on, this option is used instead of IsolateLocalPlayer. Default: false
IsolateLocalPlayer: boolean--
Save the LocalPlayer as a Folder named "LocalPlayer" instead of a Player object. This is ignored if IsolatePlayers is on. Default: false
IsolateLocalPlayerCharacter: boolean--
Save LocalPlayer.Character as a Model named "LocalPlayer Character". This saves the character even when characters are normally skipped. Default: false
IsolateStarterPlayer: boolean--
Put StarterPlayer's children under a top-level "StarterPlayer" Folder. The original service stays, but it is empty. Default: false
SavePlayerCharacters: boolean--
Save player characters instead of skipping them. This also saves objects with Archivable = false, so IgnoreNotArchivable is forced on. Default: false
NilInstances: boolean--
Include objects that have no parent (they are not under game). This needs the executor function getnilinstances. When that function exists, it also turns on SaveNotCreatable. Default: false
ExtraInstances: {Instance}--
A list of Instances to add to the normal save. If mode is not a valid value, only these Instances (and Object, if set) are saved. Passing a list of Instances as an argument fills this list. Default: {}
IgnoreList: {Instance | string} | {[Instance | string]: boolean | {[string]: boolean}}--
Objects to skip. Use an Instance or a class name as a key to skip that object and its children. ClassName = false keeps the object but skips its children. ClassName = {Name1, Name2} skips objects with those names. You can also pass a list of Instances or class names. Default: {CoreGui, CorePackages, Packages = false}
MaxDepth: number--
Objects nested deeper than this are moved up under their ancestor at depth MaxDepth, so nothing is dropped, only the nesting is lost. This stops very deep hierarchies from overflowing the stack when Roblox Studio opens the file (binary saves opened at 1740 levels deep; XML saves crashed at 1750). Use math.huge to disable. Default: 1000
IgnoreSpecialProperties: boolean--
Do not use the executor function gethiddenproperty. Other property reads still work. This can help if your executor crashes or the file is corrupted. Default: false
AlternativeWritefile: boolean--
Write the file in smaller pieces with appendfile instead of one writefile call. For binary saves, if appendfile fails, it uses writefile; if both fail, it switches to XML. Default: true
Anonymous: boolean | {Name: string?,UserId: number?}--
RISKY: Replace LocalPlayer.Name and UserId in the output. true replaces them with "Roblox" and 1. You can also pass a table with Name and/or UserId. Name matching ignores case. This can also change other text or numbers that match. Default: false
RiskyServicesDisabled: {UGC: boolean?,Encoding: boolean?,Reflection: boolean?}--
Turn off services that some games may detect. UGC skips UGCValidationService (used for some hidden properties). Encoding skips EncodingService. Reflection skips ReflectionService (used for class data). Set a flag to true to skip that service. If you do not set RiskyServicesDisabled yourself, the UGC fallback turns on automatically when gethiddenproperty is missing. Default: {UGC = true, Encoding = false, Reflection = false}
AvoidFileOverwrite: boolean--
If FilePath is not set, add (1), (2), ... to the file name instead of overwriting an existing file. Default: true
AntiIdle: boolean--
Stop Roblox from kicking you for being idle (not moving) for 20 minutes. Default: true
CopyToClipboard: boolean--
Copy the result to the clipboard (the copy/paste buffer) instead of writing a file. Your executor must support setrbxclipboard. Use this only for small saves. Default: false
Callback: ((data: string,chunks: {string}) → ()) | false--
Call this function with the result instead of writing a file. It receives the full text and a list of chunks. If CopyToClipboard is also on, the clipboard is used instead. Default: false
IgnoreProperties: {string}--
A list of property names to skip on every object. For example: {"Tags", "AttributesSerialize"}. Default: {}
IgnoreNotArchivable: boolean--
Save objects even when their Archivable property is false. If this is off, the script skips those objects. Default: true
SaveNotCreatable: boolean--
Save classes that Roblox says are not creatable. The script replaces them with a class it can create, using NotCreatableFixes (usually Folder). This turns on automatically with IsolatePlayers, IsolateLocalPlayer, and NilInstances (when getnilinstances exists). Default: false
NotCreatableFixes: {string} | {[string]: string | false}--
Replace a class with a class that can be created. The default replacement is "Folder". A list of class names also becomes Folder. Built-in changes: Player, PlayerGui, PlayerScripts, TouchTransmitter, and others become Folder; CloudLocalizationTable becomes LocalizationTable; Platform becomes Part; Status becomes Model. Set a class to false to skip its replacement. Default: built-in replacements
NilInstancesFixes: {[string]: ((overrides: table) → Instance?) | false}--
Where to put objects that have no parent. For example, it puts Animator under an AnimationController. Built-in fixes exist for Animator, AdPortal, Attachment, BaseWrap, and PackageLink. Child classes use the parent fix (Bones use the Attachment fix). Set a class to false to turn off its fix. Default: built-in Animator/AdPortal/Attachment/BaseWrap/PackageLink fixes
IgnoreDefaultProperties: boolean--
Skip properties that already have the default value for their class. This only affects XML output. Binary output does not use this option. Default: true
IgnorePropertiesOfNotScriptsOnScriptsMode: boolean--
Only in scripts mode: save properties for LuaSourceContainers and skip properties for all other objects. This does nothing in other modes. Default: false
IgnoreDefaultPlayerScripts: boolean--
Skip Roblox's default player scripts (PlayerModule, BubbleChat, ChatScript, PlayerScriptsLoader, RbxCharacterSounds). This can stop some executors from crashing during decompile. Default: false
SaveCacheInterval: number--
How much XML data the script holds in memory while saving. Lower values update the status more often but are slower. This does not write to disk. When KillAllScripts is on, this also sets the script timeout between 20 and 30 seconds. Default: 0x1600 * 10
SharedBinaryStrings: boolean--
Store the same binary data (meshes, images, ...) only once in the file. This makes saves with repeated data smaller. Files with all unique data can get slightly bigger. This is not an official Roblox format, but Studio can still open the file. Default: false
TreatUnionsAsParts: boolean--
Change all PartOperations (unions and intersections) into Parts. RISKY: you lose the merged shape, but executors that cannot read unions will still show visible parts. Default: false
ShutdownWhenDone: boolean--
Close the game after a successful save. Default: false
__DEBUG_MODE: boolean | ((...any) → ())--
Print debug warnings for unusual cases. If you pass a function, the script uses it instead of warn. Default: false
}
Options for UniversalSynSaveInstance.synsaveinstance. All fields are optional.
The default is shown at the end of each field. Option names are not
case-sensitive: NilInstances, nilinstances, and nilInStaNces are the
same option. Unknown names are ignored.
OptionsAliases
interface OptionsAliases {AnonymousMode: string--
Anonymous
Blacklist: string--
IgnoreList
ClassIgnoreList: string--
IgnoreList
Clipboard: string--
CopyToClipboard
Compress: string--
CompressionMode
Compression: string--
CompressionMode
Debug: string--
__DEBUG_MODE
DecompileScripts: string--
Decompile
Decompiler: string--
Decompile
DecompilerTimeout: string--
DecompileTimeout
EmbedBytecode: string--
SaveBytecode
FileName: string--
FilePath
IgnoreArchivable: string--
IgnoreNotArchivable
IgnoreClasses: string--
IgnoreList
IgnoreDefaultProps: string--
IgnoreDefaultProperties
IgnoreInstances: string--
IgnoreList
IgnoreProperty: string--
IgnoreProperties
IgnoreRobloxPlayerScripts: string--
IgnoreDefaultPlayerScripts
InstanceIgnoreList: string--
IgnoreList
InstancesBlacklist: string--
IgnoreList
IsolatePlayerGui: string--
IsolateLocalPlayer
LocalPlayer: string--
IsolateLocalPlayer
Model: string--
Object
NoXML: string--
Binary
Path: string--
FilePath
Players: string--
IsolatePlayers
Progress: string--
ShowStatus
Root: string--
Object
SaveAsBinary: string--
Binary
SaveCharacters: string--
SavePlayerCharacters
SaveLocalPlayer: string--
IsolateLocalPlayer
SaveModel: string--
Object
SaveNil: string--
NilInstances
SaveNilInstances: string--
NilInstances
SaveNonCreatable: string--
SaveNotCreatable
SavePlayerGui: string--
IsolateLocalPlayer
SavePlayers: string--
IsolatePlayers
SavePlayersData: string--
IsolatePlayers
SaveScripts: string--
Decompile
SaveStarterPlayer: string--
IsolateStarterPlayer
ScriptDecompile: string--
Decompile
ShowProgress: string--
ShowStatus
Status: string--
ShowStatus
StatusText: string--
ShowStatus
UseDecompiler: string--
Decompile
Verbose: string--
__DEBUG_MODE
timeout: string--
DecompileTimeout
}
Map of old option names to new option names for the UniversalSynSaveInstance.SaveInstanceOptions table.
Format: { OldName = NewName }
The script reads these before your options, so you cannot change them after the script starts.
OptionsAliasesInverse
interface OptionsAliasesInverse {DisableCompression: string--
CompressionMode
NoDecompile: string--
Decompile
noscripts: string--
Decompile
NullifyScripts: string--
Decompile
Overwrite: string--
AvoidFileOverwrite
RemovePlayerCharacters: string--
SavePlayerCharacters
RemovePlayers: string--
IsolatePlayers
SkipScripts: string--
Decompile
XML: string--
Binary
}
Map of old option names that change a true/false value to the opposite.
Format: { OldName = NewName }
The script flips the value before it uses it. noscripts = true sets Decompile = false.
DisableCompression = true sets CompressionMode = false. Overwrite = true sets AvoidFileOverwrite = false.
The script reads these before your options, so you cannot change them after the script starts.
Functions
synsaveinstance
This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts. YieldsUniversalSynSaveInstance.synsaveinstance(...: table | SaveInstanceOptions | Instance | string--
UniversalSynSaveInstance.SaveInstanceOptions tables are combined in order. An executor's native SaveInstanceOptions object is read the same way as a table, but not every property may be supported, because the property set varies per executor. An Instance becomes Object. A string becomes FilePath; an empty string counts as not set. A list of Instances becomes ExtraInstances and sets IsModel = true. If you pass Instances directly and do not set mode, mode becomes invalid, so only those Instances are saved.
) → ()Save the current place, one Instance, or a group of Instances. Example:
local Params = {
RepoURL = "https://raw.githubusercontent.com/luau/UniversalSynSaveInstance/main/",
SSI = "saveinstance",
}
local synsaveinstance = loadstring(game:HttpGet(Params.RepoURL .. Params.SSI .. ".luau", true), Params.SSI)()
local SaveInstanceOptions = { SafeMode = true, DecompileTimeout = 15, SaveBytecode = true }
synsaveinstance(SaveInstanceOptions)
You can pass any number of arguments, in any order:
synsaveinstance({ mode = "scripts" }, "myScripts.rbxlx")
synsaveinstance(workspace.Model) -- Object; saved as a model
synsaveinstance({ workspace.Model, workspace.OtherModel }) -- ExtraInstances