I’m trying to make a system that can save information about parts and then load them in later. It works by looping through everything in a folder and then saving it to a table. I tried to test it out, using this part here:
[{"Anchored":true,"Reflectance":0,"CanCollide":true,"Material":null,"Color":null,"Transparency":0,"Position":null,"Orientation":null,"Class":"Part","Size":null}]
Certain properties like size, orientation, color and a few more come out as null, and I don’t know why. I’ve tried using tostring()
on some of the properties but it still won’t work. Here is the modulescript responsible for saving and loading things:
local http = game:GetService("HttpService")
function module.Save()
local t = {}
for _,v in pairs(game.Workspace.Game:GetChildren()) do
if v:IsA("BasePart") or v:IsA("Part") then
local part = {
Color = tostring(v.Color),
Material = tostring(v.Material),
Anchored = v.Anchored,
Transparency = v.Transparency,
Reflectance = v.Reflectance,
Size = v.Size,
Position = v.Position,
CanCollide = v.CanCollide,
Orientation = v.Orientation,
Class = v.ClassName,
}
table.insert(t,part)
end
end
return http:JSONEncode(t)
end
Any help is appreciated!