Hello, I was having a issue with the datastores. I wanted to save my model primary part CFrame, but when I go to the game again, the CFrameVall is null. Any idea how to fix this issue?
game.Players.PlayerRemoving:Connect(function(Player)
print('Saving Data For Player '.. Player.Name)
-- Builds
local BuildsValue = {}
for i,v in pairs(game.Workspace.truc.PlacedObject:GetChildren()) do
local cframe = v:GetPrimaryPartCFrame()
print(cframe)
local New = {['Object'] = v.Name, ['CFrameVal'] = cframe, ['I'] = v.WhereVal.Value}
table.insert(BuildsValue,New)
end
local BuildEncode = HS:JSONEncode(BuildsValue)
PlrDS:SetAsync("Builds-"..Player.UserId,BuildEncode)
end)

1 comment
might be worth splitting up the compnents of the cframe and save them as float/number values. though that would bloat your script a little. Look at https://developer.roblox.com/en-us/api-reference/datatype/CFrame @ the bitCFrame:GetComponents ( ) function section