Hello, im trying to serialize a humanoid description in a table to save it into a datastore but for some reason when i try to apply the deserialized humanoid description into a rig i get this error:
Here is my code (Is a Module Script)
-- Module made to Serialize and UnSerialize objects into tables
-- @sixgera
local Serialization = {}
function Serialization.serializeHumanoidDescription(Description:HumanoidDescription)
local Result = {
Propierties = {
Shirt = Description.Shirt,
Pants = Description.Pants,
Face = Description.Head,
Torso = Description.Torso,
RightLeg = Description.RightLeg,
LeftLeg = Description.LeftLeg,
LeftArm = Description.LeftArm,
RightArm = Description.RightArm,
Head = Description.Head,
GraphicTShirt = Description.GraphicTShirt,
BodyTypeScale = Description.BodyTypeScale,
DepthScale = Description.DepthScale,
HeadScale = Description.HeadScale,
HeightScale = Description.HeightScale,
ProportionScale = Description.ProportionScale,
WidthScale = Description.WidthScale,
BackAccessory = Description.BackAccessory,
FaceAccessory = Description.FaceAccessory,
FrontAccessory = Description.FrontAccessory,
HairAccessory = Description.HairAccessory,
HatAccessory = Description.HatAccessory,
NeckAccessory = Description.NeckAccessory,
ShouldersAccessory = Description.ShouldersAccessory,
WaistAccessory = Description.WaistAccessory,
-- ANIMATIONS --
ClimbAnimation = Description.ClimbAnimation,
FallAnimation = Description.FallAnimation,
IdleAnimation = Description.IdleAnimation,
JumpAnimation = Description.JumpAnimation,
MoodAnimation = Description.MoodAnimation,
RunAnimation = Description.RunAnimation,
SwimAnimation = Description.SwimAnimation,
WalkAnimation = Description.WalkAnimation,
},
Colors = {
HeadColor = {Description.HeadColor.R,Description.HeadColor.G,Description.HeadColor.B},
LeftArmColor = {Description.LeftArmColor.R,Description.LeftArmColor.G,Description.LeftArmColor.B},
RightArmColor = {Description.RightArmColor.R,Description.RightArmColor.G,Description.RightArmColor.B},
LeftLegColor = {Description.LeftLegColor.R,Description.LeftLegColor.G,Description.LeftLegColor.B},
RightLegColor = {Description.RightLegColor.R,Description.RightLegColor.G,Description.RightLegColor.B},
TorsoColor = {Description.TorsoColor.R,Description.TorsoColor.G,Description.TorsoColor.B},
}
}
return Result
end
function Serialization.deSerializeHumanoidDescription(Serialized)
local HumanoidDescription = Instance.new("HumanoidDescription")
-- First Propierties --
for i,v in pairs(Serialized.Propierties) do
if v ~= 0 then
HumanoidDescription[i] = v
end
end
-- Then Colors --
for p,c in pairs(Serialized.Colors) do
HumanoidDescription[p] = Color3.fromRGB(c[1],c[2],c[3])
end
return HumanoidDescription
end
return Serialization