# Rotate around Origin

I have several parts that I would like to rotate 90 digrees around a origin part the same way you do with a model. One issue is that I cant use models and instead I have to use a folder for what im doing. So I wanted to know how I could do this. Thanks!

``````for i, v in pairs(folder:GetDescendants) do
if v:IsA("BasePart") then
-- Rotate 90 degrees around origin
end
end
``````

uh huh. so this doesnt help lol XD

I assumed you already knew how to rotate parts around an origin part, since you said, “one issue is that I cant use models and instead I have to use a folder for what im doing.” So I take it you also want an explanation as to how to rotate a part 90 degrees around another part (origin part). Do you mean on the X, Y or Z axis?

its a simple model I want to turn 90 digrees sideways, its around 4 squares.

I have found a solution using math.rad

``````local origin = -- Assign to your origin part
local part = -- Assign to your part to be rotated around origin

local Point = origin.CFrame
local Offset = CFrame.new(0, 0, (origin.Position - part.Position).Magnitude)

for i = 1, 180 do
part.CFrame = Point * CFrame.Angles(0,math.rad(i),0) * Offset
wait()
end
``````

Expanded on this: https://scriptinghelpers.org/questions/25441/rotating-around-a-point