I have no idea where to start for this except for a basic rotation script, but I don't know how to make it rotate on an edge so it does not rotate from center. (i.e. swinging open doors.)

This is all I have:

local b = script.Parent
local rot = 0
local db = true

b.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and db then
		db = false
		for i = 0, 45 do
			wait()
			rot = rot + .04
			b.CFrame = CFrame.new(b.CFrame.X, b.CFrame.Y, b.CFrame.Z) * CFrame.Angles(0, rot, 0)
		end
		wait(2)
		db = true
	end
end)

4 comments

0

I guess if you really wanted, you could do a lot of math to change the CFrame position of the door to make it appear to rotate on the edge, but that's a crazy amount of work.

0

well is there a simpler way?

0

You can use hinges, but that doesn't require scripting.

0

hinges arent very reliable