sp=script.Parent framerate=30 frames=1 running=false direction=1 function waitForChild(u,r)while not u:FindFirstChild(r)do u.ChildAdded:wait()end end waitForChild(sp,"\066\111\116\116\111\109")waitForChild(sp.Bottom,"\079\112\101\110\068\111\111\114")waitForChild(sp.Bottom,"\067\111\110\102\105\103\117\114\097\116\105\111\110")function checkframes()if sp:FindFirstChild("\066\111\116\116\111\109")then local u=sp.Bottom:FindFirstChild("\067\111\110\102\105\103\117\114\097\116\105\111\110")if u then frames=math.floor(u.TimeToMove.Value*framerate)+1 end end end sp.Bottom.Configuration.TimeToMove.Changed:connect(checkframes)checkframes()function updatedoor(u)local r=u/frames if sp:FindFirstChild("\066\111\116\116\111\109")then local u=1.9 local m=sp.Bottom:FindFirstChild("\068\111\111\114\049")if m~=nil then m.C1=(CFrame.new(-u,-u,0)*CFrame.Angles(0,0,(math.pi/2)*r))*CFrame.new(u,u,0)end local S=sp.Bottom:FindFirstChild("\068\111\111\114\050")if S~=nil then S.C1=(CFrame.new(-u,u,0)*CFrame.Angles(0,0,(math.pi/2)*r))*CFrame.new(u,-u,0)end local H=sp.Bottom:FindFirstChild("\068\111\111\114\051")if H~=nil then H.C1=(CFrame.new(u,u,0)*CFrame.Angles(0,0,(math.pi/2)*r))*CFrame.new(-u,-u,0)end local P=sp.Bottom:FindFirstChild("\068\111\111\114\052")if P~=nil then P.C1=(CFrame.new(u,-u,0)*CFrame.Angles(0,0,(math.pi/2)*r))*CFrame.new(-u,u,0)end end end function runloop()if not running then running=true while true do if sp:FindFirstChild("\066\111\116\116\111\109")then local u=sp.Bottom:FindFirstChild("\070\114\097\109\101")if u then u.Value=u.Value+direction if u.Value>frames then u.Value=frames end if u.Value<=0 then u.Value=0 end updatedoor(u.Value)wait(1/framerate)if u then if u.Value<=0 and direction==-1 or u.Value>=frames and direction==1 then break end end else break end else break end end running=false end end function check(u)if u>.5 then direction=1 else direction=-1 end runloop()end sp.Bottom.OpenDoor.SourceValueChanged:connect(check)check(sp.Bottom.OpenDoor:GetCurrentValue())
--Stickmasterluke

sp = script.Parent
framerate = 30

frames = 1
running = false
direction = 1

function waitForChild(instance, name)
	while not instance:FindFirstChild(name) do
		instance.ChildAdded:wait()
	end
end

waitForChild(sp, "Bottom")
waitForChild(sp.Bottom, "OpenDoor")
waitForChild(sp.Bottom, "Configuration")

function checkframes()
	if sp:FindFirstChild("Bottom") then
		local config = sp.Bottom:FindFirstChild("Configuration")
		if config then
			frames = math.floor(config.TimeToMove.Value * framerate) + 1
		end
	end
end
sp.Bottom.Configuration.TimeToMove.Changed:connect(checkframes)
checkframes()

function updatedoor(frame)
	local percentage = frame / frames
	if sp:FindFirstChild("Bottom") then
		local hingedist = 1.9
		local hinge1 = sp.Bottom:FindFirstChild("Door1")
		if hinge1 ~= nil then
			hinge1.C1 = CFrame.new(-hingedist, -hingedist, 0)
				* CFrame.Angles(0, 0, (math.pi / 2) * percentage)
				* CFrame.new(hingedist, hingedist, 0)
		end
		local hinge1 = sp.Bottom:FindFirstChild("Door2")
		if hinge1 ~= nil then
			hinge1.C1 = CFrame.new(-hingedist, hingedist, 0)
				* CFrame.Angles(0, 0, (math.pi / 2) * percentage)
				* CFrame.new(hingedist, -hingedist, 0)
		end
		local hinge1 = sp.Bottom:FindFirstChild("Door3")
		if hinge1 ~= nil then
			hinge1.C1 = CFrame.new(hingedist, hingedist, 0)
				* CFrame.Angles(0, 0, (math.pi / 2) * percentage)
				* CFrame.new(-hingedist, -hingedist, 0)
		end
		local hinge1 = sp.Bottom:FindFirstChild("Door4")
		if hinge1 ~= nil then
			hinge1.C1 = CFrame.new(hingedist, -hingedist, 0)
				* CFrame.Angles(0, 0, (math.pi / 2) * percentage)
				* CFrame.new(-hingedist, hingedist, 0)
		end
	end
end

function runloop()
	if not running then
		running = true
		while true do
			if sp:FindFirstChild("Bottom") then
				local frame = sp.Bottom:FindFirstChild("Frame")
				if frame then
					frame.Value = frame.Value + direction
					if frame.Value > frames then
						frame.Value = frames
					end
					if frame.Value <= 0 then
						frame.Value = 0
					end
					updatedoor(frame.Value)
					wait(1 / framerate)
					if frame then
						if (frame.Value <= 0 and direction == -1) or (frame.Value >= frames and direction == 1) then
							break
						end
					end
				else
					break
				end
			else
				break
			end
		end
		running = false
	end
end

function check(val)
	if val > 0.5 then
		direction = 1
	else
		direction = -1
	end
	runloop()
end

sp.Bottom.OpenDoor.SourceValueChanged:connect(check)
check(sp.Bottom.OpenDoor:GetCurrentValue())
