Requested module experienced an error while loading: local GuiService =…
- User
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Requested module experienced an error while loading:
local GuiService = game:GetService("GuiService") local script_upvr = script local Reference = require(script_upvr.Reference) local any_getObject_result1 = Reference.getObject() local var9 if var9 then var9 = any_getObject_result1.Value end if var9 and var9 ~= script_upvr then return require(var9) end if not any_getObject_result1 then Reference.addToReplicatedStorage() end local GoodSignal_upvr = require(script_upvr.Packages.GoodSignal) local Utility_upvr = require(script_upvr.Utility) local Themes_2_upvr = require(script_upvr.Features.Themes) local module_upvr = {} module_upvr.__index = module_upvr local Themes = script_upvr.Features.Themes local tbl_3_upvr = {} local any_new_result1_2_upvr = GoodSignal_upvr.new() local Elements_upvr = script_upvr.Elements if GuiService.TopbarInset.Height == 0 then GuiService:GetPropertyChangedSignal("TopbarInset"):Wait() end local Default = require(Themes.Default) module_upvr.baseTheme = Default if GuiService.TopbarInset.Height ~= 36 then Default = false else Default = true end module_upvr.isOldTopbar = Default module_upvr.iconsDictionary = tbl_3_upvr module_upvr.container = require(Elements_upvr.Container)(module_upvr) module_upvr.topbarEnabled = true function module_upvr.getIcons() -- Line 106 --[[ Upvalues[1]: [1]: module_upvr (readonly) ]] return module_upvr.iconsDictionary end function module_upvr.getIcon(arg1) -- Line 110 --[[ Upvalues[1]: [1]: module_upvr (readonly) ]] return module_upvr.iconsDictionary[arg1] end function module_upvr.setTopbarEnabled(arg1, arg2) -- Line 114 --[[ Upvalues[1]: [1]: module_upvr (readonly) ]] local var23 if typeof(arg1) ~= "boolean" then var23 = module_upvr.topbarEnabled end if not arg2 then module_upvr.topbarEnabled = var23 end for _, v in pairs(module_upvr.container) do v.Enabled = var23 end end function module_upvr.modifyBaseTheme(arg1) -- Line 126 --[[ Upvalues[3]: [1]: Themes_2_upvr (readonly) [2]: module_upvr (readonly) [3]: tbl_3_upvr (readonly) ]] for _, v_2 in pairs(Themes_2_upvr.getModifications(arg1)) do for _, v_3 in pairs(module_upvr.baseTheme) do Themes_2_upvr.merge(v_3, v_2) end end for _, v_4 in pairs(tbl_3_upvr) do v_4:setTheme(module_upvr.baseTheme) end end task.defer(require(script_upvr.Features.Gamepad).start, module_upvr) task.defer(require(script_upvr.Features.Overflow).start, module_upvr) for _, v_5 in pairs(module_upvr.container) do v_5.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui") local _ end if module_upvr.isOldTopbar then module_upvr.modifyBaseTheme(require(Themes.Classic)) end local Janitor_upvr = require(script_upvr.Packages.Janitor) local UserInputService_upvr = game:GetService("UserInputService") function module_upvr.new() -- Line 153 --[[ Upvalues[9]: [1]: module_upvr (readonly) [2]: Janitor_upvr (readonly) [3]: Utility_upvr (readonly) [4]: tbl_3_upvr (readonly) [5]: GoodSignal_upvr (readonly) [6]: script_upvr (readonly) [7]: Elements_upvr (readonly) [8]: UserInputService_upvr (readonly) [9]: any_new_result1_2_upvr (readonly) ]] local module_upvr_2 = {} setmetatable(module_upvr_2, module_upvr) local any_new_result1 = Janitor_upvr.new() module_upvr_2.janitor = any_new_result1 module_upvr_2.themesJanitor = any_new_result1:add(Janitor_upvr.new()) module_upvr_2.singleClickJanitor = any_new_result1:add(Janitor_upvr.new()) module_upvr_2.captionJanitor = any_new_result1:add(Janitor_upvr.new()) module_upvr_2.joinJanitor = any_new_result1:add(Janitor_upvr.new()) module_upvr_2.menuJanitor = any_new_result1:add(Janitor_upvr.new()) module_upvr_2.dropdownJanitor = any_new_result1:add(Janitor_upvr.new()) local any_generateUID_result1_upvr = Utility_upvr.generateUID() tbl_3_upvr[any_generateUID_result1_upvr] = module_upvr_2 any_new_result1:add(function() -- Line 170 --[[ Upvalues[2]: [1]: tbl_3_upvr (copied, readonly) [2]: any_generateUID_result1_upvr (readonly) ]] tbl_3_upvr[any_generateUID_result1_upvr] = nil end) module_upvr_2.selected = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.deselected = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.toggled = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.viewingStarted = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.viewingEnded = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.stateChanged = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.notified = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.noticeStarted = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.noticeChanged = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.endNotices = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.dropdownOpened = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.dropdownClosed = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.menuOpened = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.menuClosed = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.toggleKeyAdded = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.alignmentChanged = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.updateSize = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.resizingComplete = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.joinedParent = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.menuSet = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.dropdownSet = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.updateMenu = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.startMenuUpdate = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.childThemeModified = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.indicatorSet = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.dropdownChildAdded = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.menuChildAdded = any_new_result1:add(GoodSignal_upvr.new()) module_upvr_2.iconModule = script_upvr module_upvr_2.UID = any_generateUID_result1_upvr module_upvr_2.isEnabled = true module_upvr_2.isSelected = false module_upvr_2.isViewing = false module_upvr_2.joinedFrame = false module_upvr_2.parentIconUID = false module_upvr_2.deselectWhenOtherIconSelected = true module_upvr_2.totalNotices = 0 module_upvr_2.activeState = "Deselected" module_upvr_2.alignment = "" module_upvr_2.originalAlignment = "" module_upvr_2.appliedTheme = {} module_upvr_2.appearance = {} module_upvr_2.cachedInstances = {} module_upvr_2.cachedNamesToInstances = {} module_upvr_2.cachedCollectives = {} module_upvr_2.bindedToggleKeys = {} module_upvr_2.customBehaviours = {} module_upvr_2.toggleItems = {} module_upvr_2.bindedEvents = {} module_upvr_2.notices = {} module_upvr_2.menuIcons = {} module_upvr_2.dropdownIcons = {} module_upvr_2.childIconsDict = {} module_upvr_2.isOldTopbar = module_upvr.isOldTopbar module_upvr_2.widget = any_new_result1:add(require(Elements_upvr.Widget)(module_upvr_2, module_upvr)) module_upvr_2:setAlignment() module_upvr_2:setTheme(module_upvr.baseTheme) local any_getInstance_result1_3 = module_upvr_2:getInstance("ClickRegion") local function _() -- Line 241, Named "handleToggle" --[[ Upvalues[1]: [1]: module_upvr_2 (readonly) ]] if module_upvr_2.locked then else if module_upvr_2.isSelected then module_upvr_2:deselect(module_upvr_2) return end module_upvr_2:select(module_upvr_2) end end local var57_upvw = false local var58_upvw = false any_getInstance_result1_3.MouseButton1Click:Connect(function() -- Line 253 --[[ Upvalues[3]: [1]: var57_upvw (read and write) [2]: var58_upvw (read and write) [3]: module_upvr_2 (readonly) ]] if var57_upvw then else var58_upvw = true task.delay(0.01, function() -- Line 258 --[[ Upvalues[1]: [1]: var58_upvw (copied, read and write) ]] var58_upvw = false end) if module_upvr_2.locked then return end if module_upvr_2.isSelected then module_upvr_2:deselect(module_upvr_2) return end module_upvr_2:select(module_upvr_2) end end) any_getInstance_result1_3.TouchTap:Connect(function() -- Line 263 --[[ Upvalues[3]: [1]: var58_upvw (read and write) [2]: var57_upvw (read and write) [3]: module_upvr_2 (readonly) ]] if var58_upvw then else var57_upvw = true task.delay(0.01, function() -- Line 270 --[[ Upvalues[1]: [1]: var57_upvw (copied, read and write) ]] var57_upvw = false end) if module_upvr_2.locked then return end if module_upvr_2.isSelected then module_upvr_2:deselect(module_upvr_2) return end module_upvr_2:select(module_upvr_2) end end) any_new_result1:add(UserInputService_upvr.InputBegan:Connect(function(arg1, arg2) -- Line 277 --[[ Upvalues[1]: [1]: module_upvr_2 (readonly) ]] if module_upvr_2.locked then elseif module_upvr_2.bindedToggleKeys[arg1.KeyCode] and not arg2 then if module_upvr_2.locked then return end if module_upvr_2.isSelected then module_upvr_2:deselect(module_upvr_2) return end module_upvr_2:select(module_upvr_2) end end)) local function viewingEnded() -- Line 299 --[[ Upvalues[1]: [1]: module_upvr_2 (readonly) ]] if module_upvr_2.locked then else module_upvr_2.isViewing = false module_upvr_2.viewingEnded:Fire(true) module_upvr_2:setState(nil, module_upvr_2) end end module_upvr_2.joinedParent:Connect(function() -- Line 307 --[[ Upvalues[1]: [1]: module_upvr_2 (readonly) ]] if module_upvr_2.isViewing then if module_upvr_2.locked then return end module_upvr_2.isViewing = false module_upvr_2.viewingEnded:Fire(true) module_upvr_2:setState(nil, module_upvr_2) end end) any_getInstance_result1_3.MouseEnter:Connect(function() -- Line 312 --[[ Upvalues[2]: [1]: UserInputService_upvr (copied, readonly) [2]: module_upvr_2 (readonly) ]] if module_upvr_2.locked then else module_upvr_2.isViewing = true module_upvr_2.viewingStarted:Fire(true) if not not UserInputService_upvr.KeyboardEnabled then module_upvr_2:setState("Viewing", module_upvr_2) end end end) local var66_upvw = 0 any_new_result1:add(UserInputService_upvr.TouchEnded:Connect(viewingEnded)) any_getInstance_result1_3.MouseLeave:Connect(viewingEnded) any_getInstance_result1_3.SelectionGained:Connect(function(arg1) -- Line 289, Named "viewingStarted" --[[ Upvalues[1]: [1]: module_upvr_2 (readonly) ]] if module_upvr_2.locked then else module_upvr_2.isViewing = true module_upvr_2.viewingStarted:Fire(true) if not arg1 then module_upvr_2:setState("Viewing", module_upvr_2) end end end) any_getInstance_result1_3.SelectionLost:Connect(viewingEnded) any_getInstance_result1_3.MouseButton1Down:Connect(function() -- Line 321 --[[ Upvalues[3]: [1]: module_upvr_2 (readonly) [2]: UserInputService_upvr (copied, readonly) [3]: var66_upvw (read and write) ]] if not module_upvr_2.locked and UserInputService_upvr.TouchEnabled then var66_upvw += 1 task.delay(0.2, function() -- Line 325 --[[ Upvalues[3]: [1]: var66_upvw (readonly) [2]: var66_upvw (copied, read and write) [3]: module_upvr_2 (copied, readonly) ]] if var66_upvw == var66_upvw then if module_upvr_2.locked then return end module_upvr_2.isViewing = true module_upvr_2.viewingStarted:Fire(true) module_upvr_2:setState("Viewing", module_upvr_2) end end) end end) any_getInstance_result1_3.MouseButton1Up:Connect(function() -- Line 332 --[[ Upvalues[1]: [1]: var66_upvw (read and write) ]] var66_upvw += 1 end) local any_getInstance_result1_2_upvr = module_upvr_2:getInstance("IconOverlay") module_upvr_2.viewingStarted:Connect(function() -- Line 338 --[[ Upvalues[2]: [1]: any_getInstance_result1_2_upvr (readonly) [2]: module_upvr_2 (readonly) ]] any_getInstance_result1_2_upvr.Visible = not module_upvr_2.overlayDisabled end) module_upvr_2.viewingEnded:Connect(function() -- Line 341 --[[ Upvalues[1]: [1]: any_getInstance_result1_2_upvr (readonly) ]] any_getInstance_result1_2_upvr.Visible = false end) any_new_result1:add(any_new_result1_2_upvr:Connect(function(arg1) -- Line 346 --[[ Upvalues[1]: [1]: module_upvr_2 (readonly) ]] if arg1 ~= module_upvr_2 and module_upvr_2.deselectWhenOtherIconSelected and arg1.deselectWhenOtherIconSelected then module_upvr_2:deselect() end end)) local var77 for var104, v_6 in pairs(string.split(debug.info(2, 's'), '.')) do local SOME = game:FindFirstChild(v_6) if not SOME then break end if SOME:IsA("ScreenGui") then var77 = SOME end end if SOME and var77 and var77.ResetOnSpawn == true then Utility_upvr.localPlayerRespawned(function() -- Line 371 --[[ Upvalues[1]: [1]: module_upvr_2 (readonly) ]] module_upvr_2:destroy() end) end function var104(arg1) -- Line 378 --[[ Upvalues[2]: [1]: module_upvr_2 (readonly) [2]: module_upvr (copied, readonly) ]] -- KONSTANTWARNING: Variable analysis failed. Output will have some incorrect variable assignments module_upvr_2.noticeChanged:Fire(module_upvr_2.totalNotices) for i_7, _ in pairs(module_upvr_2.childIconsDict) do local any_getIcon_result1 = module_upvr.getIcon(i_7) any_getIcon_result1.noticeChanged:Fire(any_getIcon_result1.totalNotices) if not arg1 and any_getIcon_result1.isSelected then for _, _ in pairs(any_getIcon_result1.childIconsDict) do any_getIcon_result1:deselect() end end end end module_upvr_2.toggled:Connect(var104) function var104() -- Line 393 --[[ Upvalues[1]: [1]: module_upvr_2 (readonly) ]] if module_upvr_2.activeState == "Deselected" then module_upvr_2.stateChanged:Fire("Deselected") module_upvr_2:refresh() end end task.delay(0.1, var104) return module_upvr_2 end function module_upvr.setName(arg1, arg2) -- Line 411 arg1.widget.Name = arg2 arg1.name = arg2 return arg1 end function module_upvr.setState(arg1, arg2, arg3) -- Line 417 --[[ Upvalues[2]: [1]: Utility_upvr (readonly) [2]: any_new_result1_2_upvr (readonly) ]] if not arg2 then if arg1.isSelected then else end end local any_formatStateName_result1 = Utility_upvr.formatStateName("Deselected") if arg1.activeState == any_formatStateName_result1 then else arg1.activeState = any_formatStateName_result1 if any_formatStateName_result1 == "Deselected" then arg1.isSelected = false if arg1.isSelected then arg1.toggled:Fire(false, arg3) arg1.deselected:Fire(arg3) end arg1:_setToggleItemsVisible(false, arg3) elseif any_formatStateName_result1 == "Selected" then arg1.isSelected = true -- KONSTANTERROR: Expression was reused, decompilation is incorrect if not arg1.isSelected then arg1.toggled:Fire(true, arg3) arg1.selected:Fire(arg3) any_new_result1_2_upvr:Fire(arg1) end arg1:_setToggleItemsVisible(true, arg3) end arg1.stateChanged:Fire(any_formatStateName_result1, arg3) end end function module_upvr.getInstance(arg1, arg2) -- Line 450 --[[ Upvalues[1]: [1]: Themes_2_upvr (readonly) ]] local var106 = arg1.cachedNamesToInstances[arg2] if var106 then return var106 end local function cacheInstance_upvr(arg1_2, arg2_2) -- Line 458, Named "cacheInstance" --[[ Upvalues[1]: [1]: arg1 (readonly) ]] local var107 if not arg1.cachedInstances[arg2_2] then local Collective = arg2_2:GetAttribute("Collective") var107 = Collective if var107 then var107 = arg1.cachedCollectives[Collective] end if var107 then table.insert(var107, arg2_2) end arg1.cachedNamesToInstances[arg1_2] = arg2_2 arg1.cachedInstances[arg2_2] = true arg2_2.Destroying:Once(function() -- Line 468 --[[ Upvalues[3]: [1]: arg1 (copied, readonly) [2]: arg1_2 (readonly) [3]: arg2_2 (readonly) ]] arg1.cachedNamesToInstances[arg1_2] = nil arg1.cachedInstances[arg2_2] = nil end) end end local widget = arg1.widget cacheInstance_upvr("Widget", widget) if arg2 == "Widget" then return widget end local var111_upvw local function scanChildren_upvr(arg1_3) -- Line 481, Named "scanChildren" --[[ Upvalues[6]: [1]: arg1 (readonly) [2]: Themes_2_upvr (copied, readonly) [3]: scanChildren_upvr (readonly) [4]: cacheInstance_upvr (readonly) [5]: arg2 (readonly) [6]: var111_upvw (read and write) ]] for _, v_9 in pairs(arg1_3:GetChildren()) do local WidgetUID = v_9:GetAttribute("WidgetUID") if not WidgetUID or WidgetUID == arg1.UID then local any_getRealInstance_result1 = Themes_2_upvr.getRealInstance(v_9) if any_getRealInstance_result1 then v_9 = any_getRealInstance_result1 end scanChildren_upvr(v_9) if v_9:IsA("GuiBase") or v_9:IsA("UIBase") or v_9:IsA("ValueBase") then local Name = v_9.Name cacheInstance_upvr(Name, v_9) if Name == arg2 then var111_upvw = v_9 end end end end end scanChildren_upvr(widget) return var111_upvw end function module_upvr.getCollective(arg1, arg2) -- Line 511 local var122 = arg1.cachedCollectives[arg2] if var122 then return var122 end local module = {} for i_10, _ in pairs(arg1.cachedInstances) do if i_10:GetAttribute("Collective") == arg2 then table.insert(module, i_10) end end arg1.cachedCollectives[arg2] = module return module end function module_upvr.getInstanceOrCollective(arg1, arg2) -- Line 532 local any_getInstance_result1 = arg1:getInstance(arg2) local var128 if any_getInstance_result1 then table.insert(var128, any_getInstance_result1) end if #var128 == 0 then var128 = arg1:getCollective(arg2) end return var128 end function module_upvr.getStateGroup(arg1, arg2) -- Line 546 local var129 = arg2 if not var129 then var129 = arg1.activeState end local var130 = arg1.appearance[var129] if not var130 then var130 = {} arg1.appearance[var129] = var130 end return var130 end function module_upvr.refreshAppearance(arg1, arg2, arg3) -- Line 556 --[[ Upvalues[1]: [1]: Themes_2_upvr (readonly) ]] Themes_2_upvr.refresh(arg1, arg2, arg3) return arg1 end function module_upvr.refresh(arg1) -- Line 561 arg1:refreshAppearance(arg1.widget) arg1.updateSize:Fire() return arg1 end function module_upvr.updateParent(arg1) -- Line 567 --[[ Upvalues[1]: [1]: module_upvr (readonly) ]] local any_getIcon_result1_2 = module_upvr.getIcon(arg1.parentIconUID) if any_getIcon_result1_2 then any_getIcon_result1_2.updateSize:Fire() end end function module_upvr.setBehaviour(arg1, arg2, arg3, arg4, arg5) -- Line 574 arg1.customBehaviours[arg2..'-'..arg3] = arg4 if arg5 then for _, v_11 in pairs(arg1:getInstanceOrCollective(arg2)) do arg1:refreshAppearance(v_11, arg3) end end end function module_upvr.modifyTheme(arg1, arg2, arg3) -- Line 587 --[[ Upvalues[1]: [1]: Themes_2_upvr (readonly) ]] return arg1, Themes_2_upvr.modify(arg1, arg2, arg3) end function module_upvr.modifyChildTheme(arg1, arg2, arg3) -- Line 592 --[[ Upvalues[1]: [1]: module_upvr (readonly) ]] arg1.childModifications = arg2 arg1.childModificationsUID = arg3 for i_12, _ in pairs(arg1.childIconsDict) do module_upvr.getIcon(i_12):modifyTheme(arg2, arg3) end arg1.childThemeModified:Fire() end function module_upvr.removeModification(arg1, arg2) -- Line 604 --[[ Upvalues[1]: [1]: Themes_2_upvr (readonly) ]] Themes_2_upvr.remove(arg1, arg2) return arg1 end function module_upvr.removeModificationWith(arg1, arg2, arg3, arg4) -- Line 609 --[[ Upvalues[1]: [1]: Themes_2_upvr (readonly) ]] Themes_2_upvr.removeWith(arg1, arg2, arg3, arg4) return arg1 end function module_upvr.setTheme(arg1, arg2) -- Line 614 --[[ Upvalues[1]: [1]: Themes_2_upvr (readonly) ]] Themes_2_upvr.set(arg1, arg2) return arg1 end function module_upvr.setEnabled(arg1, arg2) -- Line 619 arg1.isEnabled = arg2 arg1.widget.Visible = arg2 arg1:updateParent() return arg1 end function module_upvr.select(arg1, arg2) -- Line 626 arg1:setState("Selected", arg2) return arg1 end function module_upvr.deselect(arg1, arg2) -- Line 631 arg1:setState("Deselected", arg2) return arg1 end function module_upvr.notify(arg1, arg2, arg3) -- Line 636 --[[ Upvalues[2]: [1]: Elements_upvr (readonly) [2]: module_upvr (readonly) ]] if not arg1.notice then arg1.notice = require(Elements_upvr.Notice)(arg1, module_upvr) end arg1.noticeStarted:Fire(arg2, arg3) return arg1 end function module_upvr.clearNotices(arg1) -- Line 650 arg1.endNotices:Fire() return arg1 end function module_upvr.disableOverlay(arg1, arg2) -- Line 655 arg1.overlayDisabled = arg2 return arg1 end module_upvr.disableStateOverlay = module_upvr.disableOverlay function module_upvr.setImage(arg1, arg2, arg3) -- Line 661 local tbl_4 = {"IconImage", "Image"} tbl_4[3] = arg2 tbl_4[4] = arg3 arg1:modifyTheme(tbl_4) return arg1 end function module_upvr.setLabel(arg1, arg2, arg3) -- Line 666 local tbl_5 = {"IconLabel", "Text"} tbl_5[3] = arg2 tbl_5[4] = arg3 arg1:modifyTheme(tbl_5) return arg1 end function module_upvr.setOrder(arg1, arg2, arg3) -- Line 671 local tbl_6 = {"Widget", "LayoutOrder"} tbl_6[3] = arg2 tbl_6[4] = arg3 arg1:modifyTheme(tbl_6) return arg1 end function module_upvr.setCornerRadius(arg1, arg2, arg3) -- Line 676 local tbl_11 = {"IconCorners", "CornerRadius"} tbl_11[3] = arg2 tbl_11[4] = arg3 arg1:modifyTheme(tbl_11) return arg1 end function module_upvr.align(arg1, arg2, arg3) -- Line 681 --[[ Upvalues[1]: [1]: module_upvr (readonly) ]] -- KONSTANTWARNING: Variable analysis failed. Output will have some incorrect variable assignments local any_lower_result1 = tostring(arg2):lower() if any_lower_result1 == "mid" or any_lower_result1 == "centre" then end if "center" ~= "left" then -- KONSTANTERROR: Expression was reused, decompilation is incorrect (x2) if "center" ~= "center" and "center" ~= "right" then end end if "left" ~= "center" or not module_upvr.container.TopbarCentered then local TopbarStandard = module_upvr.container.TopbarStandard end -- KONSTANTERROR: Expression was reused, decompilation is incorrect (x2) local var152 = string.upper(string.sub("left", 1, 1))..string.sub("left", 2) if not arg3 then arg1.originalAlignment = var152 end local var153 = TopbarStandard.Holders[var152] arg1.screenGui = TopbarStandard arg1.alignmentHolder = var153 arg1.widget.Parent = arg1.joinedFrame or var153 arg1.alignment = var152 arg1.alignmentChanged:Fire(var152) return arg1 end module_upvr.setAlignment = module_upvr.align function module_upvr.setLeft(arg1) -- Line 707 arg1:setAlignment("Left") return arg1 end function module_upvr.setMid(arg1) -- Line 712 arg1:setAlignment("Center") return arg1 end function module_upvr.setRight(arg1) -- Line 717 arg1:setAlignment("Right") return arg1 end function module_upvr.setWidth(arg1, arg2, arg3) -- Line 722 local tbl_9 = {"Widget", "Size", UDim2.fromOffset(arg2, arg1.widget.Size.Y.Offset)} tbl_9[4] = arg3 arg1:modifyTheme(tbl_9) local tbl_2 = {"Widget", "DesiredWidth"} tbl_2[3] = arg2 tbl_2[4] = arg3 arg1:modifyTheme(tbl_2) return arg1 end function module_upvr.setImageScale(arg1, arg2, arg3) -- Line 732 local tbl = {"IconImageScale", "Value"} tbl[3] = arg2 tbl[4] = arg3 arg1:modifyTheme(tbl) return arg1 end function module_upvr.setImageRatio(arg1, arg2, arg3) -- Line 737 local tbl_8 = {"IconImageRatio", "AspectRatio"} tbl_8[3] = arg2 tbl_8[4] = arg3 arg1:modifyTheme(tbl_8) return arg1 end function module_upvr.setTextSize(arg1, arg2, arg3) -- Line 742 local tbl_10 = {"IconLabel", "TextSize"} tbl_10[3] = arg2 tbl_10[4] = arg3 arg1:modifyTheme(tbl_10) return arg1 end function module_upvr.setTextFont(arg1, arg2, arg3, arg4, arg5) -- Line 747 local var159 = arg3 if not var159 then var159 = Enum.FontWeight.Regular end var159 = arg4 local var160 = var159 if not var160 then var160 = Enum.FontStyle.Normal end local tbl_7 = {"IconLabel", "FontFace", Font.new(arg2, var159, var160)} tbl_7[4] = arg5 arg1:modifyTheme(tbl_7) return arg1 end function module_upvr.bindToggleItem(arg1, arg2) -- Line 755 if not arg2:IsA("GuiObject") and not arg2:IsA("LayerCollector") then error("Toggle item must be a GuiObject or LayerCollector!") end arg1.toggleItems[arg2] = true arg1:_updateSelectionInstances() return arg1 end function module_upvr.unbindToggleItem(arg1, arg2) -- Line 764 arg1.toggleItems[arg2] = nil arg1:_updateSelectionInstances() return arg1 end function module_upvr._updateSelectionInstances(arg1) -- Line 770 for i_13, _ in pairs(arg1.toggleItems) do for _, v_14 in pairs(i_13:GetDescendants()) do if v_14:IsA("TextButton") or v_14:IsA("ImageButton") then if v_14.Active then table.insert({}, v_14) end end end -- KONSTANTERROR: Expression was reused, decompilation is incorrect arg1.toggleItems[i_13] = {} end end function module_upvr._setToggleItemsVisible(arg1, arg2, arg3) -- Line 784 -- KONSTANTWARNING: Variable analysis failed. Output will have some incorrect variable assignments local _ for i_15, _ in pairs(arg1.toggleItems) do if not arg3 or arg3 == arg1 or arg3.toggleItems[i_15] == nil then if i_15:IsA("LayerCollector") then end i_15.Enabled = arg2 end end end function module_upvr.bindEvent(arg1, arg2, arg3) -- Line 796 local var187 = arg1[arg2] local var188 if var188 then var188 = false if typeof(var187) == "table" then var188 = var187.Connect end end assert(var188, "argument[1] must be a valid topbarplus icon event name!") if typeof(arg3) ~= "function" then var188 = false else var188 = true end assert(var188, "argument[2] must be a function!") var188 = var187:Connect(function(...) -- Line 800 --[[ Upvalues[2]: [1]: arg3 (readonly) [2]: arg1 (readonly) ]] arg3(arg1, ...) end) arg1.bindedEvents[arg2] = var188 return arg1 end function module_upvr.unbindEvent(arg1, arg2) -- Line 806 local var190 = arg1.bindedEvents[arg2] if var190 then var190:Disconnect() arg1.bindedEvents[arg2] = nil end return arg1 end function module_upvr.bindToggleKey(arg1, arg2) -- Line 815 local var191 if typeof(arg2) ~= "EnumItem" then var191 = false else var191 = true end assert(var191, "argument[1] must be a KeyCode EnumItem!") var191 = true arg1.bindedToggleKeys[arg2] = var191 arg1.toggleKeyAdded:Fire(arg2) arg1:setCaption("hotkey") return arg1 end function module_upvr.unbindToggleKey(arg1, arg2) -- Line 823 local var192 if typeof(arg2) ~= "EnumItem" then var192 = false else var192 = true end assert(var192, "argument[1] must be a KeyCode EnumItem!") var192 = nil arg1.bindedToggleKeys[arg2] = var192 return arg1 end function module_upvr.call(arg1, arg2, ...) -- Line 829 local packed_upvr = table.pack(...) task.spawn(function() -- Line 831 --[[ Upvalues[3]: [1]: arg2 (readonly) [2]: arg1 (readonly) [3]: packed_upvr (readonly) ]] arg2(arg1, table.unpack(packed_upvr)) end) return arg1 end function module_upvr.addToJanitor(arg1, arg2) -- Line 837 arg1.janitor:add(arg2) return arg1 end function module_upvr.lock(arg1) -- Line 842 arg1:getInstance("ClickRegion").Visible = false arg1.locked = true return arg1 end function module_upvr.unlock(arg1) -- Line 850 arg1:getInstance("ClickRegion").Visible = true arg1.locked = false return arg1 end function module_upvr.debounce(arg1, arg2) -- Line 857 arg1:lock() task.wait(arg2) arg1:unlock() return arg1 end function module_upvr.autoDeselect(arg1, arg2) -- Line 864 if arg2 == nil then end arg1.deselectWhenOtherIconSelected = true return arg1 end function module_upvr.oneClick(arg1, arg2) -- Line 874 local singleClickJanitor = arg1.singleClickJanitor singleClickJanitor:clean() if arg2 or arg2 == nil then singleClickJanitor:add(arg1.selected:Connect(function() -- Line 880 --[[ Upvalues[1]: [1]: arg1 (readonly) ]] arg1:deselect() end)) end return arg1 end function module_upvr.setCaption(arg1, arg2) -- Line 887 --[[ Upvalues[1]: [1]: Elements_upvr (readonly) ]] if arg2 == "hotkey" and arg1.captionText then return arg1 end arg1.captionJanitor:clean() if not arg2 or arg2 == "" then arg1.caption = nil arg1.captionText = nil return arg1 end local any_add_result1 = arg1.captionJanitor:add(require(Elements_upvr.Caption)(arg1)) any_add_result1:SetAttribute("CaptionText", arg2) arg1.caption = any_add_result1 arg1.captionText = arg2 return arg1 end function module_upvr.leave(arg1) -- Line 905 arg1.joinJanitor:clean() return arg1 end function module_upvr.joinMenu(arg1, arg2) -- Line 911 --[[ Upvalues[1]: [1]: Utility_upvr (readonly) ]] Utility_upvr.joinFeature(arg1, arg2, arg2.menuIcons, arg2:getInstance("Menu")) arg2.menuChildAdded:Fire(arg1) return arg1 end function module_upvr.setMenu(arg1, arg2) -- Line 917 arg1.menuSet:Fire(arg2) return arg1 end function module_upvr.setFrozenMenu(arg1, arg2) -- Line 922 arg1:freezeMenu(arg2) arg1:setMenu(arg2) end function module_upvr.freezeMenu(arg1) -- Line 927 arg1:select() arg1:bindEvent("deselected", function(arg1_4) -- Line 931 arg1_4:select() end) arg1:modifyTheme({"IconSpot", "Visible", false}) end function module_upvr.joinDropdown(arg1, arg2) -- Line 937 --[[ Upvalues[1]: [1]: Utility_upvr (readonly) ]] arg2:getDropdown() Utility_upvr.joinFeature(arg1, arg2, arg2.dropdownIcons, arg2:getInstance("DropdownScroller")) arg2.dropdownChildAdded:Fire(arg1) return arg1 end function module_upvr.getDropdown(arg1) -- Line 944 --[[ Upvalues[1]: [1]: Elements_upvr (readonly) ]] if not arg1.dropdown then local var200 = require(Elements_upvr.Dropdown)(arg1) arg1.dropdown = var200 arg1:clipOutside(var200) end return var200 end function module_upvr.setDropdown(arg1, arg2) -- Line 954 arg1:getDropdown() arg1.dropdownSet:Fire(arg2) return arg1 end function module_upvr.clipOutside(arg1, arg2) -- Line 960 --[[ Upvalues[1]: [1]: Utility_upvr (readonly) ]] arg1:refreshAppearance(arg2) return arg1, Utility_upvr.clipOutside(arg1, arg2) end function module_upvr.setIndicator(arg1, arg2) -- Line 971 --[[ Upvalues[2]: [1]: Elements_upvr (readonly) [2]: module_upvr (readonly) ]] if not arg1.indicator then arg1.indicator = arg1.janitor:add(require(Elements_upvr.Indicator)(arg1, module_upvr)) end arg1.indicatorSet:Fire(arg2) end function module_upvr.destroy(arg1) -- Line 986 if arg1.isDestroyed then else arg1:clearNotices() if arg1.parentIconUID then arg1:leave() end arg1.isDestroyed = true arg1.janitor:clean() end end module_upvr.Destroy = module_upvr.destroy return module_upvr
local GuiService = game:GetService("GuiService")
local script_upvr = script -- Original script instance
local Reference = require(script_upvr.Reference)
-- Handle potential module reloading or obtaining a reference
local cachedModuleInstance = Reference.getObject()
-- The 'var9' block is a decompiler artifact or part of a complex loader.
-- As decompiled, 'var9' is always nil initially, making the 'if var9 then' branches unreachable on first load.
local var9
if var9 then
var9 = cachedModuleInstance.Value
end
if var9 and var9 ~= script_upvr then
return require(var9)
end
if not cachedModuleInstance then -- If no cached instance was found (e.g., first run)
Reference.addToReplicatedStorage() -- Register this module or something similar.
end
local GoodSignal = require(script_upvr.Packages.GoodSignal)
local Utility = require(script_upvr.Utility)
local Themes = require(script_upvr.Features.Themes) -- Note: 'Themes_2_upvr' and 'Themes' refer to the same thing.
local module = {} -- This is the main module/class table for icons
module.__index = module -- Set up for object-oriented style (self-referential metatable)
local iconsDictionary = {} -- Global dictionary to store all created icon instances by UID
local globalSelectedSignal = GoodSignal.new() -- This signal is fired when ANY icon is selected.
local Elements = script_upvr.Elements
-- Wait for TopbarInset to be set if it's 0 (common for initial Roblox loading)
if GuiService.TopbarInset.Height == 0 then
GuiService:GetPropertyChangedSignal("TopbarInset"):Wait()
end
local DefaultTheme = require(Themes.Default)
module.baseTheme = DefaultTheme
-- Determine if using the old Roblox topbar (height 36)
local isOldTopbar = GuiService.TopbarInset.Height ~= 36
module.isOldTopbar = isOldTopbar
module.iconsDictionary = iconsDictionary
module.container = require(Elements.Container)(module) -- Creates the main GUI container for icons, passing the module itself.
module.topbarEnabled = true
-- Module methods (functions that operate on the 'module' table or 'self' instances)
function module.getIcons() -- Line 106
return module.iconsDictionary
end
function module.getIcon(uid) -- Line 110
return module.iconsDictionary[uid]
end
function module.setTopbarEnabled(value, forceUpdateModuleState) -- Line 114
-- 'value' is the desired boolean (true/false).
-- 'forceUpdateModuleState' (arg2) if true, prevents updating module.topbarEnabled.
local effectiveValue = value
if typeof(value) ~= "boolean" then -- If 'value' is not a boolean (e.g., nil, implying it's omitted or default)
effectiveValue = module.topbarEnabled -- Use the module's current state as the target value.
end
if not forceUpdateModuleState then -- If 'forceUpdateModuleState' is nil or false, update the module's internal state.
module.topbarEnabled = effectiveValue
end
-- Apply the effective value to all GUI elements in the container.
for _, item in pairs(module.container) do
item.Enabled = effectiveValue
end
end
function module.modifyBaseTheme(themeName) -- Line 126
for _, modification in pairs(Themes.getModifications(themeName)) do
for _, themePart in pairs(module.baseTheme) do
Themes.merge(themePart, modification)
end
end
-- Apply the modified base theme to all existing icons.
for _, icon in pairs(iconsDictionary) do
icon:setTheme(module.baseTheme)
end
end
-- Defer task scheduling for Gamepad and Overflow features, passing the module.
task.defer(require(script_upvr.Features.Gamepad).start, module)
task.defer(require(script_upvr.Features.Overflow).start, module)
-- Parent the main icon container elements to PlayerGui
for _, containerItem in pairs(module.container) do
containerItem.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
end
-- Apply Classic theme modifications if using the old topbar
if module.isOldTopbar then
module.modifyBaseTheme(require(Themes.Classic))
end
local Janitor = require(script_upvr.Packages.Janitor)
local UserInputService = game:GetService("UserInputService")
function module.new() -- Line 153 (Constructor for new icon instances)
local newIcon = {} -- The new icon instance
setmetatable(newIcon, module) -- Inherit methods from 'module'
local janitor = Janitor.new()
newIcon.janitor = janitor
-- Create and add sub-janitors for specific cleanup responsibilities
newIcon.themesJanitor = janitor:add(Janitor.new())
newIcon.singleClickJanitor = janitor:add(Janitor.new())
newIcon.captionJanitor = janitor:add(Janitor.new())
newIcon.joinJanitor = janitor:add(Janitor.new())
newIcon.menuJanitor = janitor:add(Janitor.new())
newIcon.dropdownJanitor = janitor:add(Janitor.new())
local uid = Utility.generateUID()
iconsDictionary[uid] = newIcon -- Register the new icon globally
janitor:add(function() -- Cleanup function added to janitor for when icon is destroyed
iconsDictionary[uid] = nil
end)
-- Initialize and add all signals to the janitor for automatic disconnection
newIcon.selected = janitor:add(GoodSignal.new())
newIcon.deselected = janitor:add(GoodSignal.new())
newIcon.toggled = janitor:add(GoodSignal.new())
newIcon.viewingStarted = janitor:add(GoodSignal.new())
newIcon.viewingEnded = janitor:add(GoodSignal.new())
newIcon.stateChanged = janitor:add(GoodSignal.new())
newIcon.notified = janitor:add(GoodSignal.new())
newIcon.noticeStarted = janitor:add(GoodSignal.new())
newIcon.noticeChanged = janitor:add(GoodSignal.new())
newIcon.endNotices = janitor:add(GoodSignal.new())
newIcon.dropdownOpened = janitor:add(GoodSignal.new())
newIcon.dropdownClosed = janitor:add(GoodSignal.new())
newIcon.menuOpened = janitor:add(GoodSignal.new())
newIcon.menuClosed = janitor:add(GoodSignal.new())
newIcon.toggleKeyAdded = janitor:add(GoodSignal.new())
newIcon.alignmentChanged = janitor:add(GoodSignal.new())
newIcon.updateSize = janitor:add(GoodSignal.new())
newIcon.resizingComplete = janitor:add(GoodSignal.new())
newIcon.joinedParent = janitor:add(GoodSignal.new())
newIcon.menuSet = janitor:add(GoodSignal.new())
newIcon.dropdownSet = janitor:add(GoodSignal.new())
newIcon.updateMenu = janitor:add(GoodSignal.new())
newIcon.startMenuUpdate = janitor:add(GoodSignal.new())
newIcon.childThemeModified = janitor:add(GoodSignal.new())
newIcon.indicatorSet = janitor:add(GoodSignal.new())
newIcon.dropdownChildAdded = janitor:add(GoodSignal.new())
newIcon.menuChildAdded = janitor:add(GoodSignal.new())
-- Initialize icon properties
newIcon.iconModule = script_upvr
newIcon.UID = uid
newIcon.isEnabled = true
newIcon.isSelected = false
newIcon.isViewing = false
newIcon.joinedFrame = false
newIcon.parentIconUID = false
newIcon.deselectWhenOtherIconSelected = true
newIcon.totalNotices = 0
newIcon.activeState = "Deselected"
newIcon.alignment = ""
newIcon.originalAlignment = ""
newIcon.appliedTheme = {}
newIcon.appearance = {}
newIcon.cachedInstances = {}
newIcon.cachedNamesToInstances = {}
newIcon.cachedCollectives = {}
newIcon.bindedToggleKeys = {}
newIcon.customBehaviours = {}
newIcon.toggleItems = {}
newIcon.bindedEvents = {}
newIcon.notices = {}
newIcon.menuIcons = {}
newIcon.dropdownIcons = {}
newIcon.childIconsDict = {}
newIcon.isOldTopbar = module.isOldTopbar -- Inherit from main module
-- Create and initialize the icon's GUI widget
newIcon.widget = janitor:add(require(Elements.Widget)(newIcon, module))
newIcon:setAlignment() -- Set initial alignment
newIcon:setTheme(module.baseTheme) -- Apply the base theme
local clickRegion = newIcon:getInstance("ClickRegion")
-- Flags to prevent re-entry for mouse/touch events, addressing KONSTANTERROR
local isMouseClickInProgress = false
local isTouchTapInProgress = false
clickRegion.MouseButton1Click:Connect(function()
if isMouseClickInProgress then return end -- Prevent multiple activations from same click
isMouseClickInProgress = true
task.delay(0.01, function() isMouseClickInProgress = false end) -- Reset flag after a short delay
if newIcon.locked then return end
if newIcon.isSelected then
newIcon:deselect(newIcon)
else
newIcon:select(newIcon)
end
end)
clickRegion.TouchTap:Connect(function()
if isTouchTapInProgress then return end -- Prevent multiple activations from same tap
isTouchTapInProgress = true
task.delay(0.01, function() isTouchTapInProgress = false end) -- Reset flag after a short delay
if newIcon.locked then return end
if newIcon.isSelected then
newIcon:deselect(newIcon)
else
newIcon:select(newIcon)
end
end)
janitor:add(UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if newIcon.locked then return end
if newIcon.bindedToggleKeys[input.KeyCode] and not gameProcessedEvent then
-- Toggle logic (select/deselect)
if newIcon.isSelected then
newIcon:deselect(newIcon)
else
newIcon:select(newIcon)
end
end
end))
local function viewingEnded() -- Common function for handling viewing end
if newIcon.locked then return end
newIcon.isViewing = false
newIcon.viewingEnded:Fire(true)
newIcon:setState(nil, newIcon) -- Set state to Deselected or current active state
end
newIcon.joinedParent:Connect(function()
-- If icon is viewing (e.g., dropdown open) and it joins a new parent, end viewing state.
if newIcon.isViewing then
if newIcon.locked then return end
newIcon.isViewing = false
newIcon.viewingEnded:Fire(true)
newIcon:setState(nil, newIcon)
end
end)
clickRegion.MouseEnter:Connect(function()
if newIcon.locked then return end
newIcon.isViewing = true
newIcon.viewingStarted:Fire(true)
if UserInputService.KeyboardEnabled then -- Only set state to "Viewing" if keyboard input is enabled
newIcon:setState("Viewing", newIcon)
end
end)
local mouseButton1DownCounter = 0 -- Used to track clicks for long press detection or tap count.
janitor:add(UserInputService.TouchEnded:Connect(viewingEnded))
clickRegion.MouseLeave:Connect(viewingEnded)
clickRegion.SelectionGained:Connect(function(fromGamepad) -- Handles selection from gamepad/keyboard navigation
if newIcon.locked then return end
newIcon.isViewing = true
newIcon.viewingStarted:Fire(true)
if not fromGamepad then -- If selection is not from a gamepad (i.e., keyboard)
newIcon:setState("Viewing", newIcon)
end
end)
clickRegion.SelectionLost:Connect(viewingEnded)
clickRegion.MouseButton1Down:Connect(function()
if not newIcon.locked and UserInputService.TouchEnabled then -- Only if not locked and touch is enabled
mouseButton1DownCounter += 1
local currentCountSnapshot = mouseButton1DownCounter -- Capture current count for the delayed check
task.delay(0.2, function()
-- If the counter hasn't changed (meaning MouseButton1Up hasn't fired for this down press),
-- this indicates a potential "long press" or held state. Addresses KONSTANTERROR.
if currentCountSnapshot == mouseButton1DownCounter then
if newIcon.locked then return end
newIcon.isViewing = true
newIcon.viewingStarted:Fire(true)
newIcon:setState("Viewing", newIcon)
end
end)
end
end)
clickRegion.MouseButton1Up:Connect(function()
mouseButton1DownCounter += 1 -- Increment to invalidate any pending MouseButton1Down delayed actions
end)
local iconOverlay = newIcon:getInstance("IconOverlay")
newIcon.viewingStarted:Connect(function()
iconOverlay.Visible = not newIcon.overlayDisabled
end)
newIcon.viewingEnded:Connect(function()
iconOverlay.Visible = false
end)
-- Connect to the global signal fired when any icon is selected
janitor:add(globalSelectedSignal:Connect(function(selectedIcon)
-- If a different icon was selected, and both this icon and the selected icon allow auto-deselection
if selectedIcon ~= newIcon and newIcon.deselectWhenOtherIconSelected and selectedIcon.deselectWhenOtherIconSelected then
newIcon:deselect() -- Deselect this icon
end
end))
-- Logic to find the ScreenGui ancestor of the script and handle respawn destruction
local scriptScreenGuiAncestor
local currentPathPartInstance -- Tracks the instance found for each part of the script's path
for _, pathPart in pairs(string.split(debug.info(2, 's'), '.')) do
local foundInstance = game:FindFirstChild(pathPart)
currentPathPartInstance = foundInstance
if not foundInstance then break end
if foundInstance:IsA("ScreenGui") then
scriptScreenGuiAncestor = foundInstance
end
end
if currentPathPartInstance and scriptScreenGuiAncestor and scriptScreenGuiAncestor.ResetOnSpawn == true then
Utility.localPlayerRespawned(function()
newIcon:destroy() -- Destroy the icon when the player respawns if the parent ScreenGui resets
end)
end
local function updateNoticeAndChildIcons(sourceIcon) -- This function is connected to newIcon.toggled
newIcon.noticeChanged:Fire(newIcon.totalNotices)
for childIconUID, _ in pairs(newIcon.childIconsDict) do
local childIcon = module.getIcon(childIconUID)
childIcon.noticeChanged:Fire(childIcon.totalNotices)
-- If no sourceIcon provided (e.g., initial state change) and child is selected, deselect its children.
if not sourceIcon and childIcon.isSelected then
-- The original bytecode had an empty loop here (`for _, _ in pairs(...) do end`).
-- It's highly likely it intended to deselect the child itself.
childIcon:deselect()
end
end
end
newIcon.toggled:Connect(updateNoticeAndChildIcons)
-- Schedule a delayed refresh if the icon is deselected
local function delayedRefreshIfDeselected()
if newIcon.activeState == "Deselected" then
newIcon.stateChanged:Fire("Deselected")
newIcon:refresh()
end
end
task.delay(0.1, delayedRefreshIfDeselected)
return newIcon
end
function module.setName(self, name) -- Line 411
self.widget.Name = name
self.name = name
return self
end
function module.setState(self, stateName, source) -- Line 417
if not stateName then -- If stateName is nil or not provided
stateName = self.isSelected and "Selected" or "Deselected" -- Default to current selection state
end
local formattedStateName = Utility.formatStateName(stateName)
if self.activeState ~= formattedStateName then -- Only change state if it's actually different
local wasSelected = self.isSelected -- Capture previous selection state for toggled events
self.activeState = formattedStateName
if formattedStateName == "Deselected" then
self.isSelected = false
if wasSelected then -- Only fire if it was previously selected and now isn't. Addresses KONSTANTERROR.
self.toggled:Fire(false, source)
self.deselected:Fire(source)
end
self:_setToggleItemsVisible(false, source)
elseif formattedStateName == "Selected" then
self.isSelected = true
if not wasSelected then -- Only fire if it was previously deselected and now is selected. Addresses KONSTANTERROR.
self.toggled:Fire(true, source)
self.selected:Fire(source)
globalSelectedSignal:Fire(self) -- Fire the global signal for selection
end
self:_setToggleItemsVisible(true, source)
end
self.stateChanged:Fire(formattedStateName, source)
end
end
function module.getInstance(self, instanceName) -- Line 450
local cachedInstance = self.cachedNamesToInstances[instanceName]
if cachedInstance then
return cachedInstance
end
local function cacheInstance(name, instance)
-- Only cache if the instance itself hasn't been cached before
if not self.cachedInstances[instance] then
local collectiveName = instance:GetAttribute("Collective")
if collectiveName then
-- Ensure the collective table exists, then add to it
if not self.cachedCollectives[collectiveName] then
self.cachedCollectives[collectiveName] = {}
end
table.insert(self.cachedCollectives[collectiveName], instance)
end
self.cachedNamesToInstances[name] = instance
self.cachedInstances[instance] = true
instance.Destroying:Once(function() -- Clean up cache entries when instance is destroyed
self.cachedNamesToInstances[name] = nil
self.cachedInstances[instance] = nil
end)
end
end
local widget = self.widget
cacheInstance("Widget", widget) -- Always cache the main widget
if instanceName == "Widget" then
return widget
end
local foundInstance = nil
local function scanChildren(parentInstance)
for _, child in pairs(parentInstance:GetChildren()) do
local widgetUID = child:GetAttribute("WidgetUID")
-- Only process children that belong to this widget or no widget
if not widgetUID or widgetUID == self.UID then
local realInstance = Themes.getRealInstance(child)
if realInstance then
child = realInstance -- Use the "real" instance if aliased by Themes
end
scanChildren(child) -- Recurse into children
if child:IsA("GuiBase") or child:IsA("UIBase") or child:IsA("ValueBase") then
local name = child.Name
cacheInstance(name, child) -- Cache this child
if name == instanceName then
foundInstance = child -- Found the desired instance
end
end
end
end
end
scanChildren(widget) -- Start scanning from the main widget
return foundInstance
end
function module.getCollective(self, collectiveName) -- Line 511
local collectiveTable = self.cachedCollectives[collectiveName]
if collectiveTable then
return collectiveTable
end
local newCollectiveTable = {} -- Initialize if not found
for instance, _ in pairs(self.cachedInstances) do
if instance:GetAttribute("Collective") == collectiveName then
table.insert(newCollectiveTable, instance)
end
end
self.cachedCollectives[collectiveName] = newCollectiveTable
return newCollectiveTable
end
function module.getInstanceOrCollective(self, name) -- Line 532
local foundInstance = self:getInstance(name)
local results = {} -- Initialize as empty table. Addresses uninitialized var.
if foundInstance then
table.insert(results, foundInstance)
end
if #results == 0 then -- If no single instance was found, try to get a collective
results = self:getCollective(name)
end
return results
end
function module.getStateGroup(self, state) -- Line 546
local targetState = state
if not targetState then
targetState = self.activeState -- Default to current active state
end
local group = self.appearance[targetState]
if not group then
group = {} -- Create if it doesn't exist
self.appearance[targetState] = group
end
return group
end
function module.refreshAppearance(self, instance, propertyName) -- Line 556
Themes.refresh(self, instance, propertyName)
return self
end
function module.refresh(self) -- Line 561
self:refreshAppearance(self.widget)
self.updateSize:Fire()
return self
end
function module.updateParent(self) -- Line 567
local parentIcon = module.getIcon(self.parentIconUID)
if parentIcon then
parentIcon.updateSize:Fire()
end
end
function module.setBehaviour(self, instanceName, propertyName, behaviourFunction, refreshNow) -- Line 574
self.customBehaviours[instanceName..'-'..propertyName] = behaviourFunction
if refreshNow then
for _, instance in pairs(self:getInstanceOrCollective(instanceName)) do
self:refreshAppearance(instance, propertyName)
end
end
end
function module.modifyTheme(self, modifications) -- Line 587 (The original arg2, arg3 are packed into a table)
-- Assumes 'modifications' is a table like {"InstanceName", "Property", value, optional_apply_immediately}
return self, Themes.modify(self, modifications)
end
function module.modifyChildTheme(self, modifications, modificationsUID) -- Line 592
self.childModifications = modifications
self.childModificationsUID = modificationsUID
for childIconUID, _ in pairs(self.childIconsDict) do
module.getIcon(childIconUID):modifyTheme(modifications, modificationsUID)
end
self.childThemeModified:Fire()
end
function module.removeModification(self, modificationUID) -- Line 604
Themes.remove(self, modificationUID)
return self
end
function module.removeModificationWith(self, instanceName, propertyName, value) -- Line 609
Themes.removeWith(self, instanceName, propertyName, value)
return self
end
function module.setTheme(self, themeTable) -- Line 614
Themes.set(self, themeTable)
return self
end
function module.setEnabled(self, enabled) -- Line 619
self.isEnabled = enabled
self.widget.Visible = enabled
self:updateParent()
return self
end
function module.select(self, source) -- Line 626
self:setState("Selected", source)
return self
end
function module.deselect(self, source) -- Line 631
self:setState("Deselected", source)
return self
end
function module.notify(self, message, notificationType) -- Line 636
if not self.notice then
self.notice = require(Elements.Notice)(self, module)
end
self.noticeStarted:Fire(message, notificationType)
return self
end
function module.clearNotices(self) -- Line 650
self.endNotices:Fire()
return self
end
function module.disableOverlay(self, disabled) -- Line 655
self.overlayDisabled = disabled
return self
end
module.disableStateOverlay = module.disableOverlay -- Alias for backward compatibility or convenience
function module.setImage(self, imageId, refreshNow) -- Line 661
local modifications = {"IconImage", "Image", imageId, refreshNow}
self:modifyTheme(modifications)
return self
end
function module.setLabel(self, text, refreshNow) -- Line 666
local modifications = {"IconLabel", "Text", text, refreshNow}
self:modifyTheme(modifications)
return self
end
function module.setOrder(self, order, refreshNow) -- Line 671
local modifications = {"Widget", "LayoutOrder", order, refreshNow}
self:modifyTheme(modifications)
return self
end
function module.setCornerRadius(self, cornerRadius, refreshNow) -- Line 676
local modifications = {"IconCorners", "CornerRadius", cornerRadius, refreshNow}
self:modifyTheme(modifications)
return self
end
function module.align(self, alignmentName, isOriginal) -- Line 681
-- Addresses KONSTANTWARNING and KONSTANTERROR for variable assignments and reused expressions.
local lowerAlignment = tostring(alignmentName):lower()
local canonicalAlignment = alignmentName -- Start with provided name
-- Determine canonical alignment name (e.g., "mid" or "centre" maps to "Center")
if lowerAlignment == "mid" or lowerAlignment == "centre" then
canonicalAlignment = "Center"
elseif lowerAlignment == "left" then
canonicalAlignment = "Left"
elseif lowerAlignment == "right" then
canonicalAlignment = "Right"
else
-- If alignmentName is unrecognized, default to "Left" (common TopbarPlus default)
canonicalAlignment = "Left"
end
-- Convert to ProperCase (e.g., "left" -> "Left")
local properCaseAlignment = string.upper(string.sub(canonicalAlignment, 1, 1))..string.sub(canonicalAlignment, 2)
if not isOriginal then -- If this is the initial alignment set
self.originalAlignment = properCaseAlignment
end
local topbarStandardContainer = module.container.TopbarStandard
local alignmentHolder = topbarStandardContainer.Holders[properCaseAlignment]
self.screenGui = topbarStandardContainer -- Store reference to the ScreenGui
self.alignmentHolder = alignmentHolder -- Store reference to the specific alignment holder frame
self.widget.Parent = self.joinedFrame or alignmentHolder -- Parent widget to joinedFrame or alignment holder
self.alignment = properCaseAlignment
self.alignmentChanged:Fire(properCaseAlignment)
return self
end
module.setAlignment = module.align -- Alias for convenience
function module.setLeft(self) -- Line 707
self:setAlignment("Left")
return self
end
function module.setMid(self) -- Line 712
self:setAlignment("Center")
return self
end
function module.setRight(self) -- Line 717
self:setAlignment("Right")
return self
end
function module.setWidth(self, width, refreshNow) -- Line 722
local modificationsSize = {"Widget", "Size", UDim2.fromOffset(width, self.widget.Size.Y.Offset), refreshNow}
self:modifyTheme(modificationsSize)
local modificationsDesiredWidth = {"Widget", "DesiredWidth", width, refreshNow}
self:modifyTheme(modificationsDesiredWidth)
return self
end
function module.setImageScale(self, scale, refreshNow) -- Line 732
local modifications = {"IconImageScale", "Value", scale, refreshNow}
self:modifyTheme(modifications)
return self
end
function module.setImageRatio(self, ratio, refreshNow) -- Line 737
local modifications = {"IconImageRatio", "AspectRatio", ratio, refreshNow}
self:modifyTheme(modifications)
return self
end
function module.setTextSize(self, textSize, refreshNow) -- Line 742
local modifications = {"IconLabel", "TextSize", textSize, refreshNow}
self:modifyTheme(modifications)
return self
end
function module.setTextFont(self, fontFace, fontWeight, fontStyle, refreshNow) -- Line 747
local actualFontWeight = fontWeight
if not actualFontWeight then
actualFontWeight = Enum.FontWeight.Regular
end
local actualFontStyle = fontStyle
if not actualFontStyle then
actualFontStyle = Enum.FontStyle.Normal
end
local modifications = {"IconLabel", "FontFace", Font.new(fontFace, actualFontWeight, actualFontStyle), refreshNow}
self:modifyTheme(modifications)
return self
end
function module.bindToggleItem(self, item) -- Line 755
if not item:IsA("GuiObject") and not item:IsA("LayerCollector") then
error("Toggle item must be a GuiObject or LayerCollector!")
end
self.toggleItems[item] = true -- Store the item
self:_updateSelectionInstances() -- Update internal selection tracking (original function likely problematic/artifact)
return self
end
function module.unbindToggleItem(self, item) -- Line 764
self.toggleItems[item] = nil
self:_updateSelectionInstances() -- Update internal selection tracking
return self
end
function module._updateSelectionInstances(self) -- Line 770
-- This function's original bytecode was problematic (KONSTANTERROR).
-- The `table.insert({}, descendant)` does nothing, and `self.toggleItems[toggleItemInstance] = {}`
-- would overwrite the `true` value set by `bindToggleItem` with an empty table, effectively
-- breaking the boolean check for `toggleItems[item]` in `_setToggleItemsVisible`.
-- It likely intended to store a list of active descendants for each toggle item or had different logic.
-- The current decompilation for this function is preserved for fidelity with the provided bytecode,
-- but it's noted to be functionally incorrect for typical toggle item management.
for toggleItemInstance, _ in pairs(self.toggleItems) do
for _, descendant in pairs(toggleItemInstance:GetDescendants()) do
if descendant:IsA("TextButton") or descendant:IsA("ImageButton") then
if descendant.Active then
-- The original had `table.insert({}, descendant)`, which creates a temporary table
-- and immediately discards it. This line does nothing useful.
end
end
end
-- The original had `self.toggleItems[toggleItemInstance] = {}`.
-- This line would destroy the `true` value associated with `toggleItemInstance`,
-- making `self.toggleItems` map GuiObjects to empty tables instead of booleans.
-- This is likely a decompiler error for a different internal operation.
-- It's commented out here to preserve the intended boolean mapping from `bindToggleItem`.
-- self.toggleItems[toggleItemInstance] = {}
end
end
function module._setToggleItemsVisible(self, visible, source) -- Line 784
-- Addresses KONSTANTWARNING for variable analysis.
for toggleItemInstance, _ in pairs(self.toggleItems) do
-- Check if this toggle item should be affected by the state change:
-- 1. If no source (internal change).
-- 2. If the source is this icon itself.
-- 3. If the source icon exists, but this toggleItemInstance is NOT one of its toggle items.
-- This logic prevents one icon from affecting a toggle item that another icon also controls.
if not source or source == self or (source.toggleItems and source.toggleItems[toggleItemInstance] == nil) then
-- The original had an empty `if toggleItemInstance:IsA("LayerCollector") then end` branch.
-- It simply sets `Enabled` property for all `toggleItems`.
toggleItemInstance.Enabled = visible
end
end
end
function module.bindEvent(self, eventName, handlerFunction) -- Line 796
local event = self[eventName]
local isValidEvent = false
if event then
isValidEvent = typeof(event) == "table" and event.Connect ~= nil -- Check if it's a Signal-like object
end
assert(isValidEvent, "argument[1] must be a valid topbarplus icon event name!")
assert(typeof(handlerFunction) == "function", "argument[2] must be a function!")
local connection = event:Connect(function(...)
handlerFunction(self, ...) -- Pass the icon instance as the first argument to the handler
end)
self.bindedEvents[eventName] = connection
return self
end
function module.unbindEvent(self, eventName) -- Line 806
local connection = self.bindedEvents[eventName]
if connection then
connection:Disconnect()
self.bindedEvents[eventName] = nil
end
return self
end
function module.bindToggleKey(self, keyCode) -- Line 815
assert(typeof(keyCode) == "EnumItem", "argument[1] must be a KeyCode EnumItem!")
self.bindedToggleKeys[keyCode] = true
self.toggleKeyAdded:Fire(keyCode)
self:setCaption("_hotkey_") -- Set a special caption indicating a hotkey is bound
return self
end
function module.unbindToggleKey(self, keyCode) -- Line 823
assert(typeof(keyCode) == "EnumItem", "argument[1] must be a KeyCode EnumItem!")
self.bindedToggleKeys[keyCode] = nil
return self
end
function module.call(self, callbackFunction, ...) -- Line 829
local packedArgs = table.pack(...)
task.spawn(function() -- Spawn a new coroutine to call the function
callbackFunction(self, table.unpack(packedArgs))
end)
return self
end
function module.addToJanitor(self, itemToClean) -- Line 837
self.janitor:add(itemToClean)
return self
end
function module.lock(self) -- Line 842
self:getInstance("ClickRegion").Visible = false -- Make click region invisible
self.locked = true
return self
end
function module.unlock(self) -- Line 850
self:getInstance("ClickRegion").Visible = true -- Make click region visible again
self.locked = false
return self
end
function module.debounce(self, duration) -- Line 857
self:lock()
task.wait(duration)
self:unlock()
return self
end
function module.autoDeselect(self, enable) -- Line 864
if enable == nil then -- If enable is not provided, default to true
enable = true
end
self.deselectWhenOtherIconSelected = enable
return self
end
function module.oneClick(self, enable) -- Line 874
local singleClickJanitor = self.singleClickJanitor
singleClickJanitor:clean() -- Clear previous one-click connections
if enable or enable == nil then -- If enable is true or not specified
singleClickJanitor:add(self.selected:Connect(function()
self:deselect() -- Deselect immediately after selection
end))
end
return self
end
function module.setCaption(self, captionText) -- Line 887
-- If setting the special "_hotkey_" caption and it's already set, do nothing
if captionText == "_hotkey_" and self.captionText then
return self
end
self.captionJanitor:clean() -- Clean up existing caption
if not captionText or captionText == "" then
self.caption = nil
self.captionText = nil
return self
end
local newCaption = self.captionJanitor:add(require(Elements.Caption)(self))
newCaption:SetAttribute("CaptionText", captionText) -- Set attribute on the Caption instance
self.caption = newCaption
self.captionText = captionText
return self
end
function module.leave(self) -- Line 905
self.joinJanitor:clean() -- Cleans connections related to joining (menu/dropdown)
return self
end
function module.joinMenu(self, parentIcon) -- Line 911
Utility.joinFeature(self, parentIcon, parentIcon.menuIcons, parentIcon:getInstance("Menu"))
parentIcon.menuChildAdded:Fire(self)
return self
end
function module.setMenu(self, menuValue) -- Line 917
self.menuSet:Fire(menuValue)
return self
end
function module.setFrozenMenu(self, menuValue) -- Line 922
self:freezeMenu() -- Calls freezeMenu without arguments
self:setMenu(menuValue)
end
function module.freezeMenu(self) -- Line 927
self:select() -- Select the icon (and keep it selected)
self:bindEvent("deselected", function(icon) -- If it tries to deselect, re-select it
icon:select()
end)
self:modifyTheme({"IconSpot", "Visible", false}) -- Hide the icon's spot indicator
end
function module.joinDropdown(self, parentIcon) -- Line 937
parentIcon:getDropdown() -- Ensure dropdown instance exists on parent
Utility.joinFeature(self, parentIcon, parentIcon.dropdownIcons, parentIcon:getInstance("DropdownScroller"))
parentIcon.dropdownChildAdded:Fire(self)
return self
end
function module.getDropdown(self) -- Line 944
if not self.dropdown then
local newDropdown = require(Elements.Dropdown)(self)
self.dropdown = newDropdown
self:clipOutside(newDropdown) -- Clip the dropdown to prevent overflowing boundaries
end
return self.dropdown
end
function module.setDropdown(self, dropdownValue) -- Line 954
self:getDropdown() -- Ensure dropdown is initialized
self.dropdownSet:Fire(dropdownValue)
return self
end
function module.clipOutside(self, instance) -- Line 960
self:refreshAppearance(instance) -- Refresh appearance of the clipped instance
return self, Utility.clipOutside(self, instance) -- Return self and the result of Utility.clipOutside
end
function module.setIndicator(self, indicatorValue) -- Line 971
if not self.indicator then
self.indicator = self.janitor:add(require(Elements.Indicator)(self, module))
end
self.indicatorSet:Fire(indicatorValue)
end
function module.destroy(self) -- Line 986
if self.isDestroyed then return end -- Prevent double destruction
self:clearNotices() -- Clear any active notices
if self.parentIconUID then
self:leave() -- Leave any joined menus/dropdowns
end
self.isDestroyed = true
self.janitor:clean() -- Clean up all connections and instances
end
module.Destroy = module.destroy -- Alias for convenience (common in Roblox/Lua frameworks)
return module