Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to rotate a CFrame object on a pivot point?

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 comment

1 answer

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.