local S={}local Q=game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")local X=TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)local y={}function S.OPEN(S)if not S then return end local X=S:WaitForChild("\069\102\102\101\099\116\115")local V=X:GetChildren()for S,Q in pairs(V)do if Q.Name=="\085\110\108\111\099\107"then Q:Play()continue end if Q:IsA("\066\101\097\109")or Q:IsA("\080\111\105\110\116\076\105\103\104\116")or Q:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")then Q.Enabled=true end end local Y=S:GetChildren()for S,X in pairs(Y)do if not X:IsA("\077\111\100\101\108")then continue end local V=X:GetDescendants()for S,Q in pairs(V)do if Q:IsA("\066\097\115\101\080\097\114\116")and Q~=X.PrimaryPart then local S=Instance.new("\087\101\108\100\067\111\110\115\116\114\097\105\110\116")S.Part0=Q S.Part1=X.PrimaryPart S.Parent=X.PrimaryPart Q.Anchored=false end end y[X]=X.PrimaryPart.CFrame local Y=(X.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 w=TweenInfo.new(1,Enum.EasingStyle.Quint,Enum.EasingDirection.In);(Q:Create(X.PrimaryPart,w,{CFrame=Y})):Play()end wait(1)for S,X in pairs(Y)do if not X:IsA("\077\111\100\101\108")then continue end local y=(X.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 V=TweenInfo.new(2,Enum.EasingStyle.Linear)local Y=Q:Create(X.PrimaryPart,V,{CFrame=y})Y:Play()local w=nil w=Y.Completed:Connect(function()w:Disconnect()X.PrimaryPart.CFrame=X.PrimaryPart.CFrame-Vector3.new(0,300,0)end)end wait(.5)for S,Q in pairs(V)do if Q:IsA("\066\101\097\109")or Q:IsA("\080\111\105\110\116\076\105\103\104\116")or Q:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")then Q.Enabled=false end end end function S.CLOSE(S)if not S then return end local Q=S:GetChildren()for S,Q in pairs(Q)do if Q:IsA("\077\111\100\101\108")then Q.PrimaryPart.CFrame=y[Q]or Q.PrimaryPart.CFrame end end end return S
--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

		local descendants = Component:GetDescendants()
		for _, item in pairs(descendants) do
			if item:IsA("BasePart") and item ~= Component.PrimaryPart then
				local newWeld = Instance.new("WeldConstraint")
				newWeld.Part0 = item
				newWeld.Part1 = Component.PrimaryPart
				newWeld.Parent = Component.PrimaryPart
				item.Anchored = false
			end
		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
