Make part rotate around the origin point

So i have a part the needs to rotate counter clockwise. however, it is also slanted at a 45 degree angles, so when i try to use this script to rotate it:

while task.wait(.01) do
	script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(1),0)
end

it rotates around the center of the point instead of the place that you rotate when you use the rotate tool in studio.
I dont want to use hinges or constraints because i dont want to deal with physics. any ideas? (also please dont hesitate to tell me if i made this confusing.)

Convert this for your use case.

while true do
    local partPivot = part:GetPivot()
    part:PivotTo(partPivot * CFrame.angles(0, math.rad(1), 0)
end
2 Likes

Thanks! it didnt work at first but i figured out that was because i had to change CFrame.angles to CFrame.fromeuleranglesXYZ

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