spidey_v6

Untitled

Jul 25th, 2026 (edited)
64
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.26 KB | None | 0 0
  1. --[[
  2. DarkUI Premium — Advanced Boxed UI Library for Roblox
  3. Fixed: SelectTab call in AddTab (colon -> dot)
  4. Fixed: GroupTransparency replaced with Position+Transparency tween
  5. --]]
  6.  
  7. local TweenService = game:GetService("TweenService")
  8. local UserInputService = game:GetService("UserInputService")
  9. local Players = game:GetService("Players")
  10. local Player = Players.LocalPlayer
  11.  
  12. local DarkUI = {}
  13. DarkUI.__index = DarkUI
  14.  
  15. -- Theme (unchanged)
  16. local Theme = {
  17. Background = Color3.fromRGB(16, 16, 20),
  18. Header = Color3.fromRGB(22, 22, 28),
  19. Tab = Color3.fromRGB(26, 26, 32),
  20. TabActive = Color3.fromRGB(45, 45, 55),
  21. Section = Color3.fromRGB(28, 28, 34),
  22. Text = Color3.fromRGB(240, 240, 245),
  23. SubText = Color3.fromRGB(140, 140, 152),
  24. Accent = Color3.fromRGB(99, 110, 255),
  25. AccentGlow = Color3.fromRGB(79, 90, 235),
  26. AccentOff = Color3.fromRGB(55, 55, 65),
  27. Danger = Color3.fromRGB(255, 73, 73),
  28. Warning = Color3.fromRGB(255, 180, 36),
  29. Success = Color3.fromRGB(87, 242, 135),
  30. Stroke = Color3.fromRGB(45, 45, 52),
  31. StrokeLight = Color3.fromRGB(60, 60, 70),
  32. Shadow = Color3.fromRGB(0, 0, 0),
  33. }
  34.  
  35. local function corner(inst, radius)
  36. local c = Instance.new("UICorner")
  37. c.CornerRadius = UDim.new(0, radius or 10)
  38. c.Parent = inst
  39. return c
  40. end
  41.  
  42. local function stroke(inst, color, thickness)
  43. local s = Instance.new("UIStroke")
  44. s.Color = color or Theme.Stroke
  45. s.Thickness = thickness or 1
  46. s.Parent = inst
  47. return s
  48. end
  49.  
  50. local function tween(inst, props, time, style, dir)
  51. return TweenService:Create(inst, TweenInfo.new(
  52. time or 0.25,
  53. style or Enum.EasingStyle.Quint,
  54. dir or Enum.EasingDirection.Out
  55. ), props)
  56. end
  57.  
  58. -- Window (unchanged)
  59. function DarkUI:CreateWindow(config)
  60. config = config or {}
  61. local window = setmetatable({}, DarkUI)
  62. window.Title = config.Title or "Window"
  63. window.Size = config.Size or Vector2.new(510, 425)
  64. window.tabs = {}
  65. window.currentTab = nil
  66.  
  67. local gui = Instance.new("ScreenGui")
  68. gui.Name = "DarkUI"
  69. gui.ResetOnSpawn = false
  70. gui.IgnoreGuiInset = true
  71. gui.Parent = Player:WaitForChild("PlayerGui")
  72. window.Gui = gui
  73.  
  74. local root = Instance.new("Frame")
  75. root.Name = "Root"
  76. root.Size = UDim2.fromOffset(window.Size.X, window.Size.Y)
  77. root.Position = UDim2.new(0.5, -window.Size.X / 2, 0.5, -window.Size.Y / 2)
  78. root.BackgroundColor3 = Theme.Background
  79. root.BorderSizePixel = 0
  80. root.ClipsDescendants = true
  81. root.Parent = gui
  82. corner(root, 14)
  83. stroke(root, Theme.Stroke, 1)
  84.  
  85. root.Size = UDim2.fromOffset(window.Size.X * 0.85, window.Size.Y * 0.85)
  86. root.BackgroundTransparency = 1
  87. local openTargetSize = UDim2.fromOffset(window.Size.X, window.Size.Y)
  88.  
  89. local header = Instance.new("Frame")
  90. header.Name = "Header"
  91. header.Size = UDim2.new(1, 0, 0, 50)
  92. header.BackgroundColor3 = Theme.Header
  93. header.BorderSizePixel = 0
  94. header.Parent = root
  95. corner(header, 14)
  96. local headerMask = Instance.new("Frame")
  97. headerMask.Size = UDim2.new(1, 0, 0, 14)
  98. headerMask.Position = UDim2.new(0, 0, 1, -14)
  99. headerMask.BackgroundColor3 = Theme.Header
  100. headerMask.BorderSizePixel = 0
  101. headerMask.Parent = header
  102.  
  103. local headerLine = Instance.new("Frame")
  104. headerLine.Size = UDim2.new(1, 0, 0, 1)
  105. headerLine.Position = UDim2.new(0, 0, 1, -1)
  106. headerLine.BackgroundColor3 = Theme.Stroke
  107. headerLine.BorderSizePixel = 0
  108. headerLine.Parent = header
  109.  
  110. local accentDot = Instance.new("Frame")
  111. accentDot.Size = UDim2.fromOffset(6, 6)
  112. accentDot.AnchorPoint = Vector2.new(0, 0.5)
  113. accentDot.Position = UDim2.new(0, 14, 0.5, 0)
  114. accentDot.BackgroundColor3 = Theme.Accent
  115. accentDot.BorderSizePixel = 0
  116. accentDot.Parent = header
  117. corner(accentDot, 3)
  118.  
  119. local titleLabel = Instance.new("TextLabel")
  120. titleLabel.BackgroundTransparency = 1
  121. titleLabel.Size = UDim2.new(1, -110, 1, 0)
  122. titleLabel.Position = UDim2.new(0, 28, 0, 0)
  123. titleLabel.Font = Enum.Font.GothamBold
  124. titleLabel.TextSize = 15
  125. titleLabel.TextColor3 = Theme.Text
  126. titleLabel.TextXAlignment = Enum.TextXAlignment.Left
  127. titleLabel.Text = window.Title
  128. titleLabel.Parent = header
  129.  
  130. local controls = Instance.new("Frame")
  131. controls.BackgroundTransparency = 1
  132. controls.Size = UDim2.new(0, 60, 1, 0)
  133. controls.Position = UDim2.new(1, -68, 0, 0)
  134. controls.Parent = header
  135.  
  136. local controlsLayout = Instance.new("UIListLayout")
  137. controlsLayout.FillDirection = Enum.FillDirection.Horizontal
  138. controlsLayout.HorizontalAlignment = Enum.HorizontalAlignment.Right
  139. controlsLayout.VerticalAlignment = Enum.VerticalAlignment.Center
  140. controlsLayout.Padding = UDim.new(0, 12)
  141. controlsLayout.Parent = controls
  142.  
  143. local function makeButton(icon, hoverColor)
  144. local btn = Instance.new("TextButton")
  145. btn.Size = UDim2.fromOffset(24, 24)
  146. btn.BackgroundTransparency = 1
  147. btn.AutoButtonColor = false
  148. btn.Text = ""
  149. btn.BorderSizePixel = 0
  150. btn.Parent = controls
  151.  
  152. local iconLabel = Instance.new("TextLabel")
  153. iconLabel.Size = UDim2.new(1, 0, 1, 0)
  154. iconLabel.BackgroundTransparency = 1
  155. iconLabel.Font = Enum.Font.GothamBold
  156. iconLabel.TextSize = 18
  157. iconLabel.TextColor3 = Theme.SubText
  158. iconLabel.Text = icon
  159. iconLabel.Parent = btn
  160.  
  161. btn.MouseEnter:Connect(function()
  162. tween(iconLabel, { TextColor3 = hoverColor }, 0.15):Play()
  163. tween(btn, { Size = UDim2.fromOffset(26, 26) }, 0.12):Play()
  164. end)
  165. btn.MouseLeave:Connect(function()
  166. tween(iconLabel, { TextColor3 = Theme.SubText }, 0.15):Play()
  167. tween(btn, { Size = UDim2.fromOffset(24, 24) }, 0.12):Play()
  168. end)
  169. return btn
  170. end
  171.  
  172. local minBtn = makeButton("−", Theme.Warning)
  173. local closeBtn = makeButton("×", Theme.Danger)
  174.  
  175. local tabBar = Instance.new("Frame")
  176. tabBar.Name = "TabBar"
  177. tabBar.Size = UDim2.new(0, 112, 1, -50)
  178. tabBar.Position = UDim2.new(0, 0, 0, 50)
  179. tabBar.BackgroundColor3 = Theme.Tab
  180. tabBar.BorderSizePixel = 0
  181. tabBar.Parent = root
  182.  
  183. local tabDivider = Instance.new("Frame")
  184. tabDivider.Size = UDim2.new(0, 1, 1, 0)
  185. tabDivider.Position = UDim2.new(1, 0, 0, 0)
  186. tabDivider.BackgroundColor3 = Theme.Stroke
  187. tabDivider.BorderSizePixel = 0
  188. tabDivider.Parent = tabBar
  189.  
  190. local tabLayout = Instance.new("UIListLayout")
  191. tabLayout.SortOrder = Enum.SortOrder.LayoutOrder
  192. tabLayout.Padding = UDim.new(0, 3)
  193. tabLayout.Parent = tabBar
  194. local tabPad = Instance.new("UIPadding")
  195. tabPad.PaddingTop = UDim.new(0, 10)
  196. tabPad.PaddingLeft = UDim.new(0, 8)
  197. tabPad.PaddingRight = UDim.new(0, 8)
  198. tabPad.PaddingBottom = UDim.new(0, 8)
  199. tabPad.Parent = tabBar
  200.  
  201. local pageContainer = Instance.new("Frame")
  202. pageContainer.Name = "Pages"
  203. pageContainer.Size = UDim2.new(1, -112, 1, -50)
  204. pageContainer.Position = UDim2.new(0, 112, 0, 50)
  205. pageContainer.BackgroundColor3 = Theme.Background
  206. pageContainer.BorderSizePixel = 0
  207. pageContainer.ClipsDescendants = true
  208. pageContainer.Parent = root
  209.  
  210. window.Root = root
  211. window.Header = header
  212. window.TabBar = tabBar
  213. window.PageContainer = pageContainer
  214.  
  215. -- Dragging (unchanged)
  216. local dragging, dragStart, startPos
  217. header.InputBegan:Connect(function(input)
  218. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  219. dragging = true
  220. dragStart = input.Position
  221. startPos = root.Position
  222. end
  223. end)
  224. header.InputEnded:Connect(function(input)
  225. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  226. dragging = false
  227. end
  228. end)
  229. UserInputService.InputChanged:Connect(function(input)
  230. if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  231. local delta = input.Position - dragStart
  232. root.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  233. end
  234. end)
  235.  
  236. -- Minimize (unchanged)
  237. local minimized = false
  238. local expandedSize = root.Size
  239. minBtn.MouseButton1Click:Connect(function()
  240. minimized = not minimized
  241. if minimized then
  242. expandedSize = root.Size
  243. tween(root, { Size = UDim2.fromOffset(expandedSize.X.Offset, 50) }, 0.28, Enum.EasingStyle.Quint, Enum.EasingDirection.Out):Play()
  244. tween(tabBar, { BackgroundTransparency = 1 }, 0.15):Play()
  245. tween(pageContainer, { BackgroundTransparency = 1 }, 0.15):Play()
  246. else
  247. tween(root, { Size = expandedSize }, 0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out):Play()
  248. task.delay(0.1, function()
  249. tween(tabBar, { BackgroundTransparency = 0 }, 0.2):Play()
  250. tween(pageContainer, { BackgroundTransparency = 0 }, 0.2):Play()
  251. end)
  252. end
  253. end)
  254.  
  255. -- Close (unchanged)
  256. closeBtn.MouseButton1Click:Connect(function()
  257. for _, tab in ipairs(window.tabs) do
  258. tween(tab.Button, { BackgroundTransparency = 1, TextTransparency = 1 }, 0.12):Play()
  259. end
  260. local t1 = tween(root, {
  261. Size = UDim2.fromOffset(root.AbsoluteSize.X * 0.7, root.AbsoluteSize.Y * 0.7),
  262. BackgroundTransparency = 1
  263. }, 0.22, Enum.EasingStyle.Back, Enum.EasingDirection.In)
  264. t1:Play()
  265. t1.Completed:Connect(function()
  266. gui:Destroy()
  267. end)
  268. end)
  269.  
  270. -- Open animation (unchanged)
  271. spawn(function()
  272. wait(0.05)
  273. tween(root, { Size = openTargetSize, BackgroundTransparency = 0 }, 0.32, Enum.EasingStyle.Back, Enum.EasingDirection.Out):Play()
  274. end)
  275.  
  276. return window
  277. end
  278.  
  279. -- AddTab (FIXED: DarkUI:SelectTab -> DarkUI.SelectTab)
  280. function DarkUI:AddTab(window, name)
  281. local tabBtn = Instance.new("TextButton")
  282. tabBtn.Size = UDim2.new(1, 0, 0, 36)
  283. tabBtn.BackgroundColor3 = Theme.Tab
  284. tabBtn.AutoButtonColor = false
  285. tabBtn.Text = name
  286. tabBtn.TextColor3 = Theme.SubText
  287. tabBtn.Font = Enum.Font.GothamMedium
  288. tabBtn.TextSize = 14
  289. tabBtn.BorderSizePixel = 0
  290. tabBtn.LayoutOrder = #window.tabs + 1
  291. tabBtn.Parent = window.TabBar
  292. corner(tabBtn, 8)
  293.  
  294. tabBtn.MouseEnter:Connect(function()
  295. if window.currentTab and window.currentTab.Button ~= tabBtn then
  296. tween(tabBtn, { BackgroundColor3 = Theme.Section }, 0.12):Play()
  297. end
  298. end)
  299. tabBtn.MouseLeave:Connect(function()
  300. if window.currentTab and window.currentTab.Button ~= tabBtn then
  301. tween(tabBtn, { BackgroundColor3 = Theme.Tab }, 0.12):Play()
  302. end
  303. end)
  304.  
  305. local page = Instance.new("ScrollingFrame")
  306. page.Size = UDim2.new(1, 0, 1, 0)
  307. page.BackgroundTransparency = 1
  308. page.BorderSizePixel = 0
  309. page.ScrollBarThickness = 3
  310. page.ScrollBarImageColor3 = Theme.SubText
  311. page.Visible = false
  312. page.CanvasSize = UDim2.new(0, 0, 0, 0)
  313. page.Position = UDim2.new(0.03, 0, 0, 0)
  314. page.Parent = window.PageContainer
  315.  
  316. local pageLayout = Instance.new("UIListLayout")
  317. pageLayout.Padding = UDim.new(0, 10)
  318. pageLayout.SortOrder = Enum.SortOrder.LayoutOrder
  319. pageLayout.Parent = page
  320. local pagePad = Instance.new("UIPadding")
  321. pagePad.PaddingTop = UDim.new(0, 12)
  322. pagePad.PaddingLeft = UDim.new(0, 12)
  323. pagePad.PaddingRight = UDim.new(0, 16)
  324. pagePad.PaddingBottom = UDim.new(0, 12)
  325. pagePad.Parent = page
  326.  
  327. local tab = { Button = tabBtn, Page = page, Layout = pageLayout, Window = window }
  328. table.insert(window.tabs, tab)
  329.  
  330. -- FIXED LINE: call with dot, not colon
  331. tabBtn.MouseButton1Click:Connect(function()
  332. DarkUI.SelectTab(window, tab)
  333. end)
  334.  
  335. if #window.tabs == 1 then
  336. DarkUI.SelectTab(window, tab)
  337. end
  338.  
  339. return tab
  340. end
  341.  
  342. -- SelectTab (FIXED: no GroupTransparency, use BackgroundTransparency + Position)
  343. function DarkUI.SelectTab(window, tab)
  344. for _, t in ipairs(window.tabs) do
  345. if t ~= tab then
  346. tween(t.Button, { BackgroundColor3 = Theme.Tab, TextColor3 = Theme.SubText }, 0.18):Play()
  347. if t.Page.Visible then
  348. tween(t.Page, { Position = UDim2.new(-0.02, 0, 0, 0) }, 0.15, Enum.EasingStyle.Quint, Enum.EasingDirection.In):Play()
  349. task.delay(0.15, function()
  350. t.Page.Visible = false
  351. end)
  352. end
  353. end
  354. end
  355.  
  356. tween(tab.Button, { BackgroundColor3 = Theme.TabActive, TextColor3 = Theme.Text }, 0.18):Play()
  357.  
  358. tab.Page.Visible = true
  359. tab.Page.Position = UDim2.new(0.08, 0, 0, 0)
  360. tween(tab.Page, { Position = UDim2.new(0.03, 0, 0, 0) }, 0.25, Enum.EasingStyle.Quint, Enum.EasingDirection.Out):Play()
  361.  
  362. window.currentTab = tab
  363. tab.Page.CanvasSize = UDim2.new(0, 0, 0, tab.Layout.AbsoluteContentSize.Y + 20)
  364. end
  365.  
  366. -- Sections, Toggle, Slider, Button (unchanged, just copy from your original)
  367. function DarkUI:AddSection(tab, name)
  368. local sectionFrame = Instance.new("Frame")
  369. sectionFrame.Size = UDim2.new(1, 0, 0, 0)
  370. sectionFrame.AutomaticSize = Enum.AutomaticSize.Y
  371. sectionFrame.BackgroundColor3 = Theme.Section
  372. sectionFrame.BorderSizePixel = 0
  373. sectionFrame.LayoutOrder = #tab.Page:GetChildren()
  374. sectionFrame.Parent = tab.Page
  375. corner(sectionFrame, 10)
  376. stroke(sectionFrame, Theme.Stroke, 1)
  377.  
  378. local sectionPad = Instance.new("UIPadding")
  379. sectionPad.PaddingTop = UDim.new(0, 10)
  380. sectionPad.PaddingBottom = UDim.new(0, 10)
  381. sectionPad.PaddingLeft = UDim.new(0, 12)
  382. sectionPad.PaddingRight = UDim.new(0, 12)
  383. sectionPad.Parent = sectionFrame
  384.  
  385. local sectionLayout = Instance.new("UIListLayout")
  386. sectionLayout.Padding = UDim.new(0, 8)
  387. sectionLayout.SortOrder = Enum.SortOrder.LayoutOrder
  388. sectionLayout.Parent = sectionFrame
  389.  
  390. local sectionObj = { Frame = sectionFrame, Layout = sectionLayout, Tab = tab }
  391.  
  392. if name and name ~= "" then
  393. local label = Instance.new("TextLabel")
  394. label.Size = UDim2.new(1, 0, 0, 18)
  395. label.BackgroundTransparency = 1
  396. label.Text = name
  397. label.TextColor3 = Theme.SubText
  398. label.Font = Enum.Font.GothamBold
  399. label.TextSize = 12
  400. label.TextXAlignment = Enum.TextXAlignment.Left
  401. label.LayoutOrder = 0
  402. label.Parent = sectionFrame
  403. end
  404.  
  405. local function refreshCanvas()
  406. task.defer(function()
  407. tab.Page.CanvasSize = UDim2.new(0, 0, 0, tab.Layout.AbsoluteContentSize.Y + 20)
  408. end)
  409. end
  410. sectionLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(refreshCanvas)
  411.  
  412. sectionObj.AddToggle = function(settings) return DarkUI:CreateToggle(sectionObj, settings) end
  413. sectionObj.AddSlider = function(settings) return DarkUI:CreateSlider(sectionObj, settings) end
  414. sectionObj.AddButton = function(settings) return DarkUI:CreateButton(sectionObj, settings) end
  415.  
  416. refreshCanvas()
  417. return sectionObj
  418. end
  419.  
  420. function DarkUI:CreateToggle(section, settings)
  421. settings = settings or {}
  422. local container = Instance.new("Frame")
  423. container.Size = UDim2.new(1, 0, 0, 38)
  424. container.BackgroundColor3 = Theme.Section
  425. container.BackgroundTransparency = 1
  426. container.BorderSizePixel = 0
  427. container.LayoutOrder = #section.Frame:GetChildren()
  428. container.Parent = section.Frame
  429. corner(container, 6)
  430.  
  431. local frame = Instance.new("Frame")
  432. frame.Size = UDim2.new(1, -6, 1, -4)
  433. frame.Position = UDim2.new(0, 3, 0, 2)
  434. frame.BackgroundTransparency = 1
  435. frame.Parent = container
  436.  
  437. local nameLabel = Instance.new("TextLabel")
  438. nameLabel.Size = UDim2.new(1, -60, 1, 0)
  439. nameLabel.BackgroundTransparency = 1
  440. nameLabel.Text = settings.Name or "Toggle"
  441. nameLabel.TextColor3 = Theme.Text
  442. nameLabel.Font = Enum.Font.Gotham
  443. nameLabel.TextSize = 14
  444. nameLabel.TextXAlignment = Enum.TextXAlignment.Left
  445. nameLabel.Parent = frame
  446.  
  447. local switchFrame = Instance.new("Frame")
  448. switchFrame.Size = UDim2.fromOffset(46, 24)
  449. switchFrame.AnchorPoint = Vector2.new(1, 0.5)
  450. switchFrame.Position = UDim2.new(1, 0, 0.5, 0)
  451. switchFrame.BackgroundColor3 = settings.Default and Theme.Accent or Theme.AccentOff
  452. switchFrame.BorderSizePixel = 0
  453. switchFrame.Parent = frame
  454. corner(switchFrame, 12)
  455.  
  456. local knob = Instance.new("Frame")
  457. knob.Size = UDim2.fromOffset(18, 18)
  458. knob.Position = settings.Default and UDim2.new(1, -21, 0.5, -9) or UDim2.new(0, 3, 0.5, -9)
  459. knob.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  460. knob.BorderSizePixel = 0
  461. knob.Parent = switchFrame
  462. corner(knob, 9)
  463.  
  464. local toggled = settings.Default or false
  465. local callback = settings.Callback
  466.  
  467. local function setToggle(on)
  468. toggled = on
  469. tween(switchFrame, { BackgroundColor3 = on and Theme.Accent or Theme.AccentOff }, 0.2):Play()
  470. tween(knob, {
  471. Position = on and UDim2.new(1, -21, 0.5, -9) or UDim2.new(0, 3, 0.5, -9),
  472. Size = on and UDim2.fromOffset(20, 20) or UDim2.fromOffset(18, 18)
  473. }, 0.15):Play()
  474. task.delay(0.08, function()
  475. tween(knob, { Size = UDim2.fromOffset(18, 18) }, 0.12):Play()
  476. end)
  477. if callback then callback(on) end
  478. end
  479.  
  480. local btn = Instance.new("TextButton")
  481. btn.Size = UDim2.new(1, 0, 1, 0)
  482. btn.BackgroundTransparency = 1
  483. btn.Text = ""
  484. btn.Parent = frame
  485.  
  486. btn.MouseEnter:Connect(function()
  487. tween(container, { BackgroundTransparency = 0.5 }, 0.12):Play()
  488. end)
  489. btn.MouseLeave:Connect(function()
  490. tween(container, { BackgroundTransparency = 1 }, 0.12):Play()
  491. end)
  492.  
  493. btn.MouseButton1Click:Connect(function()
  494. setToggle(not toggled)
  495. end)
  496.  
  497. return { Set = setToggle, Get = function() return toggled end }
  498. end
  499.  
  500. function DarkUI:CreateSlider(section, settings)
  501. settings = settings or {}
  502. local frame = Instance.new("Frame")
  503. frame.Size = UDim2.new(1, 0, 0, 46)
  504. frame.BackgroundTransparency = 1
  505. frame.LayoutOrder = #section.Frame:GetChildren()
  506. frame.Parent = section.Frame
  507.  
  508. local nameLabel = Instance.new("TextLabel")
  509. nameLabel.Size = UDim2.new(1, -50, 0, 18)
  510. nameLabel.BackgroundTransparency = 1
  511. nameLabel.Text = settings.Name or "Slider"
  512. nameLabel.TextColor3 = Theme.Text
  513. nameLabel.Font = Enum.Font.Gotham
  514. nameLabel.TextSize = 14
  515. nameLabel.TextXAlignment = Enum.TextXAlignment.Left
  516. nameLabel.Parent = frame
  517.  
  518. local valueLabel = Instance.new("TextLabel")
  519. valueLabel.Size = UDim2.new(0, 50, 0, 18)
  520. valueLabel.AnchorPoint = Vector2.new(1, 0)
  521. valueLabel.Position = UDim2.new(1, 0, 0, 0)
  522. valueLabel.BackgroundTransparency = 1
  523. valueLabel.Text = tostring(settings.Default or 0)
  524. valueLabel.TextColor3 = Theme.Accent
  525. valueLabel.Font = Enum.Font.GothamBold
  526. valueLabel.TextSize = 14
  527. valueLabel.TextXAlignment = Enum.TextXAlignment.Right
  528. valueLabel.Parent = frame
  529.  
  530. local track = Instance.new("Frame")
  531. track.Size = UDim2.new(1, 0, 0, 6)
  532. track.Position = UDim2.new(0, 0, 0, 28)
  533. track.BackgroundColor3 = Theme.AccentOff
  534. track.BorderSizePixel = 0
  535. track.Parent = frame
  536. corner(track, 3)
  537.  
  538. local fill = Instance.new("Frame")
  539. fill.Size = UDim2.new(0, 0, 1, 0)
  540. fill.BackgroundColor3 = Theme.Accent
  541. fill.BorderSizePixel = 0
  542. fill.Parent = track
  543. corner(fill, 3)
  544.  
  545. local thumb = Instance.new("Frame")
  546. thumb.Size = UDim2.fromOffset(16, 16)
  547. thumb.AnchorPoint = Vector2.new(0.5, 0.5)
  548. thumb.Position = UDim2.new(0, 0, 0.5, 0)
  549. thumb.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  550. thumb.BorderSizePixel = 0
  551. thumb.ZIndex = 2
  552. thumb.Parent = track
  553. corner(thumb, 8)
  554.  
  555. thumb.MouseEnter:Connect(function()
  556. tween(thumb, { Size = UDim2.fromOffset(18, 18) }, 0.12):Play()
  557. end)
  558. thumb.MouseLeave:Connect(function()
  559. if not dragging then
  560. tween(thumb, { Size = UDim2.fromOffset(16, 16) }, 0.12):Play()
  561. end
  562. end)
  563.  
  564. local minVal = settings.Min or 0
  565. local maxVal = settings.Max or 100
  566. local step = settings.Step or 1
  567. local callback = settings.Callback
  568.  
  569. local function updateValue(value, animate)
  570. value = math.clamp(math.floor(value / step + 0.5) * step, minVal, maxVal)
  571. local fraction = (maxVal > minVal) and (value - minVal) / (maxVal - minVal) or 0
  572. local goalFill = UDim2.new(fraction, 0, 1, 0)
  573. local goalThumb = UDim2.new(fraction, 0, 0.5, 0)
  574. if animate then
  575. tween(fill, { Size = goalFill }, 0.08):Play()
  576. tween(thumb, { Position = goalThumb }, 0.08):Play()
  577. else
  578. fill.Size = goalFill
  579. thumb.Position = goalThumb
  580. end
  581. valueLabel.Text = tostring(value)
  582. if callback then callback(value) end
  583. return value
  584. end
  585. updateValue(settings.Default or minVal, false)
  586.  
  587. local dragging = false
  588. local function beginDrag(input)
  589. dragging = true
  590. tween(thumb, { Size = UDim2.fromOffset(20, 20) }, 0.1):Play()
  591. input.Changed:Connect(function()
  592. if input.UserInputState == Enum.UserInputState.End then
  593. dragging = false
  594. tween(thumb, { Size = UDim2.fromOffset(16, 16) }, 0.12):Play()
  595. end
  596. end)
  597. end
  598. thumb.InputBegan:Connect(function(input)
  599. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  600. beginDrag(input)
  601. end
  602. end)
  603. track.InputBegan:Connect(function(input)
  604. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  605. local fraction = math.clamp((input.Position.X - track.AbsolutePosition.X) / track.AbsoluteSize.X, 0, 1)
  606. updateValue(minVal + fraction * (maxVal - minVal), true)
  607. beginDrag(input)
  608. end
  609. end)
  610. UserInputService.InputChanged:Connect(function(input)
  611. if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
  612. local fraction = math.clamp((input.Position.X - track.AbsolutePosition.X) / track.AbsoluteSize.X, 0, 1)
  613. updateValue(minVal + fraction * (maxVal - minVal), false)
  614. end
  615. end)
  616.  
  617. return { Set = function(v) updateValue(v, true) end }
  618. end
  619.  
  620. function DarkUI:CreateButton(section, settings)
  621. settings = settings or {}
  622. local btn = Instance.new("TextButton")
  623. btn.Size = UDim2.new(1, 0, 0, 38)
  624. btn.BackgroundColor3 = Theme.Accent
  625. btn.AutoButtonColor = false
  626. btn.Text = settings.Name or "Button"
  627. btn.TextColor3 = Color3.fromRGB(255, 255, 255)
  628. btn.Font = Enum.Font.GothamSemibold
  629. btn.TextSize = 14
  630. btn.BorderSizePixel = 0
  631. btn.LayoutOrder = #section.Frame:GetChildren()
  632. btn.Parent = section.Frame
  633. corner(btn, 9)
  634. stroke(btn, Theme.AccentGlow, 0)
  635.  
  636. local ripple = Instance.new("Frame")
  637. ripple.Size = UDim2.fromScale(0, 0)
  638. ripple.AnchorPoint = Vector2.new(0.5, 0.5)
  639. ripple.Position = UDim2.fromScale(0.5, 0.5)
  640. ripple.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  641. ripple.BackgroundTransparency = 1
  642. ripple.BorderSizePixel = 0
  643. ripple.ZIndex = btn.ZIndex + 1
  644. ripple.Parent = btn
  645. corner(ripple, 9)
  646.  
  647. btn.MouseEnter:Connect(function()
  648. tween(btn, { BackgroundColor3 = Color3.fromRGB(110, 120, 255) }, 0.15):Play()
  649. end)
  650. btn.MouseLeave:Connect(function()
  651. tween(btn, { BackgroundColor3 = Theme.Accent }, 0.15):Play()
  652. end)
  653. btn.MouseButton1Down:Connect(function()
  654. tween(btn, { Size = UDim2.new(1, -3, 0, 36) }, 0.08):Play()
  655. ripple.Size = UDim2.fromScale(0, 0)
  656. ripple.BackgroundTransparency = 0.7
  657. tween(ripple, { Size = UDim2.fromScale(1.5, 2), BackgroundTransparency = 1 }, 0.4):Play()
  658. end)
  659. btn.MouseButton1Up:Connect(function()
  660. tween(btn, { Size = UDim2.new(1, 0, 0, 38) }, 0.12, Enum.EasingStyle.Back, Enum.EasingDirection.Out):Play()
  661. end)
  662. btn.MouseButton1Click:Connect(function()
  663. if settings.Callback then settings.Callback() end
  664. end)
  665.  
  666. return btn
  667. end
  668.  
  669. return DarkUI
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment