Library._ConnectorTabs = Library._ConnectorTabs or setmetatable({}, { __mode = "k" }); Library._ConnectorBound = false; function Library:_BindConnectors() if Library._ConnectorBound then return end; Library._ConnectorBound = true; RunService:BindToRenderStep("CorruptSubTabConnectors", Enum.RenderPriority.Camera.Value + 1, function() for Tab in pairs(Library._ConnectorTabs) do local Ok = pcall(Library._UpdateSubTabConnector, Library, Tab); if not Ok then Library._ConnectorTabs[Tab] = nil; end; end; end); end; function Library:_RebuildSubTabConnector(Tab) if typeof(Drawing) ~= "table" or typeof(Drawing.new) ~= "function" then return end; if not Tab then return end; if Tab._ConnectorConn then pcall(function() Tab._ConnectorConn:Disconnect() end); Tab._ConnectorConn = nil; end; if Tab._ConnectorLines then for _, L in Tab._ConnectorLines do local Idx = table.find(self.Drawings, L); if Idx then table.remove(self.Drawings, Idx) end; pcall(function() L:Remove() end); end; end; Tab._ConnectorLines = {}; Tab._ConnectorCurves = {}; Tab._ConnectorTrunk = nil; Tab._ConnectorShown = false; Tab._ConnectorStale = 0; Tab._TrunkCache = {}; local Count = #Tab.SubTabs; if Count == 0 then Library._ConnectorTabs[Tab] = nil; return; end; local function NewLine() local L = Drawing.new("Line"); L.Thickness = 2; L.Color = Library.Palette.Toggle; L.Transparency = 1; L.Visible = false; L.From = Vector2.new(0, 0); L.To = Vector2.new(0, 0); table.insert(self.Drawings, L); table.insert(Tab._ConnectorLines, L); return L; end; Tab._ConnectorTrunk = NewLine(); for I = 1, Count do local Curve = { Cache = {} }; for _ = 1, 10 do table.insert(Curve, NewLine()) end; Curve.Tail = NewLine(); table.insert(Tab._ConnectorCurves, Curve); end; Library._ConnectorTabs[Tab] = true; self:_BindConnectors(); self:_UpdateSubTabConnector(Tab); end; function Library:_UpdateSubTabConnector(Tab) local Trunk = Tab._ConnectorTrunk; if not Trunk then return end; local Curves = Tab._ConnectorCurves; local function HideAll() if Tab._ConnectorShown ~= true then return end; Tab._ConnectorShown = false; Trunk.Visible = false; for _, Curve in Curves do for S = 1, 10 do local Seg = Curve[S]; if Seg and Seg.Visible then Seg.Visible = false end; end; if Curve.Tail and Curve.Tail.Visible then Curve.Tail.Visible = false end; end; end; local function SetLine(Line, Cache, Key, FX, FY, TX, TY) local C = Cache[Key]; if C and C[1] == FX and C[2] == FY and C[3] == TX and C[4] == TY then if not Line.Visible then Line.Visible = true end; return; end; if C then C[1], C[2], C[3], C[4] = FX, FY, TX, TY; else Cache[Key] = { FX, FY, TX, TY }; end; Line.From = Vector2.new(FX, FY); Line.To = Vector2.new(TX, TY); if not Line.Visible then Line.Visible = true end; end; local Subtabs = Tab.SubTabs; local Count = #Subtabs; if Count == 0 then HideAll(); return end; local Container = Tab.SubTabsContainer; if not Container or Container.Parent == nil or not self:IsEffectivelyVisible(Container) then HideAll(); return; end; local First = Subtabs[1].Frame; local Last = Subtabs[Count].Frame; if First.AbsoluteSize.X <= 0 or Last.AbsoluteSize.X <= 0 then Tab._ConnectorStale = (Tab._ConnectorStale or 0) + 1; if Tab._ConnectorStale > 30 then HideAll() end; return; end; Tab._ConnectorStale = 0; local TrunkCache = Tab._TrunkCache; if not TrunkCache then TrunkCache = {}; Tab._TrunkCache = TrunkCache end; local TrunkX = First.AbsolutePosition.X - 14; local TopY = First.AbsolutePosition.Y + GuiInset + 2; local LastCy = Last.AbsolutePosition.Y + Last.AbsoluteSize.Y / 2 + GuiInset; local BottomY = LastCy - 10; if BottomY > TopY then SetLine(Trunk, TrunkCache, "T", TrunkX, TopY, TrunkX, BottomY); elseif Trunk.Visible then Trunk.Visible = false; TrunkCache["T"] = nil; end; for I = 1, Count do local Curve = Curves[I]; if Curve then local F = Subtabs[I].Frame; local Cy = F.AbsolutePosition.Y + F.AbsoluteSize.Y / 2 + GuiInset; local Cx = TrunkX + 10; local CenterY = Cy - 10; local PrevX, PrevY = TrunkX, Cy - 10; for S = 1, 10 do local T = S / 10; local Ang = math.pi - T * (math.pi / 2); local Px = Cx + 10 * math.cos(Ang); local Py = CenterY + 10 * math.sin(Ang); SetLine(Curve[S], Curve.Cache, S, PrevX, PrevY, Px, Py); PrevX, PrevY = Px, Py; end; SetLine(Curve.Tail, Curve.Cache, "Tail", TrunkX + 10, Cy, F.AbsolutePosition.X - 2, Cy); end; end; Tab._ConnectorShown = true; end;