InstanceStore
by LumberUniverseHave you ever wanted to save instances to a datastore before? If you have then this module is the solution to that problem. At the moment almost everything except Unions should be supported (for MeshParts they have to be preexisting in the game for it to work). I had wanted to add support for Unions but Roblox doesn’t currently have a way to separate Unions on runtime.
Where to find it?
How does it work?
The module starts by grabbing the possible properties for the instance from MaximumADHD's (CloneTrooper1019) API dump. It then compares them to the default values and then saves the non-default ones.Why?
This module can be used in games that can take advantage of saving instances like building games, roleplaying games, etc. (You might want to do some slight modifications like adding more properties to DontSave to decrease storage taken up)How to use?
--[[
This function converts the object to a table of properties
]]
Converter:ConvertToSaveable(Object : Instance, Parent : Instance, IncludeDescendants : Boolean)
-- e.g.
DataStore:SetAsync('Part', Converter:ConvertToSaveable(workspace.Baseplate, false))
--[[
This function converts the table back into a object
]]
Converter:ConvertToInstance(Data : Table)
-- e.g.
Converter:ConvertToInstance(DataStore:GetAsync('Part')).Parent = workspace
Limits?
- You can only store 4MiBs of data in a Roblox datastore (I’ve tried to reduce the storage amount that the module takes up as much as I can. You can combat this with a different data saving method)
- The conversion can be a bit resource-intensive (haven’t had the chance to improve performance)
- You can’t save Unions or save MeshParts that aren’t anywhere else e.i. aren’t in ReplicatedStorage or ServerStorage
Credits to MaximumADHD for the API dump
If you have any suggestions or recommendations feel free to reply to this thread and I’ll read it as soon as I can. Have a nice day
Icons provided by icons8