Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to rotate a CFrame object on a pivot point?

Asked by 6 years ago

I've come up with a script, but unfortunately, it rotates the entire door, I want it to rotate on a pivot point, so it emulates a door actually opening. I don't know which steps to take from here, any help?

local door = script.Parent
local main = door.Main
local button = script.Parent.MainDoor

local open = false
button.ClickDetector.MouseClick:Connect(function()
    if not open then
        for i = 0, 10, .3 do
        print(i)
        door:SetPrimaryPartCFrame(door:GetPrimaryPartCFrame() 
        * CFrame.Angles(0, math.rad(math.pi*0.9), 0))
        wait()
        end
    end

1 answer

Log in to vote
0
Answered by 6 years ago

Place a Part in the model and use it as a axis by making that your primary part. If the part is on the side of the door, it will rotate the door on the side instead of the center.

Ad

Answer this question