Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- DarkUI Premium — Advanced Boxed UI Library for Roblox
- Fixed: SelectTab call in AddTab (colon -> dot)
- Fixed: GroupTransparency replaced with Position+Transparency tween
- --]]
- local TweenService = game:GetService("TweenService")
- local UserInputService = game:GetService("UserInputService")
- local Players = game:GetService("Players")
- local Player = Players.LocalPlayer
- local DarkUI = {}
- DarkUI.__index = DarkUI
- -- Theme (unchanged)
- local Theme = {
- Background = Color3.fromRGB(16, 16, 20),
- Header = Color3.fromRGB(22, 22, 28),
- Tab = Color3.fromRGB(26, 26, 32),
- TabActive = Color3.fromRGB(45, 45, 55),
- Section = Color3.fromRGB(28, 28, 34),
- Text = Color3.fromRGB(240, 240, 245),
- SubText = Color3.fromRGB(140, 140, 152),
- Accent = Color3.fromRGB(99, 110, 255),
- AccentGlow = Color3.fromRGB(79, 90, 235),
- AccentOff = Color3.fromRGB(55, 55, 65),
- Danger = Color3.fromRGB(255, 73, 73),
- Warning = Color3.fromRGB(255, 180, 36),
- Success = Color3.fromRGB(87, 242, 135),
- Stroke = Color3.fromRGB(45, 45, 52),
- StrokeLight = Color3.fromRGB(60, 60, 70),
- Shadow = Color3.fromRGB(0, 0, 0),
- }
- local function corner(inst, radius)
- local c = Instance.new("UICorner")
- c.CornerRadius = UDim.new(0, radius or 10)
- c.Parent = inst
- return c
- end
- local function stroke(inst, color, thickness)
- local s = Instance.new("UIStroke")
- s.Color = color or Theme.Stroke
- s.Thickness = thickness or 1
- s.Parent = inst
- return s
- end
- local function tween(inst, props, time, style, dir)
- return TweenService:Create(inst, TweenInfo.new(
- time or 0.25,
- style or Enum.EasingStyle.Quint,
- dir or Enum.EasingDirection.Out
- ), props)
- end
- -- Window (unchanged)
- function DarkUI:CreateWindow(config)
- config = config or {}
- local window = setmetatable({}, DarkUI)
- window.Title = config.Title or "Window"
- window.Size = config.Size or Vector2.new(510, 425)
- window.tabs = {}
- window.currentTab = nil
- local gui = Instance.new("ScreenGui")
- gui.Name = "DarkUI"
- gui.ResetOnSpawn = false
- gui.IgnoreGuiInset = true
- gui.Parent = Player:WaitForChild("PlayerGui")
- window.Gui = gui
- local root = Instance.new("Frame")
- root.Name = "Root"
- root.Size = UDim2.fromOffset(window.Size.X, window.Size.Y)
- root.Position = UDim2.new(0.5, -window.Size.X / 2, 0.5, -window.Size.Y / 2)
- root.BackgroundColor3 = Theme.Background
- root.BorderSizePixel = 0
- root.ClipsDescendants = true
- root.Parent = gui
- corner(root, 14)
- stroke(root, Theme.Stroke, 1)
- root.Size = UDim2.fromOffset(window.Size.X * 0.85, window.Size.Y * 0.85)
- root.BackgroundTransparency = 1
- local openTargetSize = UDim2.fromOffset(window.Size.X, window.Size.Y)
- local header = Instance.new("Frame")
- header.Name = "Header"
- header.Size = UDim2.new(1, 0, 0, 50)
- header.BackgroundColor3 = Theme.Header
- header.BorderSizePixel = 0
- header.Parent = root
- corner(header, 14)
- local headerMask = Instance.new("Frame")
- headerMask.Size = UDim2.new(1, 0, 0, 14)
- headerMask.Position = UDim2.new(0, 0, 1, -14)
- headerMask.BackgroundColor3 = Theme.Header
- headerMask.BorderSizePixel = 0
- headerMask.Parent = header
- local headerLine = Instance.new("Frame")
- headerLine.Size = UDim2.new(1, 0, 0, 1)
- headerLine.Position = UDim2.new(0, 0, 1, -1)
- headerLine.BackgroundColor3 = Theme.Stroke
- headerLine.BorderSizePixel = 0
- headerLine.Parent = header
- local accentDot = Instance.new("Frame")
- accentDot.Size = UDim2.fromOffset(6, 6)
- accentDot.AnchorPoint = Vector2.new(0, 0.5)
- accentDot.Position = UDim2.new(0, 14, 0.5, 0)
- accentDot.BackgroundColor3 = Theme.Accent
- accentDot.BorderSizePixel = 0
- accentDot.Parent = header
- corner(accentDot, 3)
- local titleLabel = Instance.new("TextLabel")
- titleLabel.BackgroundTransparency = 1
- titleLabel.Size = UDim2.new(1, -110, 1, 0)
- titleLabel.Position = UDim2.new(0, 28, 0, 0)
- titleLabel.Font = Enum.Font.GothamBold
- titleLabel.TextSize = 15
- titleLabel.TextColor3 = Theme.Text
- titleLabel.TextXAlignment = Enum.TextXAlignment.Left
- titleLabel.Text = window.Title
- titleLabel.Parent = header
- local controls = Instance.new("Frame")
- controls.BackgroundTransparency = 1
- controls.Size = UDim2.new(0, 60, 1, 0)
- controls.Position = UDim2.new(1, -68, 0, 0)
- controls.Parent = header
- local controlsLayout = Instance.new("UIListLayout")
- controlsLayout.FillDirection = Enum.FillDirection.Horizontal
- controlsLayout.HorizontalAlignment = Enum.HorizontalAlignment.Right
- controlsLayout.VerticalAlignment = Enum.VerticalAlignment.Center
- controlsLayout.Padding = UDim.new(0, 12)
- controlsLayout.Parent = controls
- local function makeButton(icon, hoverColor)
- local btn = Instance.new("TextButton")
- btn.Size = UDim2.fromOffset(24, 24)
- btn.BackgroundTransparency = 1
- btn.AutoButtonColor = false
- btn.Text = ""
- btn.BorderSizePixel = 0
- btn.Parent = controls
- local iconLabel = Instance.new("TextLabel")
- iconLabel.Size = UDim2.new(1, 0, 1, 0)
- iconLabel.BackgroundTransparency = 1
- iconLabel.Font = Enum.Font.GothamBold
- iconLabel.TextSize = 18
- iconLabel.TextColor3 = Theme.SubText
- iconLabel.Text = icon
- iconLabel.Parent = btn
- btn.MouseEnter:Connect(function()
- tween(iconLabel, { TextColor3 = hoverColor }, 0.15):Play()
- tween(btn, { Size = UDim2.fromOffset(26, 26) }, 0.12):Play()
- end)
- btn.MouseLeave:Connect(function()
- tween(iconLabel, { TextColor3 = Theme.SubText }, 0.15):Play()
- tween(btn, { Size = UDim2.fromOffset(24, 24) }, 0.12):Play()
- end)
- return btn
- end
- local minBtn = makeButton("−", Theme.Warning)
- local closeBtn = makeButton("×", Theme.Danger)
- local tabBar = Instance.new("Frame")
- tabBar.Name = "TabBar"
- tabBar.Size = UDim2.new(0, 112, 1, -50)
- tabBar.Position = UDim2.new(0, 0, 0, 50)
- tabBar.BackgroundColor3 = Theme.Tab
- tabBar.BorderSizePixel = 0
- tabBar.Parent = root
- local tabDivider = Instance.new("Frame")
- tabDivider.Size = UDim2.new(0, 1, 1, 0)
- tabDivider.Position = UDim2.new(1, 0, 0, 0)
- tabDivider.BackgroundColor3 = Theme.Stroke
- tabDivider.BorderSizePixel = 0
- tabDivider.Parent = tabBar
- local tabLayout = Instance.new("UIListLayout")
- tabLayout.SortOrder = Enum.SortOrder.LayoutOrder
- tabLayout.Padding = UDim.new(0, 3)
- tabLayout.Parent = tabBar
- local tabPad = Instance.new("UIPadding")
- tabPad.PaddingTop = UDim.new(0, 10)
- tabPad.PaddingLeft = UDim.new(0, 8)
- tabPad.PaddingRight = UDim.new(0, 8)
- tabPad.PaddingBottom = UDim.new(0, 8)
- tabPad.Parent = tabBar
- local pageContainer = Instance.new("Frame")
- pageContainer.Name = "Pages"
- pageContainer.Size = UDim2.new(1, -112, 1, -50)
- pageContainer.Position = UDim2.new(0, 112, 0, 50)
- pageContainer.BackgroundColor3 = Theme.Background
- pageContainer.BorderSizePixel = 0
- pageContainer.ClipsDescendants = true
- pageContainer.Parent = root
- window.Root = root
- window.Header = header
- window.TabBar = tabBar
- window.PageContainer = pageContainer
- -- Dragging (unchanged)
- local dragging, dragStart, startPos
- header.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStart = input.Position
- startPos = root.Position
- end
- end)
- header.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = false
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
- local delta = input.Position - dragStart
- root.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- end)
- -- Minimize (unchanged)
- local minimized = false
- local expandedSize = root.Size
- minBtn.MouseButton1Click:Connect(function()
- minimized = not minimized
- if minimized then
- expandedSize = root.Size
- tween(root, { Size = UDim2.fromOffset(expandedSize.X.Offset, 50) }, 0.28, Enum.EasingStyle.Quint, Enum.EasingDirection.Out):Play()
- tween(tabBar, { BackgroundTransparency = 1 }, 0.15):Play()
- tween(pageContainer, { BackgroundTransparency = 1 }, 0.15):Play()
- else
- tween(root, { Size = expandedSize }, 0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out):Play()
- task.delay(0.1, function()
- tween(tabBar, { BackgroundTransparency = 0 }, 0.2):Play()
- tween(pageContainer, { BackgroundTransparency = 0 }, 0.2):Play()
- end)
- end
- end)
- -- Close (unchanged)
- closeBtn.MouseButton1Click:Connect(function()
- for _, tab in ipairs(window.tabs) do
- tween(tab.Button, { BackgroundTransparency = 1, TextTransparency = 1 }, 0.12):Play()
- end
- local t1 = tween(root, {
- Size = UDim2.fromOffset(root.AbsoluteSize.X * 0.7, root.AbsoluteSize.Y * 0.7),
- BackgroundTransparency = 1
- }, 0.22, Enum.EasingStyle.Back, Enum.EasingDirection.In)
- t1:Play()
- t1.Completed:Connect(function()
- gui:Destroy()
- end)
- end)
- -- Open animation (unchanged)
- spawn(function()
- wait(0.05)
- tween(root, { Size = openTargetSize, BackgroundTransparency = 0 }, 0.32, Enum.EasingStyle.Back, Enum.EasingDirection.Out):Play()
- end)
- return window
- end
- -- AddTab (FIXED: DarkUI:SelectTab -> DarkUI.SelectTab)
- function DarkUI:AddTab(window, name)
- local tabBtn = Instance.new("TextButton")
- tabBtn.Size = UDim2.new(1, 0, 0, 36)
- tabBtn.BackgroundColor3 = Theme.Tab
- tabBtn.AutoButtonColor = false
- tabBtn.Text = name
- tabBtn.TextColor3 = Theme.SubText
- tabBtn.Font = Enum.Font.GothamMedium
- tabBtn.TextSize = 14
- tabBtn.BorderSizePixel = 0
- tabBtn.LayoutOrder = #window.tabs + 1
- tabBtn.Parent = window.TabBar
- corner(tabBtn, 8)
- tabBtn.MouseEnter:Connect(function()
- if window.currentTab and window.currentTab.Button ~= tabBtn then
- tween(tabBtn, { BackgroundColor3 = Theme.Section }, 0.12):Play()
- end
- end)
- tabBtn.MouseLeave:Connect(function()
- if window.currentTab and window.currentTab.Button ~= tabBtn then
- tween(tabBtn, { BackgroundColor3 = Theme.Tab }, 0.12):Play()
- end
- end)
- local page = Instance.new("ScrollingFrame")
- page.Size = UDim2.new(1, 0, 1, 0)
- page.BackgroundTransparency = 1
- page.BorderSizePixel = 0
- page.ScrollBarThickness = 3
- page.ScrollBarImageColor3 = Theme.SubText
- page.Visible = false
- page.CanvasSize = UDim2.new(0, 0, 0, 0)
- page.Position = UDim2.new(0.03, 0, 0, 0)
- page.Parent = window.PageContainer
- local pageLayout = Instance.new("UIListLayout")
- pageLayout.Padding = UDim.new(0, 10)
- pageLayout.SortOrder = Enum.SortOrder.LayoutOrder
- pageLayout.Parent = page
- local pagePad = Instance.new("UIPadding")
- pagePad.PaddingTop = UDim.new(0, 12)
- pagePad.PaddingLeft = UDim.new(0, 12)
- pagePad.PaddingRight = UDim.new(0, 16)
- pagePad.PaddingBottom = UDim.new(0, 12)
- pagePad.Parent = page
- local tab = { Button = tabBtn, Page = page, Layout = pageLayout, Window = window }
- table.insert(window.tabs, tab)
- -- FIXED LINE: call with dot, not colon
- tabBtn.MouseButton1Click:Connect(function()
- DarkUI.SelectTab(window, tab)
- end)
- if #window.tabs == 1 then
- DarkUI.SelectTab(window, tab)
- end
- return tab
- end
- -- SelectTab (FIXED: no GroupTransparency, use BackgroundTransparency + Position)
- function DarkUI.SelectTab(window, tab)
- for _, t in ipairs(window.tabs) do
- if t ~= tab then
- tween(t.Button, { BackgroundColor3 = Theme.Tab, TextColor3 = Theme.SubText }, 0.18):Play()
- if t.Page.Visible then
- tween(t.Page, { Position = UDim2.new(-0.02, 0, 0, 0) }, 0.15, Enum.EasingStyle.Quint, Enum.EasingDirection.In):Play()
- task.delay(0.15, function()
- t.Page.Visible = false
- end)
- end
- end
- end
- tween(tab.Button, { BackgroundColor3 = Theme.TabActive, TextColor3 = Theme.Text }, 0.18):Play()
- tab.Page.Visible = true
- tab.Page.Position = UDim2.new(0.08, 0, 0, 0)
- tween(tab.Page, { Position = UDim2.new(0.03, 0, 0, 0) }, 0.25, Enum.EasingStyle.Quint, Enum.EasingDirection.Out):Play()
- window.currentTab = tab
- tab.Page.CanvasSize = UDim2.new(0, 0, 0, tab.Layout.AbsoluteContentSize.Y + 20)
- end
- -- Sections, Toggle, Slider, Button (unchanged, just copy from your original)
- function DarkUI:AddSection(tab, name)
- local sectionFrame = Instance.new("Frame")
- sectionFrame.Size = UDim2.new(1, 0, 0, 0)
- sectionFrame.AutomaticSize = Enum.AutomaticSize.Y
- sectionFrame.BackgroundColor3 = Theme.Section
- sectionFrame.BorderSizePixel = 0
- sectionFrame.LayoutOrder = #tab.Page:GetChildren()
- sectionFrame.Parent = tab.Page
- corner(sectionFrame, 10)
- stroke(sectionFrame, Theme.Stroke, 1)
- local sectionPad = Instance.new("UIPadding")
- sectionPad.PaddingTop = UDim.new(0, 10)
- sectionPad.PaddingBottom = UDim.new(0, 10)
- sectionPad.PaddingLeft = UDim.new(0, 12)
- sectionPad.PaddingRight = UDim.new(0, 12)
- sectionPad.Parent = sectionFrame
- local sectionLayout = Instance.new("UIListLayout")
- sectionLayout.Padding = UDim.new(0, 8)
- sectionLayout.SortOrder = Enum.SortOrder.LayoutOrder
- sectionLayout.Parent = sectionFrame
- local sectionObj = { Frame = sectionFrame, Layout = sectionLayout, Tab = tab }
- if name and name ~= "" then
- local label = Instance.new("TextLabel")
- label.Size = UDim2.new(1, 0, 0, 18)
- label.BackgroundTransparency = 1
- label.Text = name
- label.TextColor3 = Theme.SubText
- label.Font = Enum.Font.GothamBold
- label.TextSize = 12
- label.TextXAlignment = Enum.TextXAlignment.Left
- label.LayoutOrder = 0
- label.Parent = sectionFrame
- end
- local function refreshCanvas()
- task.defer(function()
- tab.Page.CanvasSize = UDim2.new(0, 0, 0, tab.Layout.AbsoluteContentSize.Y + 20)
- end)
- end
- sectionLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(refreshCanvas)
- sectionObj.AddToggle = function(settings) return DarkUI:CreateToggle(sectionObj, settings) end
- sectionObj.AddSlider = function(settings) return DarkUI:CreateSlider(sectionObj, settings) end
- sectionObj.AddButton = function(settings) return DarkUI:CreateButton(sectionObj, settings) end
- refreshCanvas()
- return sectionObj
- end
- function DarkUI:CreateToggle(section, settings)
- settings = settings or {}
- local container = Instance.new("Frame")
- container.Size = UDim2.new(1, 0, 0, 38)
- container.BackgroundColor3 = Theme.Section
- container.BackgroundTransparency = 1
- container.BorderSizePixel = 0
- container.LayoutOrder = #section.Frame:GetChildren()
- container.Parent = section.Frame
- corner(container, 6)
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(1, -6, 1, -4)
- frame.Position = UDim2.new(0, 3, 0, 2)
- frame.BackgroundTransparency = 1
- frame.Parent = container
- local nameLabel = Instance.new("TextLabel")
- nameLabel.Size = UDim2.new(1, -60, 1, 0)
- nameLabel.BackgroundTransparency = 1
- nameLabel.Text = settings.Name or "Toggle"
- nameLabel.TextColor3 = Theme.Text
- nameLabel.Font = Enum.Font.Gotham
- nameLabel.TextSize = 14
- nameLabel.TextXAlignment = Enum.TextXAlignment.Left
- nameLabel.Parent = frame
- local switchFrame = Instance.new("Frame")
- switchFrame.Size = UDim2.fromOffset(46, 24)
- switchFrame.AnchorPoint = Vector2.new(1, 0.5)
- switchFrame.Position = UDim2.new(1, 0, 0.5, 0)
- switchFrame.BackgroundColor3 = settings.Default and Theme.Accent or Theme.AccentOff
- switchFrame.BorderSizePixel = 0
- switchFrame.Parent = frame
- corner(switchFrame, 12)
- local knob = Instance.new("Frame")
- knob.Size = UDim2.fromOffset(18, 18)
- knob.Position = settings.Default and UDim2.new(1, -21, 0.5, -9) or UDim2.new(0, 3, 0.5, -9)
- knob.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- knob.BorderSizePixel = 0
- knob.Parent = switchFrame
- corner(knob, 9)
- local toggled = settings.Default or false
- local callback = settings.Callback
- local function setToggle(on)
- toggled = on
- tween(switchFrame, { BackgroundColor3 = on and Theme.Accent or Theme.AccentOff }, 0.2):Play()
- tween(knob, {
- Position = on and UDim2.new(1, -21, 0.5, -9) or UDim2.new(0, 3, 0.5, -9),
- Size = on and UDim2.fromOffset(20, 20) or UDim2.fromOffset(18, 18)
- }, 0.15):Play()
- task.delay(0.08, function()
- tween(knob, { Size = UDim2.fromOffset(18, 18) }, 0.12):Play()
- end)
- if callback then callback(on) end
- end
- local btn = Instance.new("TextButton")
- btn.Size = UDim2.new(1, 0, 1, 0)
- btn.BackgroundTransparency = 1
- btn.Text = ""
- btn.Parent = frame
- btn.MouseEnter:Connect(function()
- tween(container, { BackgroundTransparency = 0.5 }, 0.12):Play()
- end)
- btn.MouseLeave:Connect(function()
- tween(container, { BackgroundTransparency = 1 }, 0.12):Play()
- end)
- btn.MouseButton1Click:Connect(function()
- setToggle(not toggled)
- end)
- return { Set = setToggle, Get = function() return toggled end }
- end
- function DarkUI:CreateSlider(section, settings)
- settings = settings or {}
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(1, 0, 0, 46)
- frame.BackgroundTransparency = 1
- frame.LayoutOrder = #section.Frame:GetChildren()
- frame.Parent = section.Frame
- local nameLabel = Instance.new("TextLabel")
- nameLabel.Size = UDim2.new(1, -50, 0, 18)
- nameLabel.BackgroundTransparency = 1
- nameLabel.Text = settings.Name or "Slider"
- nameLabel.TextColor3 = Theme.Text
- nameLabel.Font = Enum.Font.Gotham
- nameLabel.TextSize = 14
- nameLabel.TextXAlignment = Enum.TextXAlignment.Left
- nameLabel.Parent = frame
- local valueLabel = Instance.new("TextLabel")
- valueLabel.Size = UDim2.new(0, 50, 0, 18)
- valueLabel.AnchorPoint = Vector2.new(1, 0)
- valueLabel.Position = UDim2.new(1, 0, 0, 0)
- valueLabel.BackgroundTransparency = 1
- valueLabel.Text = tostring(settings.Default or 0)
- valueLabel.TextColor3 = Theme.Accent
- valueLabel.Font = Enum.Font.GothamBold
- valueLabel.TextSize = 14
- valueLabel.TextXAlignment = Enum.TextXAlignment.Right
- valueLabel.Parent = frame
- local track = Instance.new("Frame")
- track.Size = UDim2.new(1, 0, 0, 6)
- track.Position = UDim2.new(0, 0, 0, 28)
- track.BackgroundColor3 = Theme.AccentOff
- track.BorderSizePixel = 0
- track.Parent = frame
- corner(track, 3)
- local fill = Instance.new("Frame")
- fill.Size = UDim2.new(0, 0, 1, 0)
- fill.BackgroundColor3 = Theme.Accent
- fill.BorderSizePixel = 0
- fill.Parent = track
- corner(fill, 3)
- local thumb = Instance.new("Frame")
- thumb.Size = UDim2.fromOffset(16, 16)
- thumb.AnchorPoint = Vector2.new(0.5, 0.5)
- thumb.Position = UDim2.new(0, 0, 0.5, 0)
- thumb.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- thumb.BorderSizePixel = 0
- thumb.ZIndex = 2
- thumb.Parent = track
- corner(thumb, 8)
- thumb.MouseEnter:Connect(function()
- tween(thumb, { Size = UDim2.fromOffset(18, 18) }, 0.12):Play()
- end)
- thumb.MouseLeave:Connect(function()
- if not dragging then
- tween(thumb, { Size = UDim2.fromOffset(16, 16) }, 0.12):Play()
- end
- end)
- local minVal = settings.Min or 0
- local maxVal = settings.Max or 100
- local step = settings.Step or 1
- local callback = settings.Callback
- local function updateValue(value, animate)
- value = math.clamp(math.floor(value / step + 0.5) * step, minVal, maxVal)
- local fraction = (maxVal > minVal) and (value - minVal) / (maxVal - minVal) or 0
- local goalFill = UDim2.new(fraction, 0, 1, 0)
- local goalThumb = UDim2.new(fraction, 0, 0.5, 0)
- if animate then
- tween(fill, { Size = goalFill }, 0.08):Play()
- tween(thumb, { Position = goalThumb }, 0.08):Play()
- else
- fill.Size = goalFill
- thumb.Position = goalThumb
- end
- valueLabel.Text = tostring(value)
- if callback then callback(value) end
- return value
- end
- updateValue(settings.Default or minVal, false)
- local dragging = false
- local function beginDrag(input)
- dragging = true
- tween(thumb, { Size = UDim2.fromOffset(20, 20) }, 0.1):Play()
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- tween(thumb, { Size = UDim2.fromOffset(16, 16) }, 0.12):Play()
- end
- end)
- end
- thumb.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- beginDrag(input)
- end
- end)
- track.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- local fraction = math.clamp((input.Position.X - track.AbsolutePosition.X) / track.AbsoluteSize.X, 0, 1)
- updateValue(minVal + fraction * (maxVal - minVal), true)
- beginDrag(input)
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
- local fraction = math.clamp((input.Position.X - track.AbsolutePosition.X) / track.AbsoluteSize.X, 0, 1)
- updateValue(minVal + fraction * (maxVal - minVal), false)
- end
- end)
- return { Set = function(v) updateValue(v, true) end }
- end
- function DarkUI:CreateButton(section, settings)
- settings = settings or {}
- local btn = Instance.new("TextButton")
- btn.Size = UDim2.new(1, 0, 0, 38)
- btn.BackgroundColor3 = Theme.Accent
- btn.AutoButtonColor = false
- btn.Text = settings.Name or "Button"
- btn.TextColor3 = Color3.fromRGB(255, 255, 255)
- btn.Font = Enum.Font.GothamSemibold
- btn.TextSize = 14
- btn.BorderSizePixel = 0
- btn.LayoutOrder = #section.Frame:GetChildren()
- btn.Parent = section.Frame
- corner(btn, 9)
- stroke(btn, Theme.AccentGlow, 0)
- local ripple = Instance.new("Frame")
- ripple.Size = UDim2.fromScale(0, 0)
- ripple.AnchorPoint = Vector2.new(0.5, 0.5)
- ripple.Position = UDim2.fromScale(0.5, 0.5)
- ripple.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- ripple.BackgroundTransparency = 1
- ripple.BorderSizePixel = 0
- ripple.ZIndex = btn.ZIndex + 1
- ripple.Parent = btn
- corner(ripple, 9)
- btn.MouseEnter:Connect(function()
- tween(btn, { BackgroundColor3 = Color3.fromRGB(110, 120, 255) }, 0.15):Play()
- end)
- btn.MouseLeave:Connect(function()
- tween(btn, { BackgroundColor3 = Theme.Accent }, 0.15):Play()
- end)
- btn.MouseButton1Down:Connect(function()
- tween(btn, { Size = UDim2.new(1, -3, 0, 36) }, 0.08):Play()
- ripple.Size = UDim2.fromScale(0, 0)
- ripple.BackgroundTransparency = 0.7
- tween(ripple, { Size = UDim2.fromScale(1.5, 2), BackgroundTransparency = 1 }, 0.4):Play()
- end)
- btn.MouseButton1Up:Connect(function()
- tween(btn, { Size = UDim2.new(1, 0, 0, 38) }, 0.12, Enum.EasingStyle.Back, Enum.EasingDirection.Out):Play()
- end)
- btn.MouseButton1Click:Connect(function()
- if settings.Callback then settings.Callback() end
- end)
- return btn
- end
- return DarkUI
Advertisement