The past few days, I have been experimenting with saving block data using tables. However as a result of not being able to save it in data stores, I have to explore different conversion methods. I tried various modules meant for converting cframes, and they work but the values are inaccurate rendering it useless. (same issue is present on clone troopers script, unsure as to why) Attached is my code, any help is appreciated.
local data = {}
local cframeser = require(workspace.CFrameSerializer)
local repr = require(workspace.repr)
local jsonmod = require(workspace:WaitForChild("JSONWithUserdata"))
for _,Part in pairs(workspace.Folder:GetChildren()) do
calculation = (Part.Position - workspace.PlacementGrid.Position)
local cframething = CFrame.new(calculation)
print(cframething)
cframethingconverted = cframeser:EncodeCFrame(cframething)
print(cframethingconverted)
table.insert(data,cframethingconverted)
end
wait(2)
game.ReplicatedStorage.RemoteEvent:FireServer(data)``` (CLIENT SCRIPT)
(SERVER SCRIPT)
```lua
local ds = game:GetService('DataStoreService')
local Pdata = ds:GetDataStore("BlockData")
local Players = game:GetService("Players")
local cframeser = require(workspace.CFrameSerializer)
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(user, data)
print(data)
Pdata:SetAsync(user.UserId,data)
end)
wait(10)
data1 = Pdata:GetAsync(Players.BurgerBurner.UserId)
print(data1)
for _,v in pairs(data1)do
print(v)
cframethingconverted = cframeser:DecodeCFrame(v)
partlocate = Instance.new("Part")
partlocate.Parent = workspace
partlocate.CFrame = (cframethingconverted) + Vector3.new(workspace.PlacementGrid.Position)
partlocate.Anchored = true
partlocate.Size = Vector3.new(1,1,1)
I understand there is some inefficiencies with the code, I am going to improve that once I figure out this issue. That is only the output on client, however as you can see, the values before and after conversion are different. This happened on both defaultios and clonetroopers module. Any ideas? https://www.roblox.com/library/2933210752/CFrame-Serializer https://www.roblox.com/library/1005802894/JSON-with-Userdata-Support