Advertisement
JackPackS

onecrack

Oct 17th, 2024 (edited)
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.49 KB | None | 0 0
  1. local EnhancedNebulaLib = {}
  2.  
  3. local TweenService = game:GetService("TweenService")
  4. local UserInputService = game:GetService("UserInputService")
  5.  
  6. local COLORS = {
  7.     BACKGROUND = Color3.fromRGB(30, 30, 35),
  8.     HEADER = Color3.fromRGB(40, 40, 45),
  9.     SECTION = Color3.fromRGB(35, 35, 40),
  10.     TEXT = Color3.fromRGB(200, 200, 200),
  11.     ACCENT = Color3.fromRGB(255, 128, 0),
  12.     TOGGLE_OFF = Color3.fromRGB(60, 60, 65),
  13.     TOGGLE_ON = Color3.fromRGB(255, 128, 0),
  14.     SLIDER_BG = Color3.fromRGB(50, 50, 55),
  15.     SLIDER_FILL = Color3.fromRGB(255, 128, 0),
  16.     DROPDOWN_BG = Color3.fromRGB(45, 45, 50)
  17. }
  18.  
  19. local function createReusableContainer(name, size, parent)
  20.     local container = Instance.new("Frame")
  21.     container.Name = name
  22.     container.Size = size
  23.     container.BackgroundColor3 = COLORS.SECTION
  24.     container.BorderSizePixel = 0
  25.     container.Parent = parent
  26.    
  27.     local corner = Instance.new("UICorner")
  28.     corner.CornerRadius = UDim.new(0, 4)
  29.     corner.Parent = container
  30.    
  31.     return container
  32. end
  33.  
  34. function EnhancedNebulaLib:CreateWindow(config)
  35.     config = config or {}
  36.     local windowName = config.Name or "Enhanced Nebula Window"
  37.    
  38.     local NebulaGUI = Instance.new("ScreenGui")
  39.     NebulaGUI.Name = "EnhancedNebulaGUI"
  40.     NebulaGUI.Parent = game.CoreGui
  41.    
  42.     local MainFrame = createReusableContainer("MainFrame", UDim2.new(0, 700, 0, 500), NebulaGUI)
  43.     MainFrame.Position = UDim2.new(0.5, -350, 0.5, -250)
  44.     MainFrame.BackgroundColor3 = COLORS.BACKGROUND
  45.    
  46.     local TitleBar = createReusableContainer("TitleBar", UDim2.new(1, 0, 0, 30), MainFrame)
  47.     TitleBar.BackgroundColor3 = COLORS.HEADER
  48.    
  49.     local TitleText = Instance.new("TextLabel")
  50.     TitleText.Name = "TitleText"
  51.     TitleText.Size = UDim2.new(1, -10, 1, 0)
  52.     TitleText.Position = UDim2.new(0, 10, 0, 0)
  53.     TitleText.BackgroundTransparency = 1
  54.     TitleText.Text = windowName
  55.     TitleText.TextColor3 = COLORS.TEXT
  56.     TitleText.TextSize = 16
  57.     TitleText.Font = Enum.Font.SourceSansBold
  58.     TitleText.TextXAlignment = Enum.TextXAlignment.Left
  59.     TitleText.Parent = TitleBar
  60.    
  61.     local ContentFrame = createReusableContainer("ContentFrame", UDim2.new(1, -20, 1, -40), MainFrame)
  62.     ContentFrame.Position = UDim2.new(0, 10, 0, 35)
  63.    
  64.     local TabContainer = createReusableContainer("TabContainer", UDim2.new(1, 0, 0, 30), ContentFrame)
  65.     local TabContent = createReusableContainer("TabContent", UDim2.new(1, 0, 1, -35), ContentFrame)
  66.     TabContent.Position = UDim2.new(0, 0, 0, 35)
  67.     TabContent.BackgroundTransparency = 1
  68.    
  69.     local tabs = {}
  70.     local currentTab = nil
  71.    
  72.     -- Window Dragging Functionality
  73.     local dragging, dragInput, dragStart, startPos
  74.    
  75.     local function updateDrag(input)
  76.         local delta = input.Position - dragStart
  77.         MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  78.     end
  79.    
  80.     TitleBar.InputBegan:Connect(function(input)
  81.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  82.             dragging = true
  83.             dragStart = input.Position
  84.             startPos = MainFrame.Position
  85.            
  86.             input.Changed:Connect(function()
  87.                 if input.UserInputState == Enum.UserInputState.End then
  88.                     dragging = false
  89.                 end
  90.             end)
  91.         end
  92.     end)
  93.    
  94.     TitleBar.InputChanged:Connect(function(input)
  95.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  96.             dragInput = input
  97.         end
  98.     end)
  99.    
  100.     UserInputService.InputChanged:Connect(function(input)
  101.         if input == dragInput and dragging then
  102.             updateDrag(input)
  103.         end
  104.     end)
  105.  
  106.     local function createTab(name)
  107.         local tab = {}
  108.        
  109.         local TabButton = Instance.new("TextButton")
  110.         TabButton.Name = name .. "Tab"
  111.         TabButton.Size = UDim2.new(0, 100, 1, 0)
  112.         TabButton.BackgroundColor3 = COLORS.SECTION
  113.         TabButton.BorderSizePixel = 0
  114.         TabButton.Text = name
  115.         TabButton.TextColor3 = COLORS.TEXT
  116.         TabButton.Font = Enum.Font.SourceSansBold
  117.         TabButton.TextSize = 14
  118.         TabButton.Parent = TabContainer
  119.        
  120.         local TabFrame = createReusableContainer(name .. "Content", UDim2.new(1, 0, 1, 0), TabContent)
  121.         TabFrame.BackgroundTransparency = 1
  122.         TabFrame.Visible = false
  123.        
  124.         local ScrollingFrame = Instance.new("ScrollingFrame")
  125.         ScrollingFrame.Size = UDim2.new(1, 0, 1, 0)
  126.         ScrollingFrame.BackgroundTransparency = 1
  127.         ScrollingFrame.BorderSizePixel = 0
  128.         ScrollingFrame.ScrollBarThickness = 4
  129.         ScrollingFrame.ScrollBarImageColor3 = COLORS.ACCENT
  130.         ScrollingFrame.Parent = TabFrame
  131.        
  132.         TabButton.MouseButton1Click:Connect(function()
  133.             if currentTab then
  134.                 currentTab.Frame.Visible = false
  135.                 currentTab.Button.BackgroundColor3 = COLORS.SECTION
  136.                 currentTab.Button.TextColor3 = COLORS.TEXT
  137.             end
  138.             TabFrame.Visible = true
  139.             TabButton.BackgroundColor3 = COLORS.ACCENT
  140.             TabButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  141.             currentTab = {Frame = TabFrame, Button = TabButton}
  142.         end)
  143.        
  144.         if #tabs == 0 then
  145.             TabFrame.Visible = true
  146.             TabButton.BackgroundColor3 = COLORS.ACCENT
  147.             TabButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  148.             currentTab = {Frame = TabFrame, Button = TabButton}
  149.         end
  150.        
  151.         table.insert(tabs, TabButton)
  152.        
  153.         for i, tabButton in ipairs(tabs) do
  154.             tabButton.Position = UDim2.new(0, (i-1) * 105, 0, 0)
  155.         end
  156.        
  157.         function tab:AddSection(name)
  158.             local section = createReusableContainer(name .. "Section", UDim2.new(1, -20, 0, 30), ScrollingFrame)
  159.             section.Size = UDim2.new(1, -10, 0, 30)
  160.             section.Position = UDim2.new(0, 5, 0, #ScrollingFrame:GetChildren() * 35)
  161.            
  162.             local sectionTitle = Instance.new("TextLabel")
  163.             sectionTitle.Name = "SectionTitle"
  164.             sectionTitle.Size = UDim2.new(1, -10, 1, 0)
  165.             sectionTitle.Position = UDim2.new(0, 5, 0, 0)
  166.             sectionTitle.BackgroundTransparency = 1
  167.             sectionTitle.Text = name
  168.             sectionTitle.TextColor3 = COLORS.ACCENT
  169.             sectionTitle.TextSize = 14
  170.             sectionTitle.Font = Enum.Font.SourceSansBold
  171.             sectionTitle.TextXAlignment = Enum.TextXAlignment.Left
  172.             sectionTitle.Parent = section
  173.            
  174.             local sectionContent = createReusableContainer(name .. "Content", UDim2.new(1, 0, 0, 0), section)
  175.             sectionContent.Position = UDim2.new(0, 0, 1, 5)
  176.             sectionContent.AutomaticSize = Enum.AutomaticSize.Y
  177.            
  178.             return sectionContent
  179.         end
  180.        
  181.         function tab:AddToggle(config)
  182.             config = config or {}
  183.             local toggleName = config.Name or "Toggle"
  184.             local default = config.Default or false
  185.             local callback = config.Callback or function() end
  186.            
  187.             local toggleSection = self:AddSection(toggleName)
  188.            
  189.             local toggleButton = Instance.new("TextButton")
  190.             toggleButton.Name = toggleName .. "Button"
  191.             toggleButton.Size = UDim2.new(0, 20, 0, 20)
  192.             toggleButton.Position = UDim2.new(1, -25, 0, 5)
  193.             toggleButton.BackgroundColor3 = default and COLORS.TOGGLE_ON or COLORS.TOGGLE_OFF
  194.             toggleButton.BorderSizePixel = 0
  195.             toggleButton.Text = ""
  196.             toggleButton.Parent = toggleSection
  197.            
  198.             local toggleCorner = Instance.new("UICorner")
  199.             toggleCorner.CornerRadius = UDim.new(0, 4)
  200.             toggleCorner.Parent = toggleButton
  201.            
  202.             local toggled = default
  203.             toggleButton.MouseButton1Click:Connect(function()
  204.                 toggled = not toggled
  205.                 toggleButton.BackgroundColor3 = toggled and COLORS.TOGGLE_ON or COLORS.TOGGLE_OFF
  206.                 callback(toggled)
  207.             end)
  208.            
  209.             return toggleButton
  210.         end
  211.  
  212.         function tab:AddSlider(config)
  213.             config = config or {}
  214.             local sliderName = config.Name or "Slider"
  215.             local min = config.Min or 0
  216.             local max = config.Max or 100
  217.             local default = config.Default or min
  218.             local callback = config.Callback or function() end
  219.            
  220.             local sliderSection = self:AddSection(sliderName)
  221.            
  222.             local sliderBar = Instance.new("Frame")
  223.             sliderBar.Name = sliderName .. "Bar"
  224.             sliderBar.Size = UDim2.new(1, -60, 0, 6)
  225.             sliderBar.Position = UDim2.new(0, 5, 0, 22)
  226.             sliderBar.BackgroundColor3 = COLORS.SLIDER_BG
  227.             sliderBar.BorderSizePixel = 0
  228.             sliderBar.Parent = sliderSection
  229.            
  230.             local sliderFill = Instance.new("Frame")
  231.             sliderFill.Name = "Fill"
  232.             sliderFill.Size = UDim2.new((default - min) / (max - min), 0, 1, 0)
  233.             sliderFill.BackgroundColor3 = COLORS.SLIDER_FILL
  234.             sliderFill.BorderSizePixel = 0
  235.             sliderFill.Parent = sliderBar
  236.            
  237.             local sliderButton = Instance.new("TextButton")
  238.             sliderButton.Name = "SliderButton"
  239.             sliderButton.Size = UDim2.new(0, 10, 0, 20)
  240.             sliderButton.Position = UDim2.new((default - min) / (max - min), -5, 0, -7)
  241.             sliderButton.BackgroundColor3 = COLORS.ACCENT
  242.             sliderButton.BorderSizePixel = 0
  243.             sliderButton.Text = ""
  244.             sliderButton.Parent = sliderBar
  245.            
  246.             local sliderValue = Instance.new("TextLabel")
  247.             sliderValue.Name = "Value"
  248.             sliderValue.Size = UDim2.new(0, 50, 0, 20)
  249.             sliderValue.Position = UDim2.new(1, 5, 0, 15)
  250.             sliderValue.BackgroundTransparency = 1
  251.             sliderValue.Text = tostring(default)
  252.             sliderValue.TextColor3 = COLORS.TEXT
  253.             sliderValue.TextSize = 14
  254.             sliderValue.Font = Enum.Font.SourceSans
  255.             sliderValue.Parent = sliderSection
  256.            
  257.             local function updateSlider(input)
  258.                 local pos = UDim2.new(math.clamp((input.Position.X - sliderBar.AbsolutePosition.X) / sliderBar.AbsoluteSize.X, 0, 1), -5, 0, -7)
  259.                 sliderButton.Position = pos
  260.                 sliderFill.Size = UDim2.new(pos.X.Scale, 0, 1, 0)
  261.                 local value = math.floor(min + ((max - min) * pos.X.Scale))
  262.                 sliderValue.Text = tostring(value)
  263.                 callback(value)
  264.             end
  265.            
  266.             sliderButton.MouseButton1Down:Connect(function()
  267.                 local connection
  268.                 connection = UserInputService.InputChanged:Connect(function(input)
  269.                     if input.UserInputType == Enum.UserInputType.MouseMovement then
  270.                         updateSlider(input)
  271.                     end
  272.                 end)
  273.                 UserInputService.InputEnded:Connect(function(input)
  274.                     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  275.                         connection:Disconnect()
  276.                     end
  277.                 end)
  278.             end)
  279.            
  280.             return sliderButton
  281.         end
  282.        
  283.         function tab:AddDropdown(config)
  284.             config = config or {}
  285.             local dropdownName = config.Name or "Dropdown"
  286.             local options = config.Options or {}
  287.             local default = config.Default or options[1]
  288.             local callback = config.Callback or function() end
  289.            
  290.             local dropdownSection = self:AddSection(dropdownName)
  291.            
  292.             local dropdownButton = Instance.new("TextButton")
  293.             dropdownButton.Name = dropdownName .. "Button"
  294.             dropdownButton.Size = UDim2.new(1, -10, 0, 30)
  295.             dropdownButton.Position = UDim2.new(0, 5, 0, 5)
  296.             dropdownButton.BackgroundColor3 = COLORS.DROPDOWN_BG
  297.             dropdownButton.BorderSizePixel = 0
  298.             dropdownButton.Text = default
  299.             dropdownButton.TextColor3 = COLORS.TEXT
  300.             dropdownButton.TextSize = 14
  301.             dropdownButton.Font = Enum.Font.SourceSans
  302.             dropdownButton.Parent = dropdownSection
  303.            
  304.             local dropdownList = Instance.new("Frame")
  305.             dropdownList.Name = "DropdownList"
  306.             dropdownList.Size = UDim2.new(1, 0, 0, #options * 30)
  307.             dropdownList.Position = UDim2.new(0, 0, 1, 5)
  308.             dropdownList.BackgroundColor3 = COLORS.DROPDOWN_BG
  309.             dropdownList.BorderSizePixel = 0
  310.             dropdownList.Visible = false
  311.             dropdownList.Parent = dropdownButton
  312.            
  313.             local dropdownLayout = Instance.new("UIListLayout")
  314.             dropdownLayout.SortOrder = Enum.SortOrder.LayoutOrder
  315.             dropdownLayout.Parent = dropdownList
  316.  
  317.             for i, option in ipairs(options) do
  318.                 local optionButton = Instance.new("TextButton")
  319.                 optionButton.Name = option .. "Option"
  320.                 optionButton.Size = UDim2.new(1, 0, 0, 30)
  321.                 optionButton.BackgroundColor3 = COLORS.DROPDOWN_BG
  322.                 optionButton.BorderSizePixel = 0
  323.                 optionButton.Text = option
  324.                 optionButton.TextColor3 = COLORS.TEXT
  325.                 optionButton.TextSize = 14
  326.                 optionButton.Font = Enum.Font.SourceSans
  327.                 optionButton.Parent = dropdownList
  328.                
  329.                 optionButton.MouseButton1Click:Connect(function()
  330.                     dropdownButton.Text = option
  331.                     dropdownList.Visible = false
  332.                     callback(option)
  333.                 end)
  334.             end
  335.            
  336.             dropdownButton.MouseButton1Click:Connect(function()
  337.                 dropdownList.Visible = not dropdownList.Visible
  338.             end)
  339.            
  340.             return dropdownButton
  341.         end
  342.  
  343.         function tab:AddColorPicker(config)
  344.             config = config or {}
  345.             local pickerName = config.Name or "Color Picker"
  346.             local default = config.Default or Color3.fromRGB(255, 255, 255)
  347.             local callback = config.Callback or function() end
  348.            
  349.             local pickerSection = self:AddSection(pickerName)
  350.            
  351.             local colorDisplay = Instance.new("Frame")
  352.             colorDisplay.Name = "ColorDisplay"
  353.             colorDisplay.Size = UDim2.new(0, 30, 0, 30)
  354.             colorDisplay.Position = UDim2.new(1, -35, 0, 5)
  355.             colorDisplay.BackgroundColor3 = default
  356.             colorDisplay.BorderSizePixel = 0
  357.             colorDisplay.Parent = pickerSection
  358.            
  359.             local colorCorner = Instance.new("UICorner")
  360.             colorCorner.CornerRadius = UDim.new(0, 4)
  361.             colorCorner.Parent = colorDisplay
  362.            
  363.             -- Simplified color picker functionality
  364.             colorDisplay.InputBegan:Connect(function(input)
  365.                 if input.UserInputType == Enum.UserInputType.MouseButton1 then
  366.                     local hue, sat, val = default:ToHSV()
  367.                     local newColor = Color3.fromHSV((hue + 0.1) % 1, sat, val)
  368.                     colorDisplay.BackgroundColor3 = newColor
  369.                     callback(newColor)
  370.                 end
  371.             end)
  372.            
  373.             return colorDisplay
  374.         end
  375.        
  376.         function tab:AddKeybind(config)
  377.             config = config or {}
  378.             local keybindName = config.Name or "Keybind"
  379.             local default = config.Default or Enum.KeyCode.Unknown
  380.             local callback = config.Callback or function() end
  381.            
  382.             local keybindSection = self:AddSection(keybindName)
  383.            
  384.             local keybindButton = Instance.new("TextButton")
  385.             keybindButton.Name = keybindName .. "Button"
  386.             keybindButton.Size = UDim2.new(0, 100, 0, 30)
  387.             keybindButton.Position = UDim2.new(1, -105, 0, 5)
  388.             keybindButton.BackgroundColor3 = COLORS.SECTION
  389.             keybindButton.BorderSizePixel = 0
  390.             keybindButton.Text = default.Name
  391.             keybindButton.TextColor3 = COLORS.TEXT
  392.             keybindButton.TextSize = 14
  393.             keybindButton.Font = Enum.Font.SourceSans
  394.             keybindButton.Parent = keybindSection
  395.            
  396.             local listening = false
  397.             keybindButton.MouseButton1Click:Connect(function()
  398.                 listening = true
  399.                 keybindButton.Text = "Press a key..."
  400.             end)
  401.            
  402.             UserInputService.InputBegan:Connect(function(input)
  403.                 if listening and input.UserInputType == Enum.UserInputType.Keyboard then
  404.                     keybindButton.Text = input.KeyCode.Name
  405.                     listening = false
  406.                     callback(input.KeyCode)
  407.                 elseif not listening and input.KeyCode == Enum.KeyCode[keybindButton.Text] then
  408.                     callback(input.KeyCode)
  409.                 end
  410.             end)
  411.            
  412.             return keybindButton
  413.         end
  414.        
  415.         return tab
  416.     end
  417.    
  418.     function EnhancedNebulaLib:CreateTab(name)
  419.         return createTab(name)
  420.     end
  421.    
  422.     return EnhancedNebulaLib
  423. end
  424.  
  425. return EnhancedNebulaLib
  426.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement