Guest

Untitled 984

Mar 31st, 2026
23
0
Never
Not a member of GistPad yet? Sign Up, it unlocks many cool features!
None 102.51 KB | None | 0 0
  1. -- Advanced Roblox Luau GUI Library for Executors
  2. -- Made by Soldo / Discord: Soldo_io
  3. -- Created with modern animations and comprehensive components
  4. -- IMPORTANT: DO NOT call GuiLibrary:CreateTab(window, "Settings") in your example script!
  5. -- The hidden Settings tab is created automatically.
  6.  
  7. local GuiLibrary = {}
  8. local TweenService = game:GetService("TweenService")
  9. local UserInputService = game:GetService("UserInputService")
  10. local RunService = game:GetService("RunService")
  11. local HttpService = game:GetService("HttpService")
  12.  
  13. -- Animation settings
  14. local ANIM_TIME = 0.3
  15. local EASING_STYLE = Enum.EasingStyle.Quart
  16. local EASING_DIRECTION = Enum.EasingDirection.Out
  17.  
  18. -- Initial Color scheme
  19. local COLORS = {
  20. PRIMARY = Color3.fromRGB(45, 45, 55),
  21. SECONDARY = Color3.fromRGB(35, 35, 45),
  22. ACCENT = Color3.fromRGB(100, 100, 255),
  23. SUCCESS = Color3.fromRGB(75, 181, 67),
  24. WARNING = Color3.fromRGB(255, 193, 7),
  25. DANGER = Color3.fromRGB(220, 53, 69),
  26. TEXT = Color3.fromRGB(220, 220, 220),
  27. TEXT_MUTED = Color3.fromRGB(160, 160, 160),
  28. BORDER = Color3.fromRGB(60, 60, 70),
  29. HOVER = Color3.fromRGB(55, 55, 65)
  30. }
  31.  
  32. -- Theme configurations
  33. local themes = {
  34. Dark = { PRIMARY = Color3.fromRGB(45, 45, 55), SECONDARY = Color3.fromRGB(35, 35, 45), ACCENT = Color3.fromRGB(100, 100, 255), SUCCESS = Color3.fromRGB(75, 181, 67), WARNING = Color3.fromRGB(255, 193, 7), DANGER = Color3.fromRGB(220, 53, 69), TEXT = Color3.fromRGB(220, 220, 220), TEXT_MUTED = Color3.fromRGB(160, 160, 160), BORDER = Color3.fromRGB(60, 60, 70), HOVER = Color3.fromRGB(55, 55, 65) },
  35. Light = { PRIMARY = Color3.fromRGB(230, 230, 240), SECONDARY = Color3.fromRGB(245, 245, 250), ACCENT = Color3.fromRGB(50, 100, 200), SUCCESS = Color3.fromRGB(50, 150, 50), WARNING = Color3.fromRGB(200, 150, 0), DANGER = Color3.fromRGB(200, 50, 50), TEXT = Color3.fromRGB(40, 40, 50), TEXT_MUTED = Color3.fromRGB(100, 100, 120), BORDER = Color3.fromRGB(200, 200, 210), HOVER = Color3.fromRGB(220, 220, 230) },
  36. Midnight = { PRIMARY = Color3.fromRGB(20, 20, 30), SECONDARY = Color3.fromRGB(15, 15, 25), ACCENT = Color3.fromRGB(80, 80, 150), SUCCESS = Color3.fromRGB(60, 150, 60), WARNING = Color3.fromRGB(200, 150, 0), DANGER = Color3.fromRGB(180, 40, 40), TEXT = Color3.fromRGB(200, 200, 210), TEXT_MUTED = Color3.fromRGB(140, 140, 160), BORDER = Color3.fromRGB(40, 40, 50), HOVER = Color3.fromRGB(30, 30, 40) },
  37. Forest = { PRIMARY = Color3.fromRGB(30, 40, 30), SECONDARY = Color3.fromRGB(25, 35, 25), ACCENT = Color3.fromRGB(50, 120, 50), SUCCESS = Color3.fromRGB(60, 150, 60), WARNING = Color3.fromRGB(150, 120, 0), DANGER = Color3.fromRGB(150, 50, 50), TEXT = Color3.fromRGB(220, 230, 220), TEXT_MUTED = Color3.fromRGB(160, 180, 160), BORDER = Color3.fromRGB(40, 50, 40), HOVER = Color3.fromRGB(35, 45, 35) },
  38. Ocean = { PRIMARY = Color3.fromRGB(30, 40, 50), SECONDARY = Color3.fromRGB(25, 35, 45), ACCENT = Color3.fromRGB(0, 100, 150), SUCCESS = Color3.fromRGB(50, 150, 100), WARNING = Color3.fromRGB(150, 120, 0), DANGER = Color3.fromRGB(150, 50, 50), TEXT = Color3.fromRGB(220, 230, 240), TEXT_MUTED = Color3.fromRGB(160, 180, 200), BORDER = Color3.fromRGB(40, 50, 60), HOVER = Color3.fromRGB(35, 45, 55) }
  39. }
  40.  
  41. -- Auto Save System
  42. local AUTO_SAVE_FOLDER = "GuiLibrary_AutoSaves"
  43. local autoSaveEnabled = false
  44. local currentPlaceId = tostring(game.PlaceId)
  45.  
  46. local function ensureAutoSaveFolder()
  47. pcall(function() if not isfolder(AUTO_SAVE_FOLDER) then makefolder(AUTO_SAVE_FOLDER) end end)
  48. end
  49.  
  50. local function getAutoSavePath()
  51. return AUTO_SAVE_FOLDER .. "/" .. currentPlaceId .. ".json"
  52. end
  53.  
  54. print("DEBUG: GuiLibrary loaded - Soldo_io")
  55.  
  56. local function createTween(object, properties, time)
  57. time = time or ANIM_TIME
  58. local tweenInfo = TweenInfo.new(time, EASING_STYLE, EASING_DIRECTION)
  59. local tween = TweenService:Create(object, tweenInfo, properties)
  60. tween:Play()
  61. return tween
  62. end
  63.  
  64. local function createCorner(parent, radius)
  65. local corner = Instance.new("UICorner")
  66. corner.CornerRadius = UDim.new(0, radius or 8)
  67. corner.Parent = parent
  68. return corner
  69. end
  70.  
  71. local function createStroke(parent, thickness, color)
  72. local stroke = Instance.new("UIStroke")
  73. stroke.Thickness = thickness or 1
  74. stroke.Color = color or COLORS.BORDER
  75. stroke.Parent = parent
  76. return stroke
  77. end
  78.  
  79. local function updateElementColors(window)
  80. print("DEBUG: updateElementColors called")
  81. if window.MainFrame then
  82. createTween(window.MainFrame, {BackgroundColor3 = COLORS.PRIMARY})
  83. local uiStroke = window.MainFrame:FindFirstChild("UIStroke")
  84. if uiStroke then createTween(uiStroke, {Color = COLORS.BORDER}) end
  85. end
  86.  
  87. local titleBar = window.MainFrame and window.MainFrame:FindFirstChild("TitleBar")
  88. if titleBar then
  89. createTween(titleBar, {BackgroundColor3 = COLORS.SECONDARY})
  90. local titleLabel = titleBar:FindFirstChild("TitleLabel")
  91. if titleLabel then createTween(titleLabel, {TextColor3 = COLORS.TEXT}) end
  92. local fpsLabel = titleBar:FindFirstChild("FPSLabel")
  93. if fpsLabel then createTween(fpsLabel, {BackgroundColor3 = COLORS.PRIMARY}) end
  94. local settingsButton = titleBar:FindFirstChild("SettingsButton")
  95. if settingsButton then createTween(settingsButton, {TextColor3 = COLORS.TEXT}) end
  96. local closeButton = titleBar:FindFirstChild("CloseButton")
  97. if closeButton then createTween(closeButton, {TextColor3 = COLORS.DANGER}) end
  98. end
  99.  
  100. for tabName, tab in pairs(window.Tabs or {}) do
  101. if tab.Button then
  102. if window.CurrentTab == tabName then
  103. createTween(tab.Button, {BackgroundColor3 = COLORS.ACCENT, TextColor3 = COLORS.TEXT})
  104. else
  105. createTween(tab.Button, {BackgroundColor3 = COLORS.SECONDARY, TextColor3 = COLORS.TEXT_MUTED})
  106. end
  107. end
  108. if tab.Content then createTween(tab.Content, {ScrollBarImageColor3 = COLORS.ACCENT}) end
  109. for _, element in ipairs(tab.Elements or {}) do
  110. if element and element:IsA("GuiObject") then
  111. if element.Name:match("Button") and not element.Name:match("Tab") then
  112. createTween(element, {BackgroundColor3 = COLORS.ACCENT, TextColor3 = COLORS.TEXT})
  113. elseif element.Name:match("Toggle") then
  114. createTween(element, {BackgroundColor3 = COLORS.SECONDARY})
  115. local tb = element:FindFirstChild("TextButton")
  116. if tb then
  117. local ind = tb:FindFirstChild("Frame")
  118. if ind then
  119. local isOn = ind.Position.X.Scale > 0.5
  120. createTween(tb, {BackgroundColor3 = isOn and COLORS.SUCCESS or COLORS.BORDER})
  121. createTween(ind, {BackgroundColor3 = COLORS.TEXT})
  122. end
  123. end
  124. local lbl = element:FindFirstChildWhichIsA("TextLabel")
  125. if lbl then createTween(lbl, {TextColor3 = COLORS.TEXT}) end
  126. elseif element.Name:match("Slider") then
  127. createTween(element, {BackgroundColor3 = COLORS.SECONDARY})
  128. local track = element:FindFirstChild("Frame")
  129. if track then
  130. createTween(track, {BackgroundColor3 = COLORS.BORDER})
  131. local fill = track:FindFirstChild("Frame")
  132. if fill then createTween(fill, {BackgroundColor3 = COLORS.ACCENT}) end
  133. local handle = track:FindFirstChild("TextButton")
  134. if handle then createTween(handle, {BackgroundColor3 = COLORS.TEXT}) end
  135. end
  136. local lbl = element:FindFirstChild("SliderLabel")
  137. if lbl then createTween(lbl, {TextColor3 = COLORS.TEXT}) end
  138. local val = element:FindFirstChild("TextLabel", true)
  139. if val and val.Name ~= "SliderLabel" then createTween(val, {TextColor3 = COLORS.ACCENT}) end
  140. elseif element.Name:match("Section") then
  141. createTween(element, {BackgroundColor3 = COLORS.BORDER})
  142. local lbl = element:FindFirstChildWhichIsA("TextLabel")
  143. if lbl then createTween(lbl, {TextColor3 = COLORS.TEXT}) end
  144. end
  145. end
  146. end
  147. end
  148. end
  149.  
  150. local function createLoader(parent, size)
  151. local loaderFrame = Instance.new("Frame")
  152. loaderFrame.Size = UDim2.new(0, size, 0, size)
  153. loaderFrame.Position = UDim2.new(0.5, -size/2, 0.5, -size/2)
  154. loaderFrame.BackgroundTransparency = 1
  155. loaderFrame.Parent = parent
  156.  
  157. local dots = {}
  158. local numDots = 8
  159. local radius = size * 0.3
  160.  
  161. for i = 1, numDots do
  162. local dot = Instance.new("Frame")
  163. dot.Size = UDim2.new(0, 10, 0, 10)
  164. dot.BackgroundColor3 = COLORS.ACCENT
  165. dot.BorderSizePixel = 0
  166. dot.Parent = loaderFrame
  167. createCorner(dot, 5)
  168. local angle = (i - 1) * (2 * math.pi / numDots)
  169. dot.Position = UDim2.new(0.5, math.cos(angle) * radius, 0.5, math.sin(angle) * radius)
  170. table.insert(dots, dot)
  171. end
  172.  
  173. task.spawn(function()
  174. while loaderFrame.Parent do
  175. for _, dot in ipairs(dots) do
  176. createTween(dot, {Size = UDim2.new(0, 14, 0, 14), BackgroundTransparency = 0}, 0.3)
  177. task.wait(0.1)
  178. createTween(dot, {Size = UDim2.new(0, 10, 0, 10), BackgroundTransparency = 0.5}, 0.3)
  179. end
  180. task.wait(0.2)
  181. end
  182. end)
  183.  
  184. return loaderFrame
  185. end
  186.  
  187. local function saveConfig(window)
  188. print("DEBUG: saveConfig called - autoSaveEnabled =", autoSaveEnabled)
  189. window = window or GuiLibrary.CurrentWindow
  190. if not window or not window.CurrentSize then
  191. print("DEBUG: saveConfig skipped - no window or CurrentSize")
  192. return
  193. end
  194. ensureAutoSaveFolder()
  195. local config = {
  196. UIScale = window.CurrentSize.X.Offset / 600,
  197. AnimationsEnabled = (ANIM_TIME > 0.05),
  198. Components = {}
  199. }
  200. for _, tab in pairs(window.Tabs or {}) do
  201. for _, element in ipairs(tab.Elements or {}) do
  202. local id = element:GetAttribute("ElementID")
  203. if not id then continue end
  204. local data = {Type = nil, Value = nil}
  205. if element.Name:match("Toggle") then
  206. local tb = element:FindFirstChild("TextButton")
  207. local ind = tb and tb:FindFirstChild("Frame")
  208. if ind then data.Type = "Toggle" data.Value = ind.Position.X.Scale > 0.5 end
  209. elseif element.Name:match("Slider") then
  210. local valLabel = element:FindFirstChild("TextLabel", true)
  211. if valLabel and valLabel.Name ~= "SliderLabel" then data.Type = "Slider" data.Value = tonumber(valLabel.Text) or 0 end
  212. end
  213. if data.Type then table.insert(config.Components, {ID = id, Data = data}) end
  214. end
  215. end
  216. pcall(function() writefile(getAutoSavePath(), HttpService:JSONEncode(config)) end)
  217. print("DEBUG: Config saved successfully to", getAutoSavePath())
  218. end
  219.  
  220. GuiLibrary.SaveConfig = saveConfig
  221.  
  222. local function loadConfig(window)
  223. print("DEBUG: loadConfig called")
  224. local path = getAutoSavePath()
  225. if not pcall(isfile, path) or not isfile(path) then print("DEBUG: No save file found") return false end
  226. local success, config = pcall(function() return HttpService:JSONDecode(readfile(path)) end)
  227. if not success or not config then print("DEBUG: Failed to decode save file") return false end
  228. if config.UIScale then
  229. local newSize = UDim2.new(0, 600 * config.UIScale, 0, 400 * config.UIScale)
  230. window.CurrentSize = newSize
  231. createTween(window.MainFrame, {Size = newSize}, 0.25)
  232. end
  233. if config.AnimationsEnabled ~= nil then ANIM_TIME = config.AnimationsEnabled and 0.3 or 0.01 end
  234. for _, entry in ipairs(config.Components or {}) do
  235. for _, tab in pairs(window.Tabs or {}) do
  236. for _, element in ipairs(tab.Elements or {}) do
  237. if element:GetAttribute("ElementID") == entry.ID then
  238. local d = entry.Data
  239. if d.Type == "Toggle" and d.Value ~= nil then
  240. local tb = element:FindFirstChild("TextButton")
  241. local ind = tb and tb:FindFirstChild("Frame")
  242. if ind then
  243. local isOn = d.Value
  244. tb.BackgroundColor3 = isOn and COLORS.SUCCESS or COLORS.BORDER
  245. ind.Position = isOn and UDim2.new(1, -18, 0.5, -8) or UDim2.new(0, 2, 0.5, -8)
  246. end
  247. elseif d.Type == "Slider" and d.Value then
  248. local valLabel = element:FindFirstChild("TextLabel", true)
  249. if valLabel and valLabel.Name ~= "SliderLabel" then valLabel.Text = tostring(d.Value) end
  250. end
  251. break
  252. end
  253. end
  254. end
  255. end
  256. updateElementColors(window)
  257. print("DEBUG: Config loaded successfully")
  258. return true
  259. end
  260.  
  261. -- ==================== COMPONENT FUNCTIONS ====================
  262.  
  263. function GuiLibrary:CreateButton(tab, text, callback)
  264. local button = Instance.new("TextButton")
  265. button.Name = text .. "Button"
  266. button.Size = UDim2.new(1, 0, 0, 35)
  267. button.BackgroundColor3 = COLORS.ACCENT
  268. button.Text = text
  269. button.TextColor3 = COLORS.TEXT
  270. button.TextSize = 12
  271. button.Font = Enum.Font.Gotham
  272. button.BorderSizePixel = 0
  273. button.Parent = tab.Content
  274. createCorner(button, 6)
  275. button.MouseButton1Click:Connect(function()
  276. createTween(button, {Size = UDim2.new(1, -4, 0, 31)})
  277. task.wait(0.1)
  278. createTween(button, {Size = UDim2.new(1, 0, 0, 35)})
  279. if callback then callback() end
  280. end)
  281. button.MouseEnter:Connect(function() createTween(button, {BackgroundColor3 = Color3.fromRGB(math.min(COLORS.ACCENT.R*255+20,255),math.min(COLORS.ACCENT.G*255+20,255),math.min(COLORS.ACCENT.B*255+20,255))}) end)
  282. button.MouseLeave:Connect(function() createTween(button, {BackgroundColor3 = COLORS.ACCENT}) end)
  283. table.insert(tab.Elements, button)
  284. return button
  285. end
  286.  
  287. function GuiLibrary:CreateToggle(tab, text, default, callback)
  288. local toggleFrame = Instance.new("Frame")
  289. toggleFrame.Name = text .. "Toggle"
  290. toggleFrame.Size = UDim2.new(1, 0, 0, 35)
  291. toggleFrame.BackgroundColor3 = COLORS.SECONDARY
  292. toggleFrame.BorderSizePixel = 0
  293. toggleFrame.Parent = tab.Content
  294. createCorner(toggleFrame, 6)
  295. local toggleLabel = Instance.new("TextLabel")
  296. toggleLabel.Size = UDim2.new(1, -50, 1, 0)
  297. toggleLabel.Position = UDim2.new(0, 10, 0, 0)
  298. toggleLabel.BackgroundTransparency = 1
  299. toggleLabel.Text = text
  300. toggleLabel.TextColor3 = COLORS.TEXT
  301. toggleLabel.TextSize = 12
  302. toggleLabel.Font = Enum.Font.Gotham
  303. toggleLabel.TextXAlignment = Enum.TextXAlignment.Left
  304. toggleLabel.Parent = toggleFrame
  305. local toggleButton = Instance.new("TextButton")
  306. toggleButton.Size = UDim2.new(0, 40, 0, 20)
  307. toggleButton.Position = UDim2.new(1, -45, 0.5, -10)
  308. toggleButton.BackgroundColor3 = default and COLORS.SUCCESS or COLORS.BORDER
  309. toggleButton.Text = ""
  310. toggleButton.BorderSizePixel = 0
  311. toggleButton.Parent = toggleFrame
  312. createCorner(toggleButton, 10)
  313. local toggleIndicator = Instance.new("Frame")
  314. toggleIndicator.Size = UDim2.new(0, 16, 0, 16)
  315. toggleIndicator.Position = default and UDim2.new(1, -18, 0.5, -8) or UDim2.new(0, 2, 0.5, -8)
  316. toggleIndicator.BackgroundColor3 = COLORS.TEXT
  317. toggleIndicator.BorderSizePixel = 0
  318. toggleIndicator.Parent = toggleButton
  319. createCorner(toggleIndicator, 8)
  320. local isToggled = default or false
  321. local elementID = (tab.Name or "Tab") .. "_" .. text:gsub("%s+", "_") .. "_Toggle"
  322. toggleFrame:SetAttribute("ElementID", elementID)
  323. toggleButton.MouseButton1Click:Connect(function()
  324. isToggled = not isToggled
  325. if isToggled then
  326. createTween(toggleButton, {BackgroundColor3 = COLORS.SUCCESS})
  327. createTween(toggleIndicator, {Position = UDim2.new(1, -18, 0.5, -8)})
  328. else
  329. createTween(toggleButton, {BackgroundColor3 = COLORS.BORDER})
  330. createTween(toggleIndicator, {Position = UDim2.new(0, 2, 0.5, -8)})
  331. end
  332. if callback then callback(isToggled) end
  333. if GuiLibrary.SaveConfig then GuiLibrary.SaveConfig() end
  334. end)
  335. toggleFrame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement then createTween(toggleFrame, {BackgroundColor3 = COLORS.HOVER}) end end)
  336. toggleFrame.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement then createTween(toggleFrame, {BackgroundColor3 = COLORS.SECONDARY}) end end)
  337. table.insert(tab.Elements, toggleFrame)
  338. return {Frame = toggleFrame, GetValue = function() return isToggled end}
  339. end
  340.  
  341. function GuiLibrary:CreateSlider(tab, text, min, max, default, callback)
  342. local sliderFrame = Instance.new("Frame")
  343. sliderFrame.Name = text .. "Slider"
  344. sliderFrame.Size = UDim2.new(1, 0, 0, 50)
  345. sliderFrame.BackgroundColor3 = COLORS.SECONDARY
  346. sliderFrame.BorderSizePixel = 0
  347. sliderFrame.Parent = tab.Content
  348. createCorner(sliderFrame, 6)
  349. local sliderLabel = Instance.new("TextLabel")
  350. sliderLabel.Name = "SliderLabel"
  351. sliderLabel.Size = UDim2.new(0.7, 0, 0, 20)
  352. sliderLabel.Position = UDim2.new(0, 10, 0, 5)
  353. sliderLabel.BackgroundTransparency = 1
  354. sliderLabel.Text = text
  355. sliderLabel.TextColor3 = COLORS.TEXT
  356. sliderLabel.TextSize = 12
  357. sliderLabel.Font = Enum.Font.Gotham
  358. sliderLabel.TextXAlignment = Enum.TextXAlignment.Left
  359. sliderLabel.Parent = sliderFrame
  360. local valueLabel = Instance.new("TextLabel")
  361. valueLabel.Size = UDim2.new(0.3, -10, 0, 20)
  362. valueLabel.Position = UDim2.new(0.7, 0, 0, 5)
  363. valueLabel.BackgroundTransparency = 1
  364. valueLabel.Text = tostring(default or min)
  365. valueLabel.TextColor3 = COLORS.ACCENT
  366. valueLabel.TextSize = 12
  367. valueLabel.Font = Enum.Font.GothamBold
  368. valueLabel.TextXAlignment = Enum.TextXAlignment.Right
  369. valueLabel.Parent = sliderFrame
  370. local sliderTrack = Instance.new("Frame")
  371. sliderTrack.Size = UDim2.new(1, -20, 0, 4)
  372. sliderTrack.Position = UDim2.new(0, 10, 1, -15)
  373. sliderTrack.BackgroundColor3 = COLORS.BORDER
  374. sliderTrack.BorderSizePixel = 0
  375. sliderTrack.Parent = sliderFrame
  376. createCorner(sliderTrack, 2)
  377. local sliderFill = Instance.new("Frame")
  378. sliderFill.Size = UDim2.new(0, 0, 1, 0)
  379. sliderFill.BackgroundColor3 = COLORS.ACCENT
  380. sliderFill.BorderSizePixel = 0
  381. sliderFill.Parent = sliderTrack
  382. createCorner(sliderFill, 2)
  383. local sliderHandle = Instance.new("TextButton")
  384. sliderHandle.Size = UDim2.new(0, 16, 0, 16)
  385. sliderHandle.Position = UDim2.new(0, -8, 0.5, -8)
  386. sliderHandle.BackgroundColor3 = COLORS.TEXT
  387. sliderHandle.Text = ""
  388. sliderHandle.BorderSizePixel = 0
  389. sliderHandle.Parent = sliderTrack
  390. createCorner(sliderHandle, 8)
  391. local currentValue = default or min
  392. local dragging = false
  393. local function updateSlider(value)
  394. currentValue = math.clamp(value, min, max)
  395. local percentage = (currentValue - min) / (max - min)
  396. createTween(sliderFill, {Size = UDim2.new(percentage, 0, 1, 0)}, 0.1)
  397. createTween(sliderHandle, {Position = UDim2.new(percentage, -8, 0.5, -8)}, 0.1)
  398. valueLabel.Text = string.format("%.1f", currentValue)
  399. if callback then callback(currentValue) end
  400. if GuiLibrary.SaveConfig then GuiLibrary.SaveConfig() end
  401. end
  402. sliderHandle.MouseButton1Down:Connect(function() dragging = true end)
  403. UserInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 and dragging then dragging = false end end)
  404. UserInputService.InputChanged:Connect(function(input)
  405. if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  406. local mousePos = input.Position.X
  407. local trackPos = sliderTrack.AbsolutePosition.X
  408. local trackSize = sliderTrack.AbsoluteSize.X
  409. local percentage = math.clamp((mousePos - trackPos) / trackSize, 0, 1)
  410. updateSlider(min + (max - min) * percentage)
  411. end
  412. end)
  413. sliderTrack.InputBegan:Connect(function(input)
  414. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  415. local mousePos = input.Position.X
  416. local trackPos = sliderTrack.AbsolutePosition.X
  417. local trackSize = sliderTrack.AbsoluteSize.X
  418. local percentage = math.clamp((mousePos - trackPos) / trackSize, 0, 1)
  419. updateSlider(min + (max - min) * percentage)
  420. end
  421. end)
  422. sliderFrame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement then createTween(sliderFrame, {BackgroundColor3 = COLORS.HOVER}) end end)
  423. sliderFrame.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement then createTween(sliderFrame, {BackgroundColor3 = COLORS.SECONDARY}) end end)
  424. local elementID = (tab.Name or "Tab") .. "_" .. text:gsub("%s+", "_") .. "_Slider"
  425. sliderFrame:SetAttribute("ElementID", elementID)
  426. updateSlider(currentValue)
  427. table.insert(tab.Elements, sliderFrame)
  428. return {Frame = sliderFrame, GetValue = function() return currentValue end, SetValue = updateSlider}
  429. end
  430.  
  431. function GuiLibrary:CreateDropdown(tab, text, options, callback)
  432. local dropdownFrame = Instance.new("Frame")
  433. dropdownFrame.Name = text .. "Dropdown"
  434. dropdownFrame.Size = UDim2.new(1, 0, 0, 35)
  435. dropdownFrame.BackgroundColor3 = COLORS.SECONDARY
  436. dropdownFrame.BorderSizePixel = 0
  437. dropdownFrame.Parent = tab.Content
  438. createCorner(dropdownFrame, 6)
  439. local dropdownButton = Instance.new("TextButton")
  440. dropdownButton.Size = UDim2.new(1, -20, 0, 25)
  441. dropdownButton.Position = UDim2.new(0, 10, 0, 5)
  442. dropdownButton.BackgroundColor3 = COLORS.PRIMARY
  443. dropdownButton.Text = text .. ": " .. (options[1] or "None")
  444. dropdownButton.TextColor3 = COLORS.TEXT
  445. dropdownButton.TextSize = 12
  446. dropdownButton.Font = Enum.Font.Gotham
  447. dropdownButton.BorderSizePixel = 0
  448. dropdownButton.TextXAlignment = Enum.TextXAlignment.Left
  449. dropdownButton.ZIndex = 110
  450. dropdownButton.Parent = dropdownFrame
  451. createCorner(dropdownButton, 4)
  452. local dropdownArrow = Instance.new("TextLabel")
  453. dropdownArrow.Size = UDim2.new(0, 20, 0, 20)
  454. dropdownArrow.Position = UDim2.new(1, -30, 0, 5)
  455. dropdownArrow.BackgroundTransparency = 1
  456. dropdownArrow.Text = "▼"
  457. dropdownArrow.TextColor3 = COLORS.TEXT_MUTED
  458. dropdownArrow.TextSize = 10
  459. dropdownArrow.Font = Enum.Font.Gotham
  460. dropdownArrow.ZIndex = 110
  461. dropdownArrow.Parent = dropdownButton
  462. local dropdownList = Instance.new("ScrollingFrame")
  463. dropdownList.Name = "DropdownList"
  464. dropdownList.Size = UDim2.new(1, -20, 0, 0)
  465. dropdownList.Position = UDim2.new(0, 10, 0, 35)
  466. dropdownList.BackgroundColor3 = COLORS.PRIMARY
  467. dropdownList.BorderSizePixel = 0
  468. dropdownList.Visible = false
  469. dropdownList.ZIndex = 100
  470. dropdownList.ScrollBarThickness = 6
  471. dropdownList.ScrollBarImageColor3 = COLORS.ACCENT
  472. dropdownList.Parent = dropdownFrame
  473. createCorner(dropdownList, 4)
  474. createStroke(dropdownList, 1, COLORS.BORDER)
  475. local listLayout = Instance.new("UIListLayout")
  476. listLayout.SortOrder = Enum.SortOrder.LayoutOrder
  477. listLayout.Parent = dropdownList
  478. local contentPadding = Instance.new("UIPadding")
  479. contentPadding.PaddingTop = UDim.new(0, 5)
  480. contentPadding.PaddingBottom = UDim.new(0, 5)
  481. contentPadding.Parent = dropdownList
  482. local currentSelection = options[1] or "None"
  483. local isOpen = false
  484. local originalPositions = {}
  485. local baseY = dropdownFrame.Position.Y.Offset + dropdownFrame.Size.Y.Offset
  486. for i, element in ipairs(tab.Content:GetChildren()) do
  487. if element:IsA("GuiObject") and element ~= dropdownFrame and element.Position.Y.Offset >= baseY then
  488. originalPositions[element] = element.Position
  489. end
  490. end
  491. for i, option in ipairs(options) do
  492. local optionButton = Instance.new("TextButton")
  493. optionButton.Size = UDim2.new(1, -10, 0, 25)
  494. optionButton.BackgroundColor3 = Color3.new(0, 0, 0)
  495. optionButton.BackgroundTransparency = 1
  496. optionButton.Text = option
  497. optionButton.TextColor3 = COLORS.TEXT
  498. optionButton.TextSize = 11
  499. optionButton.Font = Enum.Font.Gotham
  500. optionButton.BorderSizePixel = 0
  501. optionButton.LayoutOrder = i
  502. optionButton.ZIndex = 101
  503. optionButton.Parent = dropdownList
  504. optionButton.MouseButton1Click:Connect(function()
  505. currentSelection = option
  506. dropdownButton.Text = text .. ": " .. option
  507. isOpen = false
  508. createTween(dropdownArrow, {Rotation = 0})
  509. createTween(dropdownList, {Size = UDim2.new(1, -20, 0, 0)})
  510. for element, pos in pairs(originalPositions) do createTween(element, {Position = pos}) end
  511. task.wait(ANIM_TIME)
  512. dropdownList.Visible = false
  513. dropdownFrame.Size = UDim2.new(1, 0, 0, 35)
  514. if callback then callback(option) end
  515. end)
  516. optionButton.MouseEnter:Connect(function() createTween(optionButton, {BackgroundTransparency = 0.9, TextColor3 = COLORS.TEXT}) end)
  517. optionButton.MouseLeave:Connect(function() createTween(optionButton, {BackgroundTransparency = 1, TextColor3 = COLORS.TEXT_MUTED}) end)
  518. end
  519. dropdownButton.MouseButton1Click:Connect(function()
  520. isOpen = not isOpen
  521. if isOpen then
  522. local dropdownHeight = math.min(#options * 25, 125)
  523. dropdownFrame.Size = UDim2.new(1, 0, 0, 35 + dropdownHeight)
  524. dropdownList.Size = UDim2.new(1, -20, 0, 0)
  525. dropdownList.CanvasSize = UDim2.new(0, 0, 0, #options * 25)
  526. dropdownList.Visible = true
  527. createTween(dropdownArrow, {Rotation = 180})
  528. createTween(dropdownList, {Size = UDim2.new(1, -20, 0, dropdownHeight)})
  529. local offset = dropdownHeight
  530. for element, pos in pairs(originalPositions) do
  531. local newY = pos.Y.Offset + offset
  532. createTween(element, {Position = UDim2.new(pos.X.Scale, pos.X.Offset, pos.Y.Scale, newY)})
  533. end
  534. else
  535. createTween(dropdownArrow, {Rotation = 0})
  536. createTween(dropdownList, {Size = UDim2.new(1, -20, 0, 0)})
  537. for element, pos in pairs(originalPositions) do createTween(element, {Position = pos}) end
  538. task.wait(ANIM_TIME)
  539. dropdownList.Visible = false
  540. dropdownFrame.Size = UDim2.new(1, 0, 0, 35)
  541. end
  542. end)
  543. dropdownButton.MouseEnter:Connect(function() createTween(dropdownButton, {BackgroundColor3 = COLORS.HOVER}) end)
  544. dropdownButton.MouseLeave:Connect(function() createTween(dropdownButton, {BackgroundColor3 = COLORS.PRIMARY}) end)
  545. table.insert(tab.Elements, dropdownFrame)
  546. return {Frame = dropdownFrame, GetValue = function() return currentSelection end}
  547. end
  548.  
  549. function GuiLibrary:CreateLabel(tab, text)
  550. local label = Instance.new("TextLabel")
  551. label.Name = text .. "Label"
  552. label.Size = UDim2.new(1, 0, 0, 25)
  553. label.BackgroundTransparency = 1
  554. label.Text = text
  555. label.TextColor3 = COLORS.TEXT
  556. label.TextSize = 12
  557. label.Font = Enum.Font.Gotham
  558. label.TextXAlignment = Enum.TextXAlignment.Left
  559. label.Parent = tab.Content
  560. table.insert(tab.Elements, label)
  561. return label
  562. end
  563.  
  564. function GuiLibrary:CreateSection(tab, title)
  565. print("DEBUG: CreateSection called with title:", title)
  566. local sectionFrame = Instance.new("Frame")
  567. sectionFrame.Name = title .. "Section"
  568. sectionFrame.Size = UDim2.new(1, 0, 0, 30)
  569. sectionFrame.BackgroundColor3 = COLORS.BORDER
  570. sectionFrame.BorderSizePixel = 0
  571. sectionFrame.Parent = tab.Content
  572. createCorner(sectionFrame, 4)
  573. local sectionLabel = Instance.new("TextLabel")
  574. sectionLabel.Size = UDim2.new(1, -20, 1, 0)
  575. sectionLabel.Position = UDim2.new(0, 10, 0, 0)
  576. sectionLabel.BackgroundTransparency = 1
  577. sectionLabel.Text = title
  578. sectionLabel.TextColor3 = COLORS.TEXT
  579. sectionLabel.TextSize = 13
  580. sectionLabel.Font = Enum.Font.GothamBold
  581. sectionLabel.TextXAlignment = Enum.TextXAlignment.Left
  582. sectionLabel.Parent = sectionFrame
  583. table.insert(tab.Elements, sectionFrame)
  584. return sectionFrame
  585. end
  586.  
  587. function GuiLibrary:CreateInput(tab, placeholder, callback)
  588. local inputFrame = Instance.new("Frame")
  589. inputFrame.Name = placeholder .. "Input"
  590. inputFrame.Size = UDim2.new(1, 0, 0, 35)
  591. inputFrame.BackgroundColor3 = COLORS.SECONDARY
  592. inputFrame.BorderSizePixel = 0
  593. inputFrame.Parent = tab.Content
  594. createCorner(inputFrame, 6)
  595. local textBox = Instance.new("TextBox")
  596. textBox.Size = UDim2.new(1, -20, 1, -10)
  597. textBox.Position = UDim2.new(0, 10, 0, 5)
  598. textBox.BackgroundColor3 = COLORS.PRIMARY
  599. textBox.PlaceholderText = placeholder
  600. textBox.PlaceholderColor3 = COLORS.TEXT_MUTED
  601. textBox.Text = ""
  602. textBox.TextColor3 = COLORS.TEXT
  603. textBox.TextSize = 12
  604. textBox.Font = Enum.Font.Gotham
  605. textBox.BorderSizePixel = 0
  606. textBox.ClearTextOnFocus = false
  607. textBox.Parent = inputFrame
  608. createCorner(textBox, 4)
  609. textBox.FocusLost:Connect(function(enterPressed)
  610. if callback and enterPressed then callback(textBox.Text) end
  611. end)
  612. textBox.Focused:Connect(function() createStroke(textBox, 2, COLORS.ACCENT) end)
  613. textBox.FocusLost:Connect(function()
  614. local stroke = textBox:FindFirstChild("UIStroke")
  615. if stroke then stroke:Destroy() end
  616. end)
  617. table.insert(tab.Elements, inputFrame)
  618. return {Frame = inputFrame, TextBox = textBox, GetValue = function() return textBox.Text end}
  619. end
  620.  
  621. function GuiLibrary:CreateColorPicker(tab, text, defaultColor, callback)
  622. local colorFrame = Instance.new("Frame")
  623. colorFrame.Name = text .. "ColorPicker"
  624. colorFrame.Size = UDim2.new(1, 0, 0, 35)
  625. colorFrame.BackgroundColor3 = COLORS.SECONDARY
  626. colorFrame.BorderSizePixel = 0
  627. colorFrame.Parent = tab.Content
  628. createCorner(colorFrame, 6)
  629. local colorLabel = Instance.new("TextLabel")
  630. colorLabel.Size = UDim2.new(1, -50, 1, 0)
  631. colorLabel.Position = UDim2.new(0, 10, 0, 0)
  632. colorLabel.BackgroundTransparency = 1
  633. colorLabel.Text = text
  634. colorLabel.TextColor3 = COLORS.TEXT
  635. colorLabel.TextSize = 12
  636. colorLabel.Font = Enum.Font.Gotham
  637. colorLabel.TextXAlignment = Enum.TextXAlignment.Left
  638. colorLabel.Parent = colorFrame
  639. local colorDisplay = Instance.new("TextButton")
  640. colorDisplay.Size = UDim2.new(0, 30, 0, 25)
  641. colorDisplay.Position = UDim2.new(1, -35, 0.5, -12.5)
  642. colorDisplay.BackgroundColor3 = defaultColor or Color3.new(1, 1, 1)
  643. colorDisplay.Text = ""
  644. colorDisplay.BorderSizePixel = 0
  645. colorDisplay.Parent = colorFrame
  646. createCorner(colorDisplay, 6)
  647. createStroke(colorDisplay, 2, COLORS.BORDER)
  648. local currentColor = defaultColor or Color3.new(1, 1, 1)
  649. colorDisplay.MouseButton1Click:Connect(function()
  650. local colors = {Color3.new(1,0,0), Color3.new(0,1,0), Color3.new(0,0,1), Color3.new(1,1,0), Color3.new(1,0,1), Color3.new(0,1,1), Color3.new(1,1,1), Color3.new(0,0,0)}
  651. local currentIndex = 1
  652. for i, color in ipairs(colors) do if currentColor == color then currentIndex = i break end end
  653. currentIndex = currentIndex % #colors + 1
  654. currentColor = colors[currentIndex]
  655. createTween(colorDisplay, {BackgroundColor3 = currentColor})
  656. if callback then callback(currentColor) end
  657. end)
  658. colorDisplay.MouseEnter:Connect(function() createTween(colorDisplay, {Size = UDim2.new(0, 32, 0, 27)}) end)
  659. colorDisplay.MouseLeave:Connect(function() createTween(colorDisplay, {Size = UDim2.new(0, 30, 0, 25)}) end)
  660. table.insert(tab.Elements, colorFrame)
  661. return {Frame = colorFrame, GetValue = function() return currentColor end, SetColor = function(color) currentColor = color; colorDisplay.BackgroundColor3 = color end}
  662. end
  663.  
  664. function GuiLibrary:CreateKeybind(tab, text, defaultKey, callback)
  665. local keybindFrame = Instance.new("Frame")
  666. keybindFrame.Name = text .. "Keybind"
  667. keybindFrame.Size = UDim2.new(1, 0, 0, 35)
  668. keybindFrame.BackgroundColor3 = COLORS.SECONDARY
  669. keybindFrame.BorderSizePixel = 0
  670. keybindFrame.Parent = tab.Content
  671. createCorner(keybindFrame, 6)
  672. local keybindLabel = Instance.new("TextLabel")
  673. keybindLabel.Size = UDim2.new(1, -80, 1, 0)
  674. keybindLabel.Position = UDim2.new(0, 10, 0, 0)
  675. keybindLabel.BackgroundTransparency = 1
  676. keybindLabel.Text = text
  677. keybindLabel.TextColor3 = COLORS.TEXT
  678. keybindLabel.TextSize = 12
  679. keybindLabel.Font = Enum.Font.Gotham
  680. keybindLabel.TextXAlignment = Enum.TextXAlignment.Left
  681. keybindLabel.Parent = keybindFrame
  682. local keybindButton = Instance.new("TextButton")
  683. keybindButton.Size = UDim2.new(0, 60, 0, 25)
  684. keybindButton.Position = UDim2.new(1, -65, 0.5, -12.5)
  685. keybindButton.BackgroundColor3 = COLORS.PRIMARY
  686. keybindButton.Text = defaultKey and defaultKey.Name or "None"
  687. keybindButton.TextColor3 = COLORS.TEXT
  688. keybindButton.TextSize = 10
  689. keybindButton.Font = Enum.Font.Gotham
  690. keybindButton.BorderSizePixel = 0
  691. keybindButton.Parent = keybindFrame
  692. createCorner(keybindButton, 4)
  693. local currentKey = defaultKey
  694. local listening = false
  695. keybindButton.MouseButton1Click:Connect(function()
  696. if listening then return end
  697. listening = true
  698. keybindButton.Text = "..."
  699. createTween(keybindButton, {BackgroundColor3 = COLORS.WARNING})
  700. local connection
  701. connection = UserInputService.InputBegan:Connect(function(input, gameProcessed)
  702. if gameProcessed then return end
  703. if input.UserInputType == Enum.UserInputType.Keyboard then
  704. currentKey = input.KeyCode
  705. keybindButton.Text = input.KeyCode.Name
  706. listening = false
  707. createTween(keybindButton, {BackgroundColor3 = COLORS.PRIMARY})
  708. connection:Disconnect()
  709. end
  710. end)
  711. end)
  712. if currentKey then
  713. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  714. if gameProcessed or listening then return end
  715. if input.KeyCode == currentKey and callback then callback() end
  716. end)
  717. end
  718. table.insert(tab.Elements, keybindFrame)
  719. return {Frame = keybindFrame, GetKey = function() return currentKey end}
  720. end
  721.  
  722. function GuiLibrary:CreateNotification(title, message, duration, notifType)
  723. duration = duration or 3
  724. notifType = notifType or "info"
  725. local colors = { info = COLORS.ACCENT, success = COLORS.SUCCESS, warning = COLORS.WARNING, error = COLORS.DANGER }
  726. local notifGui = Instance.new("ScreenGui")
  727. notifGui.Name = "NotificationGui"
  728. notifGui.Parent = game.CoreGui
  729. local notifFrame = Instance.new("Frame")
  730. notifFrame.Size = UDim2.new(0, 300, 0, 80)
  731. notifFrame.Position = UDim2.new(1, 0, 0, 50)
  732. notifFrame.BackgroundColor3 = COLORS.PRIMARY
  733. notifFrame.BorderSizePixel = 0
  734. notifFrame.Parent = notifGui
  735. createCorner(notifFrame, 8)
  736. createStroke(notifFrame, 2, colors[notifType])
  737. local titleLabel = Instance.new("TextLabel")
  738. titleLabel.Size = UDim2.new(1, -20, 0, 25)
  739. titleLabel.Position = UDim2.new(0, 10, 0, 5)
  740. titleLabel.BackgroundTransparency = 1
  741. titleLabel.Text = title
  742. titleLabel.TextColor3 = colors[notifType]
  743. titleLabel.TextSize = 14
  744. titleLabel.Font = Enum.Font.GothamBold
  745. titleLabel.TextXAlignment = Enum.TextXAlignment.Left
  746. titleLabel.Parent = notifFrame
  747. local messageLabel = Instance.new("TextLabel")
  748. messageLabel.Size = UDim2.new(1, -20, 0, 45)
  749. messageLabel.Position = UDim2.new(0, 10, 0, 25)
  750. messageLabel.BackgroundTransparency = 1
  751. messageLabel.Text = message
  752. messageLabel.TextColor3 = COLORS.TEXT
  753. messageLabel.TextSize = 11
  754. messageLabel.Font = Enum.Font.Gotham
  755. messageLabel.TextXAlignment = Enum.TextXAlignment.Left
  756. messageLabel.TextWrapped = true
  757. messageLabel.Parent = notifFrame
  758. createTween(notifFrame, {Position = UDim2.new(1, -310, 0, 50)})
  759. task.wait(duration)
  760. createTween(notifFrame, {Position = UDim2.new(1, 0, 0, 50)})
  761. task.wait(ANIM_TIME)
  762. notifGui:Destroy()
  763. end
  764.  
  765. -- ==================== HIDDEN SETTINGS TAB ====================
  766. function GuiLibrary:CreateSettingsTab(window)
  767. print("DEBUG: CreateSettingsTab called - creating hidden settings tab")
  768. local name = "Settings"
  769.  
  770. local tabContent = Instance.new("ScrollingFrame")
  771. tabContent.Name = name .. "Content"
  772. tabContent.Size = UDim2.new(1, 0, 1, 0)
  773. tabContent.BackgroundTransparency = 1
  774. tabContent.BorderSizePixel = 0
  775. tabContent.ScrollBarThickness = 6
  776. tabContent.ScrollBarImageColor3 = COLORS.ACCENT
  777. tabContent.Visible = false
  778. tabContent.Parent = window.TabContentContainer
  779.  
  780. local contentLayout = Instance.new("UIListLayout")
  781. contentLayout.SortOrder = Enum.SortOrder.LayoutOrder
  782. contentLayout.Padding = UDim.new(0, 8)
  783. contentLayout.Parent = tabContent
  784.  
  785. local contentPadding = Instance.new("UIPadding")
  786. contentPadding.PaddingTop = UDim.new(0, 10)
  787. contentPadding.PaddingLeft = UDim.new(0, 10)
  788. contentPadding.PaddingRight = UDim.new(0, 10)
  789. contentPadding.PaddingBottom = UDim.new(0, 10)
  790. contentPadding.Parent = tabContent
  791.  
  792. local settingsTab = { Button = nil, Content = tabContent, Name = name, Elements = {} }
  793. window.Tabs[name] = settingsTab
  794. print("DEBUG: Hidden Settings tab created and added to window.Tabs")
  795.  
  796. GuiLibrary:CreateSection(settingsTab, "UI Settings | Library by Soldo_io")
  797. GuiLibrary:CreateKeybind(settingsTab, "Toggle GUI", Enum.KeyCode.Insert, function() window.Toggle() end)
  798. GuiLibrary:CreateSlider(settingsTab, "UI Scale", 0.5, 2.0, 1.0, function(value)
  799. local newSize = UDim2.new(0, 600 * value, 0, 400 * value)
  800. window.CurrentSize = newSize
  801. createTween(window.MainFrame, {Size = newSize}, 0.2)
  802. GuiLibrary.SaveConfig()
  803. end)
  804. GuiLibrary:CreateDropdown(settingsTab, "Theme", {"Dark", "Light", "Midnight", "Forest", "Ocean"}, function(theme)
  805. for key, color in pairs(themes[theme]) do COLORS[key] = color end
  806. updateElementColors(window)
  807. GuiLibrary.SaveConfig()
  808. end)
  809. GuiLibrary:CreateToggle(settingsTab, "Enable Animations", true, function(state)
  810. ANIM_TIME = state and 0.3 or 0.01
  811. GuiLibrary.SaveConfig()
  812. end)
  813. GuiLibrary:CreateToggle(settingsTab, "Auto Save Config", false, function(state)
  814. autoSaveEnabled = state
  815. if state then
  816. GuiLibrary.SaveConfig()
  817. GuiLibrary:CreateNotification("Auto Save", "Enabled - Settings will now save automatically", 3, "success")
  818. else
  819. GuiLibrary:CreateNotification("Auto Save", "Disabled", 2, "info")
  820. end
  821. end)
  822. GuiLibrary:CreateSection(settingsTab, "Performance | Library by Soldo_io")
  823. GuiLibrary:CreateToggle(settingsTab, "Show FPS", false, function(state)
  824. if state and window.FPSLabel then window.FPSLabel.Visible = true elseif window.FPSLabel then window.FPSLabel.Visible = false end
  825. end)
  826. GuiLibrary:CreateButton(settingsTab, "Reset Settings", function()
  827. GuiLibrary:CreateNotification("Settings", "Settings have been reset to default!", 2, "info")
  828. for key, color in pairs(themes["Dark"]) do COLORS[key] = color end
  829. window.MainFrame.Size = UDim2.new(0, 600, 0, 400)
  830. window.CurrentSize = UDim2.new(0, 600, 0, 400)
  831. ANIM_TIME = 0.3
  832. updateElementColors(window)
  833. GuiLibrary.SaveConfig()
  834. end)
  835. print("DEBUG: All settings elements created successfully")
  836. end
  837.  
  838. -- ==================== CreateWindow ====================
  839. function GuiLibrary:CreateWindow(title, size)
  840. print("DEBUG: CreateWindow started")
  841. title = title or "GUI Library"
  842. size = size or UDim2.new(0, 600, 0, 400)
  843.  
  844. local screenGui = Instance.new("ScreenGui")
  845. screenGui.Name = "GuiLibraryUI"
  846. screenGui.ResetOnSpawn = false
  847. screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  848. screenGui.Parent = game.CoreGui
  849.  
  850. local loader = createLoader(screenGui, 100)
  851.  
  852. local mainFrame = Instance.new("Frame")
  853. mainFrame.Name = "MainFrame"
  854. mainFrame.Size = UDim2.new(0, 0, 0, 0)
  855. mainFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
  856. mainFrame.BackgroundColor3 = COLORS.PRIMARY
  857. mainFrame.BorderSizePixel = 0
  858. mainFrame.Active = true
  859. mainFrame.Draggable = true
  860. mainFrame.Visible = false
  861. mainFrame.Parent = screenGui
  862.  
  863. createCorner(mainFrame, 12)
  864. createStroke(mainFrame, 2, COLORS.BORDER)
  865.  
  866. local titleBar = Instance.new("Frame")
  867. titleBar.Name = "TitleBar"
  868. titleBar.Size = UDim2.new(1, 0, 0, 40)
  869. titleBar.BackgroundColor3 = COLORS.SECONDARY
  870. titleBar.BorderSizePixel = 0
  871. titleBar.Parent = mainFrame
  872. createCorner(titleBar, 12)
  873.  
  874. local titleLabel = Instance.new("TextLabel")
  875. titleLabel.Name = "TitleLabel"
  876. titleLabel.Size = UDim2.new(1, -140, 1, 0)
  877. titleLabel.Position = UDim2.new(0, 10, 0, 0)
  878. titleLabel.BackgroundTransparency = 1
  879. titleLabel.Text = title
  880. titleLabel.TextColor3 = COLORS.TEXT
  881. titleLabel.TextSize = 16
  882. titleLabel.Font = Enum.Font.GothamBold
  883. titleLabel.TextXAlignment = Enum.TextXAlignment.Left
  884. titleLabel.Parent = titleBar
  885.  
  886. local fpsLabel = Instance.new("TextLabel")
  887. fpsLabel.Name = "FPSLabel"
  888. fpsLabel.Size = UDim2.new(0, 60, 0, 30)
  889. fpsLabel.Position = UDim2.new(1, -130, 0, 5)
  890. fpsLabel.BackgroundColor3 = COLORS.PRIMARY
  891. fpsLabel.TextColor3 = COLORS.SUCCESS
  892. fpsLabel.TextSize = 12
  893. fpsLabel.Font = Enum.Font.GothamBold
  894. fpsLabel.Text = "FPS: 60"
  895. fpsLabel.Visible = false
  896. fpsLabel.Parent = titleBar
  897. createCorner(fpsLabel, 4)
  898.  
  899. local settingsButton = Instance.new("TextButton")
  900. settingsButton.Name = "SettingsButton"
  901. settingsButton.Size = UDim2.new(0, 30, 0, 30)
  902. settingsButton.Position = UDim2.new(1, -70, 0, 5)
  903. settingsButton.BackgroundTransparency = 1
  904. settingsButton.Text = "⚙️"
  905. settingsButton.TextColor3 = COLORS.TEXT
  906. settingsButton.TextSize = 14
  907. settingsButton.Font = Enum.Font.GothamBold
  908. settingsButton.BorderSizePixel = 0
  909. settingsButton.Parent = titleBar
  910. createCorner(settingsButton, 6)
  911.  
  912. local closeButton = Instance.new("TextButton")
  913. closeButton.Name = "CloseButton"
  914. closeButton.Size = UDim2.new(0, 30, 0, 30)
  915. closeButton.Position = UDim2.new(1, -35, 0, 5)
  916. closeButton.BackgroundTransparency = 1
  917. closeButton.Text = "❌"
  918. closeButton.TextColor3 = COLORS.DANGER
  919. closeButton.TextSize = 14
  920. closeButton.Font = Enum.Font.GothamBold
  921. closeButton.BorderSizePixel = 0
  922. closeButton.Parent = titleBar
  923. createCorner(closeButton, 6)
  924.  
  925. local contentFrame = Instance.new("Frame")
  926. contentFrame.Name = "ContentFrame"
  927. contentFrame.Size = UDim2.new(1, -20, 1, -60)
  928. contentFrame.Position = UDim2.new(0, 10, 0, 50)
  929. contentFrame.BackgroundTransparency = 1
  930. contentFrame.Parent = mainFrame
  931.  
  932. local tabsContainer = Instance.new("Frame")
  933. tabsContainer.Name = "TabsContainer"
  934. tabsContainer.Size = UDim2.new(1, 0, 0, 35)
  935. tabsContainer.BackgroundTransparency = 1
  936. tabsContainer.Parent = contentFrame
  937.  
  938. local tabsLayout = Instance.new("UIListLayout")
  939. tabsLayout.FillDirection = Enum.FillDirection.Horizontal
  940. tabsLayout.SortOrder = Enum.SortOrder.LayoutOrder
  941. tabsLayout.Padding = UDim.new(0, 5)
  942. tabsLayout.Parent = tabsContainer
  943.  
  944. local tabContentContainer = Instance.new("Frame")
  945. tabContentContainer.Name = "TabContentContainer"
  946. tabContentContainer.Size = UDim2.new(1, 0, 1, -45)
  947. tabContentContainer.Position = UDim2.new(0, 0, 0, 45)
  948. tabContentContainer.BackgroundTransparency = 1
  949. tabContentContainer.Parent = contentFrame
  950.  
  951. local window = {
  952. ScreenGui = screenGui,
  953. MainFrame = mainFrame,
  954. ContentFrame = contentFrame,
  955. TabsContainer = tabsContainer,
  956. TabContentContainer = tabContentContainer,
  957. Tabs = {},
  958. CurrentTab = nil,
  959. CurrentSize = size,
  960. FPSLabel = fpsLabel
  961. }
  962.  
  963. GuiLibrary.CurrentWindow = window -- <--- THIS FIXES THE NIL ERROR
  964.  
  965. local isVisible = true
  966.  
  967. local function hideWindow()
  968. if not isVisible then return end
  969. isVisible = false
  970. window.CurrentSize = mainFrame.Size
  971. createTween(mainFrame, {Size = UDim2.new(0, window.CurrentSize.X.Offset * 0.8, 0, window.CurrentSize.Y.Offset * 0.8), BackgroundTransparency = 0.7}, ANIM_TIME * 0.5)
  972. task.wait(ANIM_TIME * 0.5)
  973. createTween(mainFrame, {Size = UDim2.new(0, 0, 0, 0), Position = UDim2.new(0.5, 0, 0.5, 0), BackgroundTransparency = 1, Rotation = 45}, ANIM_TIME * 0.5)
  974. task.wait(ANIM_TIME * 0.5)
  975. mainFrame.Visible = false
  976. end
  977.  
  978. local function showWindow()
  979. if isVisible then return end
  980. isVisible = true
  981. mainFrame.Visible = true
  982. mainFrame.Size = UDim2.new(0, 0, 0, 0)
  983. mainFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
  984. mainFrame.BackgroundTransparency = 1
  985. mainFrame.Rotation = -45
  986. createTween(mainFrame, {Size = UDim2.new(0, window.CurrentSize.X.Offset * 0.8, 0, window.CurrentSize.Y.Offset * 0.8), BackgroundTransparency = 0.3, Rotation = 0}, ANIM_TIME * 0.5)
  987. task.wait(ANIM_TIME * 0.5)
  988. createTween(mainFrame, {Size = window.CurrentSize, Position = UDim2.new(0.5, -window.CurrentSize.X.Offset/2, 0.5, -window.CurrentSize.Y.Offset/2), BackgroundTransparency = 0}, ANIM_TIME * 0.5)
  989. end
  990.  
  991. settingsButton.MouseButton1Click:Connect(function()
  992. print("DEBUG: Gear button clicked - opening hidden Settings tab")
  993. local settingsTab = window.Tabs["Settings"]
  994. if not settingsTab then print("DEBUG: Settings tab not found!") return end
  995. if window.CurrentTab and window.Tabs[window.CurrentTab] then
  996. local current = window.Tabs[window.CurrentTab]
  997. if current.Button then createTween(current.Button, {BackgroundColor3 = COLORS.SECONDARY, TextColor3 = COLORS.TEXT_MUTED}) end
  998. current.Content.Visible = false
  999. end
  1000. window.CurrentTab = "Settings"
  1001. settingsTab.Content.Visible = true
  1002. print("DEBUG: Hidden Settings tab is now visible")
  1003. end)
  1004.  
  1005. settingsButton.MouseEnter:Connect(function() createTween(settingsButton, {TextColor3 = COLORS.HOVER}) end)
  1006. settingsButton.MouseLeave:Connect(function() createTween(settingsButton, {TextColor3 = COLORS.TEXT}) end)
  1007.  
  1008. closeButton.MouseButton1Click:Connect(function()
  1009. createTween(mainFrame, {Size = UDim2.new(0, 0, 0, 0), Position = UDim2.new(0.5, 0, 0.5, 0)})
  1010. task.wait(ANIM_TIME)
  1011. screenGui:Destroy()
  1012. end)
  1013.  
  1014. closeButton.MouseEnter:Connect(function() createTween(closeButton, {TextColor3 = Color3.fromRGB(255, 75, 75)}) end)
  1015. closeButton.MouseLeave:Connect(function() createTween(closeButton, {TextColor3 = COLORS.DANGER}) end)
  1016.  
  1017. task.wait(1.5)
  1018. loader:Destroy()
  1019. mainFrame.Visible = true
  1020. createTween(mainFrame, {Size = size, Position = UDim2.new(0.5, -size.X.Offset/2, 0.5, -size.Y.Offset/2)})
  1021.  
  1022. print("DEBUG: Creating hidden Settings tab now...")
  1023. GuiLibrary:CreateSettingsTab(window)
  1024.  
  1025. task.spawn(function()
  1026. task.wait(0.5)
  1027. loadConfig(window)
  1028. end)
  1029.  
  1030. window.Hide = hideWindow
  1031. window.Show = showWindow
  1032. window.Toggle = function() if isVisible then hideWindow() else showWindow() end end
  1033.  
  1034. updateElementColors(window)
  1035. print("DEBUG: CreateWindow finished - GUI ready")
  1036. return window
  1037. end
  1038.  
  1039. -- Tab System (normal visible tabs)
  1040. function GuiLibrary:CreateTab(window, name)
  1041. local tabButton = Instance.new("TextButton")
  1042. tabButton.Name = name .. "Tab"
  1043. tabButton.Size = UDim2.new(0, 100, 1, 0)
  1044. tabButton.BackgroundColor3 = COLORS.SECONDARY
  1045. tabButton.Text = name
  1046. tabButton.TextColor3 = COLORS.TEXT_MUTED
  1047. tabButton.TextSize = 12
  1048. tabButton.Font = Enum.Font.Gotham
  1049. tabButton.BorderSizePixel = 0
  1050. tabButton.Parent = window.TabsContainer
  1051. createCorner(tabButton, 6)
  1052.  
  1053. local tabContent = Instance.new("ScrollingFrame")
  1054. tabContent.Name = name .. "Content"
  1055. tabContent.Size = UDim2.new(1, 0, 1, 0)
  1056. tabContent.BackgroundTransparency = 1
  1057. tabContent.BorderSizePixel = 0
  1058. tabContent.ScrollBarThickness = 6
  1059. tabContent.ScrollBarImageColor3 = COLORS.ACCENT
  1060. tabContent.Visible = false
  1061. tabContent.Parent = window.TabContentContainer
  1062.  
  1063. local contentLayout = Instance.new("UIListLayout")
  1064. contentLayout.SortOrder = Enum.SortOrder.LayoutOrder
  1065. contentLayout.Padding = UDim.new(0, 8)
  1066. contentLayout.Parent = tabContent
  1067.  
  1068. local contentPadding = Instance.new("UIPadding")
  1069. contentPadding.PaddingTop = UDim.new(0, 10)
  1070. contentPadding.PaddingLeft = UDim.new(0, 10)
  1071. contentPadding.PaddingRight = UDim.new(0, 10)
  1072. contentPadding.PaddingBottom = UDim.new(0, 10)
  1073. contentPadding.Parent = tabContent
  1074.  
  1075. local function updateCanvasSize()
  1076. local totalHeight = contentPadding.PaddingTop.Offset + contentPadding.PaddingBottom.Offset
  1077. for _, child in ipairs(tabContent:GetChildren()) do
  1078. if child:IsA("GuiObject") and child ~= contentLayout and child ~= contentPadding then
  1079. totalHeight = totalHeight + child.Size.Y.Offset + contentLayout.Padding.Offset
  1080. end
  1081. end
  1082. tabContent.CanvasSize = UDim2.new(0, 0, 0, totalHeight)
  1083. end
  1084. contentLayout.Changed:Connect(updateCanvasSize)
  1085. tabContent.ChildAdded:Connect(updateCanvasSize)
  1086. tabContent.ChildRemoved:Connect(updateCanvasSize)
  1087. updateCanvasSize()
  1088.  
  1089. local tab = { Button = tabButton, Content = tabContent, Name = name, Elements = {} }
  1090. window.Tabs[name] = tab
  1091.  
  1092. local function switchTab()
  1093. print("DEBUG: switchTab called - switching to", name)
  1094. if window.CurrentTab == name then return end
  1095. if window.CurrentTab and window.Tabs[window.CurrentTab] then
  1096. local current = window.Tabs[window.CurrentTab]
  1097. if current.Button then
  1098. createTween(current.Button, {BackgroundColor3 = COLORS.SECONDARY, TextColor3 = COLORS.TEXT_MUTED})
  1099. end
  1100. current.Content.Visible = false
  1101. end
  1102. window.CurrentTab = name
  1103. createTween(tabButton, {BackgroundColor3 = COLORS.ACCENT, TextColor3 = COLORS.TEXT})
  1104. tabContent.Visible = true
  1105. print("DEBUG: Switched to tab", name)
  1106. end
  1107.  
  1108. tabButton.MouseButton1Click:Connect(switchTab)
  1109. tabButton.MouseEnter:Connect(function() if window.CurrentTab ~= name then createTween(tabButton, {BackgroundColor3 = COLORS.HOVER}) end end)
  1110. tabButton.MouseLeave:Connect(function() if window.CurrentTab ~= name then createTween(tabButton, {BackgroundColor3 = COLORS.SECONDARY}) end end)
  1111.  
  1112. if not window.CurrentTab then
  1113. window.CurrentTab = name
  1114. createTween(tabButton, {BackgroundColor3 = COLORS.ACCENT, TextColor3 = COLORS.TEXT})
  1115. tabContent.Visible = true
  1116. end
  1117.  
  1118. updateElementColors(window)
  1119. return tab
  1120. end
  1121.  
  1122. return GuiLibrary
RAW Paste Data Copied