Rotating a part using Vector3 instead of CFrame

Ok so, i basically want to rotate a part using position instead of cframe. Simple, right? I need to use Vector3 because im trying to make the said part rotate around its pivot, but using cframes just completely ignores the pivot i set.

I know how to rotate it using cframes, but is it possible with position?

You would use part.Orientation


part.Orientation =,90,0)

Or you could use CFrames and instead use the function :PivotTo()


part:PivotTo(part.CFrame * CFrame.Angles(0, math.rad(90), 0))

ahh, thats what i was looking for. (part.Orientation). I was being dumb and i was typing part.Position.Orientation. Anyways, im gonna check if it solves my problem.

1 Like

the rotating works, but it rotates on itself like using a cframe. This is basically what i want to achieve:

But this is how it turns out:

(the blue part is the one i want to rotate)

Is there anyway to keep the pivot whilst rotating it in a script? I can do it just fine in studio, but when using coding it just wont work.

So you want the part to spin while rotating around the other part?

no basically what i want is instead of rotating on itself, rotate around the Pivot that is the dark blue part’s position (im bad at english)

You could change the PivotOffset property

i already have the pivot set, but even then when i ask the script to make the part rotate it just wont follow the pivot

local pivotModel = script.Parent.Parent

local object = pivotModel.Object -- Blue Block
local pivot = pivotModel.Pivot -- Red Block

local rotation = 0

while wait() do
	object:PivotTo(pivot.CFrame * CFrame.Angles(0, math.rad(rotation), 0))

where do i put this script?

I just put it inside the part that is rotating (the part and the pivot are in a model). It might be different for you

for some reason i copied the script and it does that:

Capture d’écran 2024-04-28 190706

it teleports to the part, and it spins too

The light blue part is probably rotated on its side, and the PivotOffset is probably set to (0, 0, 0). I don’t know of anything else that could cause that problem

Oh, i forgot to reajust the pivot! My bad. Anyways, this works flawlessly and will work perfectly for what im looking for!

Big thanks! I was struggling to solve this for the whole day lol. Didnt know it was that simple.

It’s all good. Happy to help :+1:

Could you be more specific with blue?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.