local l={}l.__index=l function l.new()local G=setmetatable({},l)G.lastUpdate=tick()G.transparencyDirty=false G.enabled=false G.lastTransparency=nil G.descendantAddedConn=nil G.descendantRemovingConn=nil G.toolDescendantAddedConns={}G.toolDescendantRemovingConns={}G.cachedParts={}return G end function l.HasToolAncestor(l,G)if G.Parent==nil then return false end return G.Parent:IsA("\084\111\111\108")or l:HasToolAncestor(G.Parent)end function l.IsValidPartToModify(l,G)if not G:IsA("\066\097\115\101\080\097\114\116")and not G:IsA("\068\101\099\097\108")then return false end return not l:HasToolAncestor(G)end function l.CachePartsRecursive(l,G)if G then if l:IsValidPartToModify(G)then l.cachedParts[G]=true l.transparencyDirty=true end for G,M in pairs(G:GetChildren())do l:CachePartsRecursive(M)end end end function l.TeardownTransparency(l)for l,G in pairs(l.cachedParts)do l.LocalTransparencyModifier=0 end l.cachedParts={}l.transparencyDirty=true l.lastTransparency=nil if l.descendantAddedConn then l.descendantAddedConn:disconnect()l.descendantAddedConn=nil end if l.descendantRemovingConn then l.descendantRemovingConn:disconnect()l.descendantRemovingConn=nil end for G,M in pairs(l.toolDescendantAddedConns)do M:Disconnect()l.toolDescendantAddedConns[G]=nil end for G,M in pairs(l.toolDescendantRemovingConns)do M:Disconnect()l.toolDescendantRemovingConns[G]=nil end end function l.SetupTransparency(l,G)l:TeardownTransparency()if l.descendantAddedConn then l.descendantAddedConn:disconnect()end l.descendantAddedConn=G.DescendantAdded:Connect(function(M)if l:IsValidPartToModify(M)then l.cachedParts[M]=true l.transparencyDirty=true return end if M:IsA("\084\111\111\108")then if l.toolDescendantAddedConns[M]then l.toolDescendantAddedConns[M]:Disconnect()end l.toolDescendantAddedConns[M]=M.DescendantAdded:Connect(function(G)l.cachedParts[G]=nil if G:IsA("\066\097\115\101\080\097\114\116")or G:IsA("\068\101\099\097\108")then G.LocalTransparencyModifier=0 end end)if l.toolDescendantRemovingConns[M]then l.toolDescendantRemovingConns[M]:disconnect()end l.toolDescendantRemovingConns[M]=M.DescendantRemoving:Connect(function(M)wait()if G and(M and(M:IsDescendantOf(G)and l:IsValidPartToModify(M)))then l.cachedParts[M]=true l.transparencyDirty=true end end)end end)if l.descendantRemovingConn then l.descendantRemovingConn:disconnect()end l.descendantRemovingConn=G.DescendantRemoving:connect(function(G)if l.cachedParts[G]then l.cachedParts[G]=nil G.LocalTransparencyModifier=0 end end)l:CachePartsRecursive(G)end function l.Enable(l,G)if l.enabled~=G then l.enabled=G l:Update()end end function l.SetSubject(l,G)local M=nil if G and G:IsA("\072\117\109\097\110\111\105\100")then M=G.Parent end if G and(G:IsA("\086\101\104\105\099\108\101\083\101\097\116")and G.Occupant)then M=G.Occupant.Parent end if not M then l:TeardownTransparency()return end l:SetupTransparency(M)end local G=require(script.Parent:WaitForChild("\067\097\109\101\114\097\085\116\105\108\115"))function l.Update(l)local M=tick()local C=workspace.CurrentCamera if C then local s=0 if l.enabled then local k=(C.Focus.p-C.CoordinateFrame.p).magnitude local w=k<2 and 1-(k-.5)/1.5 or 0 if w<.5 then w=0 end if l.lastTransparency then local G=w-l.lastTransparency if true and(w<1 and l.lastTransparency<.95)then local C=2.8*(M-l.lastUpdate)G=math.clamp(G,-C,C)end w=l.lastTransparency+G else l.transparencyDirty=true end s=math.clamp(G.Round(w,2),0,1)end if l.transparencyDirty or l.lastTransparency~=s then for l,G in pairs(l.cachedParts)do l.LocalTransparencyModifier=s end l.transparencyDirty=false l.lastTransparency=s end end l.lastUpdate=M end return l


local v1 = {};
v1.__index = v1;
function v1.new()
	local v2 = setmetatable({}, v1);
	v2.lastUpdate = tick();
	v2.transparencyDirty = false;
	v2.enabled = false;
	v2.lastTransparency = nil;
	v2.descendantAddedConn = nil;
	v2.descendantRemovingConn = nil;
	v2.toolDescendantAddedConns = {};
	v2.toolDescendantRemovingConns = {};
	v2.cachedParts = {};
	return v2;
end;
function v1.HasToolAncestor(p1, p2)
	if p2.Parent == nil then
		return false;
	end;
	return p2.Parent:IsA("Tool") or p1:HasToolAncestor(p2.Parent);
