I've currently got this:
function save(player)
local base = player.Team.Base.Value
for i,v in pairs(base.Placed:GetChildren()) do
table.insert(playerdata, (v.Name))
playerdata.v = {};
table.insert(playerdata.v, "pX")
table.insert(playerdata.v, "pY")
table.insert(playerdata.v, "pZ")
playerdata.v.pX = (v.Position.X - base.Base.Position.X)
playerdata.v.pY = (v.Position.Y - base.Base.Position.Y)
playerdata.v.pZ = (v.Position.Z - base.Base.Position.Z)
table.insert(playerdata.v, "shape")
playerdata.v.shape = v.Shape.Value
table.insert(playerdata.v, "sX")
table.insert(playerdata.v, "sY")
table.insert(playerdata.v, "sZ")
playerdata.v.sX = (v.Size.X)
playerdata.v.sY = (v.Size.Y)
playerdata.v.sZ = (v.Size.Z)
table.insert(playerdata.v, "rot")
playerdata.v.rot = math.abs(v.Orientation.Y/90)
end
local encode = HttpService:JSONEncode(playerdata)
print(encode)
ds:SetAsync(player.UserId, encode)
print(player.Name .. "'s data has been saved!")
end
Basically when I print off the encode table at the end of the for loop, here's what I get, ["Brick","Brick"] while I expected to get something like this: '{"Brick":{"shape":"Block","pZ":2,"pX":20,"pY":4,"sX":5,"sY":2,"sZ":1,"rot":3},"Brick":{"shape":"Ball","pZ":5,"pX":12,"pY":0,"sX":3,"sY":10,"sZ":4,"rot":0}}' I've been messing with this for awhile but can't seem to figure it out, read about metatables but I'm not to sure how to utilize them, and if they would work in this case.
