Trying to make a part to rotate on its top edge with this current script:

local Point = CFrame.new(-47.561, 6.167, 4.98) -- The part's position/ where i want it to rotate at
local Offset = CFrame.new(0,0,0) -- how much it moves from it's position
local Object = game.Workspace.Door -- where the part is at

 
while true do
	for i = 1,45 do -- Makes the part rotate out by 45 degrees
		Object.CFrame = Point * CFrame.Angles(0, 0, math.rad(i)) * Offset
		wait()
	end
	wait()
	for i = 45,1, -1 do -- Makes the part rotate in to original position
		Object.CFrame = Point * CFrame.Angles(0,0,math.rad(i)) * Offset
		wait()
	end
end

However, this script on makes the part rotate on it's center not the top. I tried using a hinge, but it didnt work. And help / tips would be great! Thanks!

2 comments

0

Try changing the offset from (0, 0, 0) to the offset of the edge of the part from the center of it. You have the right idea here.

0

Thanks for the tips, made my way around it and it works! Mind making this an answer so i could accept this. Thanks again!