end;
function v1.IsValidPartToModify(p3, p4)
	if not p4:IsA("BasePart") and not p4:IsA("Decal") then
		return false;
	end;
	return not p3:HasToolAncestor(p4);
end;
function v1.CachePartsRecursive(p5, p6)
	if p6 then
		if p5:IsValidPartToModify(p6) then
			p5.cachedParts[p6] = true;
			p5.transparencyDirty = true;
		end;
		for v3, v4 in pairs(p6:GetChildren()) do
			p5:CachePartsRecursive(v4);
		end;
	end;
end;
function v1.TeardownTransparency(p7)
	for v5, v6 in pairs(p7.cachedParts) do
		v5.LocalTransparencyModifier = 0;
	end;
	p7.cachedParts = {};
	p7.transparencyDirty = true;
	p7.lastTransparency = nil;
	if p7.descendantAddedConn then
		p7.descendantAddedConn:disconnect();
		p7.descendantAddedConn = nil;
	end;
	if p7.descendantRemovingConn then
		p7.descendantRemovingConn:disconnect();
		p7.descendantRemovingConn = nil;
	end;
	for v7, v8 in pairs(p7.toolDescendantAddedConns) do
		v8:Disconnect();
		p7.toolDescendantAddedConns[v7] = nil;
	end;
	for v9, v10 in pairs(p7.toolDescendantRemovingConns) do
		v10:Disconnect();
		p7.toolDescendantRemovingConns[v9] = nil;
	end;
end;
function v1.SetupTransparency(p8, p9)
	p8:TeardownTransparency();
	if p8.descendantAddedConn then
		p8.descendantAddedConn:disconnect();
	end;
	p8.descendantAddedConn = p9.DescendantAdded:Connect(function(p10)
		if p8:IsValidPartToModify(p10) then
			p8.cachedParts[p10] = true;
			p8.transparencyDirty = true;
			return;
		end;
		if p10:IsA("Tool") then
			if p8.toolDescendantAddedConns[p10] then
				p8.toolDescendantAddedConns[p10]:Disconnect();
			end;
			p8.toolDescendantAddedConns[p10] = p10.DescendantAdded:Connect(function(p11)
				p8.cachedParts[p11] = nil;
				if p11:IsA("BasePart") or p11:IsA("Decal") then
					p11.LocalTransparencyModifier = 0;
				end;
			end);
			if p8.toolDescendantRemovingConns[p10] then
				p8.toolDescendantRemovingConns[p10]:disconnect();
			end;
			p8.toolDescendantRemovingConns[p10] = p10.DescendantRemoving:Connect(function(p12)
				wait();
				if p9 and p12 and p12:IsDescendantOf(p9) and p8:IsValidPartToModify(p12) then
					p8.cachedParts[p12] = true;
					p8.transparencyDirty = true;
				end;
			end);
		end;
	end);
	if p8.descendantRemovingConn then
		p8.descendantRemovingConn:disconnect();
	end;
	p8.descendantRemovingConn = p9.DescendantRemoving:connect(function(p13)
		if p8.cachedParts[p13] then
			p8.cachedParts[p13] = nil;
			p13.LocalTransparencyModifier = 0;
		end;
	end);
	p8:CachePartsRecursive(p9);
end;
function v1.Enable(p14, p15)
	if p14.enabled ~= p15 then
		p14.enabled = p15;
		p14:Update();
	end;
end;
function v1.SetSubject(p16, p17)
	local v11 = nil;
	if p17 and p17:IsA("Humanoid") then
		v11 = p17.Parent;
	end;
	if p17 and p17:IsA("VehicleSeat") and p17.Occupant then
		v11 = p17.Occupant.Parent;
	end;
	if not v11 then
		p16:TeardownTransparency();
		return;
	end;
	p16:SetupTransparency(v11);
end;
local u1 = require(script.Parent:WaitForChild("CameraUtils"));
function v1.Update(p18)
	local v12 = tick();
	local l__CurrentCamera__13 = workspace.CurrentCamera;
	if l__CurrentCamera__13 then
		local v14 = 0;
		if p18.enabled then
			local l__magnitude__15 = (l__CurrentCamera__13.Focus.p - l__CurrentCamera__13.CoordinateFrame.p).magnitude;
			local v16 = l__magnitude__15 < 2 and 1 - (l__magnitude__15 - 0.5) / 1.5 or 0;
			if v16 < 0.5 then
				v16 = 0;
			end;
			if p18.lastTransparency then
				local v17 = v16 - p18.lastTransparency;
				if not false and v16 < 1 and p18.lastTransparency < 0.95 then
					local v18 = 2.8 * (v12 - p18.lastUpdate);
					v17 = math.clamp(v17, -v18, v18);
				end;
				v16 = p18.lastTransparency + v17;
			else
				p18.transparencyDirty = true;
			end;
			v14 = math.clamp(u1.Round(v16, 2), 0, 1);
		end;
		if p18.transparencyDirty or p18.lastTransparency ~= v14 then
			for v19, v20 in pairs(p18.cachedParts) do
				v19.LocalTransparencyModifier = v14;
			end;
			p18.transparencyDirty = false;
			p18.lastTransparency = v14;
		end;
	end;
	p18.lastUpdate = v12;
end;
return v1;
