SynSaveInstance
Represents the options for saving instances with custom settings using the synsaveinstance function.
Types
CustomOptions table
interface CustomOptions table {__DEBUG_MODE: boolean--
This will print debug logs to console about unusual scenarios. Recommended to enable if you wish to help us improve our products and find bugs / issues with it! Default: false
ReadMe: boolean--
Default: true
SafeMode: boolean--
Kicks you before Saving, which keeps you safe. HIGHLY RECOMMENDED TO KEEP ENABLED. Default: true
KillAllScripts: boolean--
Kills all scripts to further protect you. SafeMode also enables this by default. HIGHLY RECOMMENDED TO KEEP ENABLED. Default: true
ShutdownWhenDone: boolean--
Shuts the game down after saveinstance is finished. Default: false
AntiIdle: boolean--
Prevents the 20-minute-Idle Kick. Default: true
Anonymous: {boolean | table{UserId=string,Name=string}}--
- RISKY: Cleans the file of any info related to your account like: Name, UserId. This is useful for some games that might store that info in GUIs or other Instances. Might potentially mess up parts of strings that contain characters that match your Name or parts of numbers that match your UserId. Can also be a table with UserId & Name keys. Default: false
ShowStatus: boolean--
Default: true
Callback: function--
If set, the serialized data will be sent to the callback function instead of to file. Default: false
mode: string--
Valid modes: full, optimized, scripts. Change this to invalid mode like "invalid" if you only want ExtraInstances. "optimized" mode is NOT supported with @Object option. Default: "optimized"
Decompile: boolean--
Script decompiling. Default: true
scriptcache: boolean--
Use decompiled script cache to avoid decompiling duplicate scripts. Default: true
DecompileTimeout: number--
If the decompilation run time exceeds this value it gets cancelled. Set to -1 to disable timeout (unreliable). Default: 10
DecompileJobless: boolean--
Includes already decompiled code in the output. No new scripts are decompiled. Default: false
SaveBytecode: boolean--
Includes bytecode in the output. Useful if you wish to be able to decompile it yourself later. Default: false
DecompileIgnore: {Instance | Instance.ClassName | [Instance.ClassName]={Instance.Name}}--
- Ignores match & it's descendants by default. To Ignore only the instance itself set the value to
= false. Examples: "Chat", - Matches any instance with "Chat" ClassName, Players = {"MyPlayerName"} - Matches "Players" Class AND "MyPlayerName" Name ONLY,workspace- matches Instance by reference,[workspace] = false- matches Instance by reference and only ignores the instance itself and not it's descendants. Default: {TextChatService}
IgnoreList: {Instance | Instance.ClassName | [Instance.ClassName]={Instance.Name}}--
Structure is similar to @DecompileIgnore except = false meaning if you ignore one instance it will automatically ignore it's descendants. Default: {CoreGui, CorePackages}
ExtraInstances: {Instance}--
If used with any invalid mode (like "invalidmode") it will only save these instances. Default: {}
IgnoreProperties: table--
Ignores properties by Name. Default: {}
SaveCacheInterval: number--
The less the value the more often it saves, but that would mean less performance due to constantly saving. Default: 0x1600 * 10
FilePath: string--
Must only contain the name (can include path) of the file, no file extension. Default: false
AvoidFileOverwrite: boolean--
Prevents writing to place file that already exists. Default: true
Object: Instance--
- If provided, saves as .rbxmx (Model file) instead. If Object is game, it will be saved as a .rbxl file. MUST BE AN INSTANCE REFERENCE, FOR EXAMPLE - game.Workspace.
"optimized"mode is NOT supported with this option. If IsModel is set to false then Object specified here will be saved as a place file. Default: false
IsModel: boolean--
If Object is specified then sets to true automatically, unless you set it to false. Default: false
NilInstances: boolean--
Save instances that aren't Parented (Parented to nil). Default: false
NilInstancesFixes: {[Instance.ClassName]=function}--
- This can cause some Classes to be fixed even though they might not need the fix (better be safe than sorry though). For example, Bones inherit from Attachment if we dont define them in the NilInstancesFixes then this will catch them anyways. TO AVOID THIS BEHAVIOR USE THIS EXAMPLE: {ClassName_That_Doesnt_Need_Fix = false}. Default: {Animator = function, AdPortal = function, BaseWrap = function, Attachment = function}
IgnoreDefaultProperties: boolean--
Ignores default properties during saving. Default: true
IgnoreNotArchivable: boolean--
Ignores the Archivable property and saves Non-Archivable instances. Default: true
IgnorePropertiesOfNotScriptsOnScriptsMode: boolean--
Ignores property of every instance that is not a script in "scripts" mode. Default: false
IgnoreSpecialProperties: boolean--
Prevents calls to gethiddenproperty and uses fallback methods instead. This also helps with crashes. If your file is corrupted after saving, you can try turning this on. Default: false
IsolateStarterPlayer: boolean--
Saves StarterPlayer as separate folder, children of the original instance will be ignored. Default: false
IsolatePlayers: boolean--
Saves All Players as separate folder, children of the original instance will be ignored. Default: false
IsolateLocalPlayer: boolean--
Saves LocalPlayer as separate folder, original instance will be ignored. Default: false
IsolateLocalPlayerCharacter: boolean--
Saves LocalPlayer.Character as separate folder, original instance will be ignored. Default: false
SavePlayerCharacters: boolean--
Ignore player characters while saving. Default: false
SaveNotCreatable: boolean--
- Includes non-serializable instances as Folder objects (Name is misleading as this is mostly a fix for certain NilInstances and isn't always related to NotCreatable). This option is automatically enabled by options like: IsolatePlayers, IsolateLocalPlayer, etc. Default: false
NotCreatableFixes: table<Instance.ClassName>--
- {"Player"} is the same as {Player = "Folder"}; Format like {SpawnLocation = "Part"} is only to be used when SpawnLocation inherits from "Part" AND "Part" is Creatable. Default: { "", "Player", "PlayerScripts", "PlayerGui", "TouchTransmitter" }
AlternativeWritefile: boolean--
- Splits file content string into segments and writes them using appendfile. This might help with crashes when it starts writing to file. Though there is a risk of appendfile working incorrectly on some executors. Default: true
IgnoreDefaultPlayerScripts: boolean--
- **RISKY: Ignores Default PlayerScripts like PlayerModule & RbxCharacterSounds. Prevents crashes on certain Executors. Default: true
IgnoreSharedStrings: boolean--
- RISKY: FIXES CRASHES (TEMPORARY, TESTED ON ROEXEC ONLY). FEEL FREE TO DISABLE THIS TO SEE IF IT WORKS FOR YOU. Default: true
SharedStringOverwrite: boolean--
- RISKY: if the process is not finished aka crashed then none of the affected values will be available. SharedStrings can also be used for ValueTypes that aren't
SharedString, this behavior is not documented anywhere but makes sense (Could create issues though, due to potential ValueType mix-up, only works on certain types which are all base64 encoded so far). Reason: Allows for potential smaller file size (can also be bigger in some cases). Default: false
TreatUnionsAsParts: boolean--
- RISKY: Converts all UnionOperations to Parts. Useful if your Executor isn't able to save (read) Unions, because otherwise they will be invisible. Default: false (except Solara)
}- Structure of the main CustomOptions table.
- Note: Options are case-insensitive, meaning you can type
NilInstancesoption asnilInStaNcesand it still will be valid.
OptionsAliases
interface OptionsAliases {timeout: string--
DecompileTimeout
FileName: string--
FilePath
IgnoreArchivable: string--
IgnoreNotArchivable
IgnoreDefaultProps: string--
IgnoreDefaultProperties
InstancesBlacklist: string--
IgnoreList
SaveLocalPlayer: string--
IsolateLocalPlayer
IsolatePlayerGui: string--
IsolateLocalPlayer
SavePlayerGui: string--
IsolateLocalPlayer
SavePlayers: string--
IsolatePlayers
SaveNonCreatable: string--
SaveNotCreatable
SaveCharacters: string--
SavePlayerCharacters
}Alias → Canonical option mapping for the SynSaveInstance.CustomOptions table. Format: { Alias = CanonicalOption } These are resolved before user options are processed and cannot be modified at runtime.
OptionsAliasesInverse
interface OptionsAliasesInverse {noscripts: string--
Decompile
RemovePlayers: string--
IsolatePlayers
RemovePlayerCharacters: string--
SavePlayerCharacters
}Alias → Canonical option mapping with boolean inversion. Format: { Alias = CanonicalOption } These aliases invert the provided boolean value before applying it. Example: noscripts = true → Decompile = false
Functions
saveinstance
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. YieldsSynSaveInstance.saveinstance(Parameter_1: variant<table,table<Instance>>,--
Can either be SynSaveInstance.CustomOptions table or a filled with instances ({Instance}), (then it will be treated as ExtraInstances with an invalid mode and IsModel will be true).
Parameter_2: table--
[OPTIONAL] If present, then Parameter_2 will be assumed to be SynSaveInstance.CustomOptions table. And then if the Parameter_1 is an Instance, then it will be assumed to be SynSaveInstance.CustomOptions table.Object. If Parameter_1 is a table filled with instances ({Instance}), then it will be assumed to be SynSaveInstance.CustomOptions table.ExtraInstances and IsModel will be true). This exists for sake compatibility with saveinstance(game, {})
) → ()Saves instances with specified options. 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 CustomOptions = { SafeMode = true, DecompileTimeout = 15, SaveBytecode = true }
synsaveinstance(CustomOptions)