I tried this and its dragging it away instead of rotating it :\

local pivot = CFrame.new()
local part = script.Parent.Door.PrimaryPart
local offset = part.CFrame:toObjectSpace(pivot):inverse() 
local initialRotation = part.CFrame - part.CFrame.p

wait(1)

local firstTick = tick()
local elapsed = 0
local speed = 16
local desiredAngle = 30
local duration = desiredAngle/speed


while elapsed <= duration do
	wait()
    local alpha = math.min(1, elapsed/duration)
    local angle = desiredAngle*alpha
    part.CFrame =CFrame.new(pivot*initialRotation*Vector3.new(angle))*offset
    elapsed = tick() - firstTick
end

2 comments

0

Not working