local M={}local J=game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")local C=TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)local G={}function M.OPEN(M)if not M then return end local C=TweenInfo.new(.5,Enum.EasingStyle.Linear)M.PurchaseDoor.Sound:Play()local G=M:GetChildren()for M,G in pairs(G)do if not G:IsA("\077\111\100\101\108")then continue end local W=G:GetChildren()for M,G in pairs(W)do if G:IsA("\066\097\115\101\080\097\114\116")then(coroutine.wrap(function()(J:Create(G,C,{Transparency=1})):Play()end))()end end end end function M.CLOSE(M)if not M then return end local J=M:GetChildren()for M,J in pairs(J)do if J:IsA("\077\111\100\101\108")then J.PrimaryPart.CFrame=G[J]or J.PrimaryPart.CFrame end end end return M


local DoorFX = {}

local tweenService = game:GetService("TweenService")

local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)



local InitialModelCFrames = {}

function DoorFX.OPEN(door)
	if not door then return end

	local TweenInf = TweenInfo.new(.5, Enum.EasingStyle.Linear)

	door.PurchaseDoor.Sound:Play()

	local Components = door:GetChildren()
	for _, Component in pairs (Components) do
		if not Component:IsA("Model") then continue end

		local descendants = Component:GetChildren()
		for _, item in pairs (descendants) do
			if item:IsA("BasePart") then
				coroutine.wrap(function()
					tweenService:Create(item, TweenInf, {Transparency = 1}):Play()
				end)()
			end
		end
	end
end

function DoorFX.CLOSE(door)
	if not door then return end

	local Components = door:GetChildren()
	for _, Component in pairs (Components) do
		if Component:IsA("Model") then
			Component.PrimaryPart.CFrame = InitialModelCFrames[Component] or Component.PrimaryPart.CFrame 
			--this errors when the module is called for some reason so thats why its like that
		end
	end
end

return DoorFX
