I am trying to make a saving furniture placement system and everything works flawlessly except for saving the data. For some reason I keep getting this error:
CFrame is not UTF8, you must stringify it and then convert it back to a CFrame object when you need to use it, this is called serialization/deserialization.
You can’t directly write a CFrame (or other userdata type) to a Datastore, nor can you write a table directly that’s not a pure array.
You can get around storing a dictionary by using HttpService:JSONEncode() and JSONDecode() to encode the table as a blob of JSON (which is just a string). This alone is not enough to store a CFrame though, any CFrame objects in the table will just store as the string “null”. You can convert the CFrame to an array of Lua-native Numbers though and store that:
Instead of {[item.Name] = cf}
you can so something like: {[item.Name] = table.pack(cf:GetComponents())}
You can devise your own way to serialize and deserialize a CFrame to Numbers as well, if you want to optimize it (e.g. by storing only non-default entries or storing as quaternion components, etc.) The important thing is that what you’re storing is implicitly convertable to and from a string. Scientfic notation numbers should not be a problem, tonumber() can handle these just fine.