Hey, I’ve been working on a project with a placement system. All the data saves perfectly, and the entire system is basically done. But the thing Is I have no idea how to convert a CFrame into a table.
BEFORE you reply to this post to a link to: DataStore and CFrame storing I’ve already looked over this and read it, even using the functions given and they didn’t work.
If anyone has any ideas, please give them. Thanks!
a CFrame is basically position and rotation, you can split it into position and rotation, then split each of these into 6 numbers. Organize these numbers however you like and save them.
Glad to hear it! Just FYI, some functions return multiple values and this is one of them. If you wanted to get all of the data without {}, it looks like this.
local x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22 = yourCFrame:components()
So in your case, the single number was the X position since you only set one variable.
Although this has already been answered, if you want to improve the efficiency of saved CFrame’s (namely reducing the 12 floating point numbers into just 7), you can convert the CFrame’s into Quaternions.
Just an added thing I thought you might consider to improve your serialization.