local function DecodePart(PartTable)
if PartTable[#PartTable] == "BasePart" then
local iInstance = Instance.new("Part")
iInstance.CastShadow = PartTable["CastShadow"]
iInstance.Color = PartTable["Color"]
iInstance.Material = PartTable["Material"]
iInstance.Reflectance = PartTable["Reflectance"]
iInstance.Transparency = PartTable["Transparency"]
iInstance.Size = PartTable["Size"]
iInstance.CFrame = PartTable["CFrame"]
iInstance.Shape = PartTable["Shape"]
return iInstance
elseif PartTable[#PartTable] == "UnionOperation" then
local iInstance = Instance.new("UnionOperation")
iInstance.CastShadow = PartTable["CastShadow"]
iInstance.Color = PartTable["Color"]
iInstance.Material = PartTable["Material"]
iInstance.Reflectance = PartTable["Reflectance"]
iInstance.Transparency = PartTable["Transparency"]
iInstance.SmoothingAngle = PartTable["SmoothingAngle"]
iInstance.UsePartColor = PartTable["UsePartColor"]
iInstance.Size = PartTable["Size"]
iInstance.CFrame = PartTable["CFrame"]
return iInstance
elseif PartTable[#PartTable] == "MeshPart" then
local iInstance = Instance.new("MeshPart")
iInstance.CastShadow = PartTable["CastShadow"]
iInstance.Color = PartTable["Color"]
iInstance.DoubleSided = PartTable["DoubleSided"]
iInstance.Material = PartTable["Material"]
iInstance.MeshId = PartTable["MeshId"]
iInstance.Reflectance = PartTable["Reflectance"]
iInstance.TextureID = PartTable["TextureID"]
iInstance.Transparency = PartTable["Transparency"]
iInstance.Size = PartTable["Size"]
iInstance.CFrame = PartTable["CFrame"]
return iInstance
elseif PartTable[#PartTable] == "Decal" then
local iInstance = Instance.new("Decal")
iInstance.Color3 = PartTable["Color3"]
iInstance.Texture = PartTable["Texture"]
iInstance.Transparency = PartTable["Transparency"]
iInstance.ZIndex = PartTable["ZIndex"]
iInstance.Face = PartTable["Face"]
return iInstance
elseif PartTable[#PartTable] == "Texture" then
local iInstance = Instance.new("Texture")
iInstance.Color3 = PartTable["Color3"]
iInstance.OffsetStudsU = PartTable["OffsetStudsU"]
iInstance.OffsetStudsV = PartTable["OffsetStudsV"]
iInstance.StudsPerTileU = PartTable["StudsPerTileU"]
iInstance.StudsPerTileV = PartTable["StudsPerTileV"]
iInstance.Texture = PartTable["Texture"]
iInstance.Transparency = PartTable["Transparency"]
iInstance.ZIndex = PartTable["ZIndex"]
iInstance.Face = PartTable["Face"]
return iInstance
else
return "What ?"
end
end
this function decodes a table and turns it into a part, although it tried to return nil (i added a back, that is the “What?”)
This is what an input table looks like for it:
But it cant recognize the type?