CFrame.Angles
I believe the function you're looking for is CFrame.Angles. Using this function will add (or set) the rotation of a given CFrame matrices.
"How does this work?"
Well, CFrame.Angles works in radians. Radians are convenient units of degrees that are "equal to an angle at the center of a circle whose arc is equal in length to the radius". Basically meaning we're working with degrees (which is obvious, since we're dealing with rotation).
PIE!
A great standpoint for measuring the rotation of an angle, would be one of the most famous numbers of all time, pi. In case you didn't know, pi is actually measured in radians. And because we know pi is half a circle (or half a rotation), we can easily manipulate this number to get accurate rotations. For example:
print(math.pi*2)
print(math.pi/2)
print(math.pi/4)
We can do the exact same thing when dealing with CFrame.Angles. For example, if we wanted to set the rotation of a part to 180 degrees on it's Y axis, we could simply say:
part.CFrame = part.CFrame * CFrame.Angles(0,math.pi,0)
And that's about it. If you have any other questions about how this works, I highly suggest checking out this wiki article on CFrame: http://wiki.roblox.com/index.php?title=CFrame#Constructors
Questions
If you're still confused, just let me know and I'll get back to you as soon as possible. Hope it helped.
EDIT
After clearing this up in the chat, I decided to give a better example of how to create a "compiler" for the project you're working on. Here's a CFrame encoder / decoder I whipped up that may be of some use to you: https://www.roblox.com/CFrame-encoder-decoder-module-item?id=402771285
I was in a bit of a rush, so if you have any questions on how it works, let me know.
4 comments
Also you can convert degrees to radians by using the math.deg() function
but how come this wont work: "APart.CFrame=CFrame.new(Part.CFrame.X,Part.CFrame.Y,Part.CFrame.Z)*(CFrame.Angles(Part.Rotation.X,Part.Rotation.Y,Part.Rotation.Z))"
Updated my answer with a module you might find handy.
Thanks, but my the Compiler Im making is't ment to save anything using datastore. It just converts Models to code.