I’m trying to store a player’s furniture data, and I keep having this problem of the furniture’s position only loading 1 dimension out of the 3 its supposed to have. I looked more into this issue and found that the method i used to store the object’s cframe into the datastore was acting strange.
heres my issue:
when the player leaves the game, i run through every piece of furniture in the player’s house, and store its position relative to the player’s home (an object value stored in the player thats set to the home model whenever the player purchases a home/loads their data into an empty home) using this function:
if player.home.Value ~= nil then
local props = {}
for i,v in ipairs(player.home.Value.furniture:GetChildren()) do
if v:IsA("Model") then
local cf = player.home.Value:GetPivot():ToObjectSpace(v:GetPivot())
local furnituredata = {
itemtype = v:GetAttribute("itemtype"),
cframecomponents = cf:GetComponents()
}
-- this is where my issue is, it only returns 1 number
print(furnituredata.cframecomponents)
table.insert(props, furnituredata)
end
end
local propdatasave = httpserv:JSONEncode(props)
propstore:SetAsync(player.UserId, propdatasave)
end
when i get the cframe value, i run GetComponents() on the cframe so i can place it in a datastore thats json encoded with httpservice. this is where i noticed the issue, i ran a print statement on the cframe thats being stored, and it only returns 1 number of the 12 cframe values that a cframe typically has.