local R={}local N=game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")local p=TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)local t={}function R.OPEN(R)if not R then return end local p=R:WaitForChild("\069\102\102\101\099\116\115")local C=p:GetChildren()for R,N in pairs(C)do if N.Name=="\085\110\108\111\099\107"then N:Play()continue end if N:IsA("\066\101\097\109")or N:IsA("\080\111\105\110\116\076\105\103\104\116")or N:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")then N.Enabled=true end end local X=R:GetChildren()for R,p in pairs(X)do if not p:IsA("\077\111\100\101\108")then continue end t[p]=p.PrimaryPart.CFrame local C=(p.PrimaryPart.CFrame+Vector3.new(math.random(-1,1),3,math.random(-1,1)))*CFrame.Angles(math.rad(math.random(1,360)),math.rad(math.random(1,360)),math.rad(math.random(1,360)))local X=TweenInfo.new(1,Enum.EasingStyle.Quint,Enum.EasingDirection.In);(N:Create(p.PrimaryPart,X,{CFrame=C})):Play()end wait(1)for R,p in pairs(X)do if not p:IsA("\077\111\100\101\108")then continue end local t=(p.PrimaryPart.CFrame+Vector3.new(math.random(-20,20),50,math.random(-20,20)))*CFrame.Angles(math.rad(math.random(1,360)),math.rad(math.random(1,360)),math.rad(math.random(1,360)))local C=TweenInfo.new(2,Enum.EasingStyle.Linear)local X=N:Create(p.PrimaryPart,C,{CFrame=t})X:Play()local s=nil s=X.Completed:Connect(function()s:Disconnect()p.PrimaryPart.CFrame=p.PrimaryPart.CFrame-Vector3.new(0,300,0)end)end wait(.5)for R,N in pairs(C)do if N:IsA("\066\101\097\109")or N:IsA("\080\111\105\110\116\076\105\103\104\116")or N:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")then N.Enabled=false end end end function R.CLOSE(R)if not R then return end local N=R:GetChildren()for R,N in pairs(N)do if N:IsA("\077\111\100\101\108")then N.PrimaryPart.CFrame=t[N]or N.PrimaryPart.CFrame end end end return R
--This module is for any client FX related to the lab debris

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 EffectsBrick = door:WaitForChild("Effects")
	local Effects = EffectsBrick:GetChildren()

	for _, Item in pairs(Effects) do
		if Item.Name == "Unlock" then
			Item:Play()
			continue
		end
		if Item:IsA("Beam") or Item:IsA("PointLight") or Item:IsA("ParticleEmitter") then
			Item.Enabled = true
		end
	end

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

		InitialModelCFrames[Component] = Component.PrimaryPart.CFrame

		local CFrameGoal = (Component.PrimaryPart.CFrame + Vector3.new(math.random(-1, 1), 3, math.random(-1, 1)))
			* CFrame.Angles(math.rad(math.random(1, 360)), math.rad(math.random(1, 360)), math.rad(math.random(1, 360)))

		local TweenInf = TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.In)
		tweenService:Create(Component.PrimaryPart, TweenInf, { CFrame = CFrameGoal }):Play()
	end

	wait(1)

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

		local CFrameGoal = (Component.PrimaryPart.CFrame + Vector3.new(math.random(-20, 20), 50, math.random(-20, 20)))
			* CFrame.Angles(math.rad(math.random(1, 360)), math.rad(math.random(1, 360)), math.rad(math.random(1, 360)))

		local TweenInf = TweenInfo.new(2, Enum.EasingStyle.Linear)
		local Tween = tweenService:Create(Component.PrimaryPart, TweenInf, { CFrame = CFrameGoal })
		Tween:Play()
		local Event = nil
		Event = Tween.Completed:Connect(function()
			Event:Disconnect()
			Component.PrimaryPart.CFrame = Component.PrimaryPart.CFrame - Vector3.new(0, 300, 0)
		end)
	end

	wait(0.5)

	for _, Item in pairs(Effects) do
		if Item:IsA("Beam") or Item:IsA("PointLight") or Item:IsA("ParticleEmitter") then
			Item.Enabled = false
		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
