Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local EnhancedNebulaLib = {}
- local TweenService = game:GetService("TweenService")
- local UserInputService = game:GetService("UserInputService")
- local COLORS = {
- BACKGROUND = Color3.fromRGB(30, 30, 35),
- HEADER = Color3.fromRGB(40, 40, 45),
- SECTION = Color3.fromRGB(35, 35, 40),
- TEXT = Color3.fromRGB(200, 200, 200),
- ACCENT = Color3.fromRGB(255, 128, 0),
- TOGGLE_OFF = Color3.fromRGB(60, 60, 65),
- TOGGLE_ON = Color3.fromRGB(255, 128, 0),
- SLIDER_BG = Color3.fromRGB(50, 50, 55),
- SLIDER_FILL = Color3.fromRGB(255, 128, 0),
- DROPDOWN_BG = Color3.fromRGB(45, 45, 50)
- }
- local function createReusableContainer(name, size, parent)
- local container = Instance.new("Frame")
- container.Name = name
- container.Size = size
- container.BackgroundColor3 = COLORS.SECTION
- container.BorderSizePixel = 0
- container.Parent = parent
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0, 4)
- corner.Parent = container
- return container
- end
- function EnhancedNebulaLib:CreateWindow(config)
- config = config or {}
- local windowName = config.Name or "Enhanced Nebula Window"
- local NebulaGUI = Instance.new("ScreenGui")
- NebulaGUI.Name = "EnhancedNebulaGUI"
- NebulaGUI.Parent = game.CoreGui
- local MainFrame = createReusableContainer("MainFrame", UDim2.new(0, 700, 0, 500), NebulaGUI)
- MainFrame.Position = UDim2.new(0.5, -350, 0.5, -250)
- MainFrame.BackgroundColor3 = COLORS.BACKGROUND
- local TitleBar = createReusableContainer("TitleBar", UDim2.new(1, 0, 0, 30), MainFrame)
- TitleBar.BackgroundColor3 = COLORS.HEADER
- local TitleText = Instance.new("TextLabel")
- TitleText.Name = "TitleText"
- TitleText.Size = UDim2.new(1, -10, 1, 0)
- TitleText.Position = UDim2.new(0, 10, 0, 0)
- TitleText.BackgroundTransparency = 1
- TitleText.Text = windowName
- TitleText.TextColor3 = COLORS.TEXT
- TitleText.TextSize = 16
- TitleText.Font = Enum.Font.SourceSansBold
- TitleText.TextXAlignment = Enum.TextXAlignment.Left
- TitleText.Parent = TitleBar
- local ContentFrame = createReusableContainer("ContentFrame", UDim2.new(1, -20, 1, -40), MainFrame)
- ContentFrame.Position = UDim2.new(0, 10, 0, 35)
- local TabContainer = createReusableContainer("TabContainer", UDim2.new(1, 0, 0, 30), ContentFrame)
- local TabContent = createReusableContainer("TabContent", UDim2.new(1, 0, 1, -35), ContentFrame)
- TabContent.Position = UDim2.new(0, 0, 0, 35)
- TabContent.BackgroundTransparency = 1
- local tabs = {}
- local currentTab = nil
- -- Window Dragging Functionality
- local dragging, dragInput, dragStart, startPos
- local function updateDrag(input)
- local delta = input.Position - dragStart
- MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- TitleBar.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStart = input.Position
- startPos = MainFrame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- TitleBar.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement then
- dragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- updateDrag(input)
- end
- end)
- local function createTab(name)
- local tab = {}
- local TabButton = Instance.new("TextButton")
- TabButton.Name = name .. "Tab"
- TabButton.Size = UDim2.new(0, 100, 1, 0)
- TabButton.BackgroundColor3 = COLORS.SECTION
- TabButton.BorderSizePixel = 0
- TabButton.Text = name
- TabButton.TextColor3 = COLORS.TEXT
- TabButton.Font = Enum.Font.SourceSansBold
- TabButton.TextSize = 14
- TabButton.Parent = TabContainer
- local TabFrame = createReusableContainer(name .. "Content", UDim2.new(1, 0, 1, 0), TabContent)
- TabFrame.BackgroundTransparency = 1
- TabFrame.Visible = false
- local ScrollingFrame = Instance.new("ScrollingFrame")
- ScrollingFrame.Size = UDim2.new(1, 0, 1, 0)
- ScrollingFrame.BackgroundTransparency = 1
- ScrollingFrame.BorderSizePixel = 0
- ScrollingFrame.ScrollBarThickness = 4
- ScrollingFrame.ScrollBarImageColor3 = COLORS.ACCENT
- ScrollingFrame.Parent = TabFrame
- TabButton.MouseButton1Click:Connect(function()
- if currentTab then
- currentTab.Frame.Visible = false
- currentTab.Button.BackgroundColor3 = COLORS.SECTION
- currentTab.Button.TextColor3 = COLORS.TEXT
- end
- TabFrame.Visible = true
- TabButton.BackgroundColor3 = COLORS.ACCENT
- TabButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- currentTab = {Frame = TabFrame, Button = TabButton}
- end)
- if #tabs == 0 then
- TabFrame.Visible = true
- TabButton.BackgroundColor3 = COLORS.ACCENT
- TabButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- currentTab = {Frame = TabFrame, Button = TabButton}
- end
- table.insert(tabs, TabButton)
- for i, tabButton in ipairs(tabs) do
- tabButton.Position = UDim2.new(0, (i-1) * 105, 0, 0)
- end
- function tab:AddSection(name)
- local section = createReusableContainer(name .. "Section", UDim2.new(1, -20, 0, 30), ScrollingFrame)
- section.Size = UDim2.new(1, -10, 0, 30)
- section.Position = UDim2.new(0, 5, 0, #ScrollingFrame:GetChildren() * 35)
- local sectionTitle = Instance.new("TextLabel")
- sectionTitle.Name = "SectionTitle"
- sectionTitle.Size = UDim2.new(1, -10, 1, 0)
- sectionTitle.Position = UDim2.new(0, 5, 0, 0)
- sectionTitle.BackgroundTransparency = 1
- sectionTitle.Text = name
- sectionTitle.TextColor3 = COLORS.ACCENT
- sectionTitle.TextSize = 14
- sectionTitle.Font = Enum.Font.SourceSansBold
- sectionTitle.TextXAlignment = Enum.TextXAlignment.Left
- sectionTitle.Parent = section
- local sectionContent = createReusableContainer(name .. "Content", UDim2.new(1, 0, 0, 0), section)
- sectionContent.Position = UDim2.new(0, 0, 1, 5)
- sectionContent.AutomaticSize = Enum.AutomaticSize.Y
- return sectionContent
- end
- function tab:AddToggle(config)
- config = config or {}
- local toggleName = config.Name or "Toggle"
- local default = config.Default or false
- local callback = config.Callback or function() end
- local toggleSection = self:AddSection(toggleName)
- local toggleButton = Instance.new("TextButton")
- toggleButton.Name = toggleName .. "Button"
- toggleButton.Size = UDim2.new(0, 20, 0, 20)
- toggleButton.Position = UDim2.new(1, -25, 0, 5)
- toggleButton.BackgroundColor3 = default and COLORS.TOGGLE_ON or COLORS.TOGGLE_OFF
- toggleButton.BorderSizePixel = 0
- toggleButton.Text = ""
- toggleButton.Parent = toggleSection
- local toggleCorner = Instance.new("UICorner")
- toggleCorner.CornerRadius = UDim.new(0, 4)
- toggleCorner.Parent = toggleButton
- local toggled = default
- toggleButton.MouseButton1Click:Connect(function()
- toggled = not toggled
- toggleButton.BackgroundColor3 = toggled and COLORS.TOGGLE_ON or COLORS.TOGGLE_OFF
- callback(toggled)
- end)
- return toggleButton
- end
- function tab:AddSlider(config)
- config = config or {}
- local sliderName = config.Name or "Slider"
- local min = config.Min or 0
- local max = config.Max or 100
- local default = config.Default or min
- local callback = config.Callback or function() end
- local sliderSection = self:AddSection(sliderName)
- local sliderBar = Instance.new("Frame")
- sliderBar.Name = sliderName .. "Bar"
- sliderBar.Size = UDim2.new(1, -60, 0, 6)
- sliderBar.Position = UDim2.new(0, 5, 0, 22)
- sliderBar.BackgroundColor3 = COLORS.SLIDER_BG
- sliderBar.BorderSizePixel = 0
- sliderBar.Parent = sliderSection
- local sliderFill = Instance.new("Frame")
- sliderFill.Name = "Fill"
- sliderFill.Size = UDim2.new((default - min) / (max - min), 0, 1, 0)
- sliderFill.BackgroundColor3 = COLORS.SLIDER_FILL
- sliderFill.BorderSizePixel = 0
- sliderFill.Parent = sliderBar
- local sliderButton = Instance.new("TextButton")
- sliderButton.Name = "SliderButton"
- sliderButton.Size = UDim2.new(0, 10, 0, 20)
- sliderButton.Position = UDim2.new((default - min) / (max - min), -5, 0, -7)
- sliderButton.BackgroundColor3 = COLORS.ACCENT
- sliderButton.BorderSizePixel = 0
- sliderButton.Text = ""
- sliderButton.Parent = sliderBar
- local sliderValue = Instance.new("TextLabel")
- sliderValue.Name = "Value"
- sliderValue.Size = UDim2.new(0, 50, 0, 20)
- sliderValue.Position = UDim2.new(1, 5, 0, 15)
- sliderValue.BackgroundTransparency = 1
- sliderValue.Text = tostring(default)
- sliderValue.TextColor3 = COLORS.TEXT
- sliderValue.TextSize = 14
- sliderValue.Font = Enum.Font.SourceSans
- sliderValue.Parent = sliderSection
- local function updateSlider(input)
- local pos = UDim2.new(math.clamp((input.Position.X - sliderBar.AbsolutePosition.X) / sliderBar.AbsoluteSize.X, 0, 1), -5, 0, -7)
- sliderButton.Position = pos
- sliderFill.Size = UDim2.new(pos.X.Scale, 0, 1, 0)
- local value = math.floor(min + ((max - min) * pos.X.Scale))
- sliderValue.Text = tostring(value)
- callback(value)
- end
- sliderButton.MouseButton1Down:Connect(function()
- local connection
- connection = UserInputService.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement then
- updateSlider(input)
- end
- end)
- UserInputService.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- connection:Disconnect()
- end
- end)
- end)
- return sliderButton
- end
- function tab:AddDropdown(config)
- config = config or {}
- local dropdownName = config.Name or "Dropdown"
- local options = config.Options or {}
- local default = config.Default or options[1]
- local callback = config.Callback or function() end
- local dropdownSection = self:AddSection(dropdownName)
- local dropdownButton = Instance.new("TextButton")
- dropdownButton.Name = dropdownName .. "Button"
- dropdownButton.Size = UDim2.new(1, -10, 0, 30)
- dropdownButton.Position = UDim2.new(0, 5, 0, 5)
- dropdownButton.BackgroundColor3 = COLORS.DROPDOWN_BG
- dropdownButton.BorderSizePixel = 0
- dropdownButton.Text = default
- dropdownButton.TextColor3 = COLORS.TEXT
- dropdownButton.TextSize = 14
- dropdownButton.Font = Enum.Font.SourceSans
- dropdownButton.Parent = dropdownSection
- local dropdownList = Instance.new("Frame")
- dropdownList.Name = "DropdownList"
- dropdownList.Size = UDim2.new(1, 0, 0, #options * 30)
- dropdownList.Position = UDim2.new(0, 0, 1, 5)
- dropdownList.BackgroundColor3 = COLORS.DROPDOWN_BG
- dropdownList.BorderSizePixel = 0
- dropdownList.Visible = false
- dropdownList.Parent = dropdownButton
- local dropdownLayout = Instance.new("UIListLayout")
- dropdownLayout.SortOrder = Enum.SortOrder.LayoutOrder
- dropdownLayout.Parent = dropdownList
- for i, option in ipairs(options) do
- local optionButton = Instance.new("TextButton")
- optionButton.Name = option .. "Option"
- optionButton.Size = UDim2.new(1, 0, 0, 30)
- optionButton.BackgroundColor3 = COLORS.DROPDOWN_BG
- optionButton.BorderSizePixel = 0
- optionButton.Text = option
- optionButton.TextColor3 = COLORS.TEXT
- optionButton.TextSize = 14
- optionButton.Font = Enum.Font.SourceSans
- optionButton.Parent = dropdownList
- optionButton.MouseButton1Click:Connect(function()
- dropdownButton.Text = option
- dropdownList.Visible = false
- callback(option)
- end)
- end
- dropdownButton.MouseButton1Click:Connect(function()
- dropdownList.Visible = not dropdownList.Visible
- end)
- return dropdownButton
- end
- function tab:AddColorPicker(config)
- config = config or {}
- local pickerName = config.Name or "Color Picker"
- local default = config.Default or Color3.fromRGB(255, 255, 255)
- local callback = config.Callback or function() end
- local pickerSection = self:AddSection(pickerName)
- local colorDisplay = Instance.new("Frame")
- colorDisplay.Name = "ColorDisplay"
- colorDisplay.Size = UDim2.new(0, 30, 0, 30)
- colorDisplay.Position = UDim2.new(1, -35, 0, 5)
- colorDisplay.BackgroundColor3 = default
- colorDisplay.BorderSizePixel = 0
- colorDisplay.Parent = pickerSection
- local colorCorner = Instance.new("UICorner")
- colorCorner.CornerRadius = UDim.new(0, 4)
- colorCorner.Parent = colorDisplay
- -- Simplified color picker functionality
- colorDisplay.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- local hue, sat, val = default:ToHSV()
- local newColor = Color3.fromHSV((hue + 0.1) % 1, sat, val)
- colorDisplay.BackgroundColor3 = newColor
- callback(newColor)
- end
- end)
- return colorDisplay
- end
- function tab:AddKeybind(config)
- config = config or {}
- local keybindName = config.Name or "Keybind"
- local default = config.Default or Enum.KeyCode.Unknown
- local callback = config.Callback or function() end
- local keybindSection = self:AddSection(keybindName)
- local keybindButton = Instance.new("TextButton")
- keybindButton.Name = keybindName .. "Button"
- keybindButton.Size = UDim2.new(0, 100, 0, 30)
- keybindButton.Position = UDim2.new(1, -105, 0, 5)
- keybindButton.BackgroundColor3 = COLORS.SECTION
- keybindButton.BorderSizePixel = 0
- keybindButton.Text = default.Name
- keybindButton.TextColor3 = COLORS.TEXT
- keybindButton.TextSize = 14
- keybindButton.Font = Enum.Font.SourceSans
- keybindButton.Parent = keybindSection
- local listening = false
- keybindButton.MouseButton1Click:Connect(function()
- listening = true
- keybindButton.Text = "Press a key..."
- end)
- UserInputService.InputBegan:Connect(function(input)
- if listening and input.UserInputType == Enum.UserInputType.Keyboard then
- keybindButton.Text = input.KeyCode.Name
- listening = false
- callback(input.KeyCode)
- elseif not listening and input.KeyCode == Enum.KeyCode[keybindButton.Text] then
- callback(input.KeyCode)
- end
- end)
- return keybindButton
- end
- return tab
- end
- function EnhancedNebulaLib:CreateTab(name)
- return createTab(name)
- end
- return EnhancedNebulaLib
- end
- return EnhancedNebulaLib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement