Hello, I have ran into an issue with my game’s character saving system. Almost every single character or accessory in my game is made up of very complex unions, and I have just found out you cannot use datastoreservice to store instances.
Example:
I am aware there is a bypass to this using serialization, however I am stuck due to the severe complexity of the unions within my game.
I have researched serialization and have come across the method of separating the union and then serializing each part, but the thing is each union is made up of other complex unions.
So far I have come up with something along the lines of this (but I am still very confused):
local function SerializeModel(Model)
for i = 1, #Model:GetChildren() do
local Part = Model:GetChildren()[i]
if Part:IsA("Part") or Part:IsA("MeshPart") then
-- serialize
elseif Part:IsA("Union") then
-- separate union
-- serialize non union parts
-- group union/negativeparts (group 1)
-- separate group 1
-- serealize parts
-- group union/negativeparts (group 2)
-- repeat until no unions -- (group 3,4, etc.)
-- upon loading, reunion each serialized part in reverse group order (group 3 unioned, then group 2 is unioned, etc.)
end
end
end
Apologies if this isn’t properly formatted or is asking for too much, this is my first forum post.