How would I rotate and move a part with CFrame?

Quick question, I’m very new with CFrames and looking on how to rotate and move a CFrame without it resetting each other

2 Likes

Is an example like this what you require?

``````local part = script.Parent

part.CFrame = part.CFrame * CFrame.new(0,10,0) * CFrame.Angles(math.rad(45),0,0)
``````

This would move the Part 10 studs up and rotate it by 45 degrees in the X axis I believe

9 Likes

You can read these articles by roblox:

1 Like

A CFrame holds a position(Vector3) and a rotation value. Both can be changed and set to move parts.

CFrame has alot of built in functions and stuff to help make things that can be a little complicated.

A good thing to know is that CFrames use radians for angles instead of degrees. Degrees can be easily turned into radians via the `math.rad(angle in degrees)` function.

1 Like

Yep that’s perfect, thank you very much you’re a life safer, I think now is a good time for me to get better at CFrames

1 Like

I wish you good luck in your CFrame knowledge, remember that `CFrame.Angles` expects radians so make sure to put the number you want to rotate the part by inside of `math.rad()`!! If you have anymore issues don’t be afraid to make another post!

4 Likes

math.rad is an unusual thing to remember. I keep confusing it with math.random. Once I have it booted in my head I think I’ll get it, but ha! What a thing.