Advertisement
SomeRandomDude1909

My custom library thing (WIP)

Apr 28th, 2025 (edited)
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.18 KB | Source Code | 0 0
  1. local AtlastobyLib = {}
  2.  
  3. function AtlastobyLib:MakeWindow(options)
  4.     options = options or {}
  5.  
  6.     local player = game.Players.LocalPlayer
  7.     local playerGui = player:WaitForChild("PlayerGui")
  8.  
  9.     local screenGui = Instance.new("ScreenGui")
  10.     screenGui.Name = "atlastoby_gui"
  11.     screenGui.ResetOnSpawn = false
  12.     screenGui.Parent = playerGui
  13.  
  14.     -- Main Title Label (Title Frame)
  15.     local titleLabel = Instance.new("TextLabel")
  16.     titleLabel.Name = "TitleLabel"
  17.     titleLabel.Parent = screenGui
  18.     titleLabel.Size = UDim2.new(0, 639, 0, 50)
  19.     titleLabel.Position = UDim2.new(0.10209, 0, 0.08825, 0)
  20.     titleLabel.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  21.     titleLabel.BorderSizePixel = 0
  22.     titleLabel.BorderColor3 = Color3.fromRGB(0, 0, 0)
  23.     titleLabel.Text = options.Name or "ATLASTOBY UI"
  24.     titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  25.     titleLabel.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  26.     titleLabel.TextStrokeTransparency = 0
  27.     titleLabel.FontFace = Font.new("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.Regular, Enum.FontStyle.Normal)
  28.     titleLabel.TextScaled = true
  29.     titleLabel.TextWrapped = true
  30.     titleLabel.TextSize = 14
  31.  
  32.     -- Title Label Stroke
  33.     local titleStroke = Instance.new("UIStroke")
  34.     titleStroke.Parent = titleLabel
  35.     titleStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  36.     titleStroke.Thickness = 5
  37.  
  38.     -- Background Panel (main_panel)
  39.     local mainPanel = Instance.new("ImageLabel")
  40.     mainPanel.Name = "main_panel"
  41.     mainPanel.Parent = titleLabel
  42.     mainPanel.Size = UDim2.new(0, 639, 0, 412)
  43.     mainPanel.Position = UDim2.new(-0.00119, 0, 1.00849, 0)
  44.     mainPanel.BackgroundTransparency = 1
  45.     mainPanel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  46.     mainPanel.BorderSizePixel = 0
  47.     mainPanel.BorderColor3 = Color3.fromRGB(0, 0, 0)
  48.     mainPanel.Image = "http://www.roblox.com/asset/?id=99003730285484"
  49.     mainPanel.ImageTransparency = 0.15
  50.  
  51.     -- Background Panel Stroke
  52.     local panelStroke = Instance.new("UIStroke")
  53.     panelStroke.Parent = mainPanel
  54.     panelStroke.Thickness = 4
  55.  
  56.     -- Side Scrolling Frame (like a menu)
  57.     local sideMenu = Instance.new("ScrollingFrame")
  58.     sideMenu.Name = "SideMenu"
  59.     sideMenu.Parent = titleLabel
  60.     sideMenu.Size = UDim2.new(0, 214, 0, 394)
  61.     sideMenu.Position = UDim2.new(0.01252, 0, 1.24, 0)
  62.     sideMenu.BackgroundColor3 = Color3.fromRGB(53, 53, 53)
  63.     sideMenu.BorderSizePixel = 0
  64.     sideMenu.BorderColor3 = Color3.fromRGB(0, 0, 0)
  65.     sideMenu.Active = true
  66.     sideMenu.ScrollBarImageColor3 = Color3.fromRGB(0, 0, 0)
  67.  
  68.     -- Side Menu Stroke
  69.     local sideMenuStroke = Instance.new("UIStroke")
  70.     sideMenuStroke.Parent = sideMenu
  71.     sideMenuStroke.Thickness = 2
  72.  
  73.     -- Red Close Button
  74.     local closeButton = Instance.new("TextButton")
  75.     closeButton.Name = "CloseButton"
  76.     closeButton.Parent = titleLabel
  77.     closeButton.Size = UDim2.new(0, 25, 0, 25)
  78.     closeButton.Position = UDim2.new(1, -30, 0.5, -12)
  79.     closeButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  80.     closeButton.BorderSizePixel = 0
  81.     closeButton.Text = ""
  82.     closeButton.AutoButtonColor = true
  83.     closeButton.TextScaled = true
  84.     closeButton.TextColor3 = Color3.new(1, 1, 1)
  85.     closeButton.ClipsDescendants = true
  86.     closeButton.AnchorPoint = Vector2.new(0.5, 0.5)
  87.  
  88.     local closeCorner = Instance.new("UICorner")
  89.     closeCorner.Parent = closeButton
  90.     closeCorner.CornerRadius = UDim.new(1, 0) -- make it a circle
  91.  
  92.     closeButton.MouseButton1Click:Connect(function()
  93.         -- Hide the entire UI instead of destroying it
  94.         screenGui.Enabled = false
  95.     end)
  96.  
  97.     -- Orange Minimize Button
  98.     local minimizeButton = Instance.new("TextButton")
  99.     minimizeButton.Name = "MinimizeButton"
  100.     minimizeButton.Parent = titleLabel
  101.     minimizeButton.Size = UDim2.new(0, 25, 0, 25)
  102.     minimizeButton.Position = UDim2.new(1, -65, 0.5, -12)
  103.     minimizeButton.BackgroundColor3 = Color3.fromRGB(255, 165, 0)
  104.     minimizeButton.BorderSizePixel = 0
  105.     minimizeButton.Text = ""
  106.     minimizeButton.AutoButtonColor = true
  107.     minimizeButton.TextScaled = true
  108.     minimizeButton.TextColor3 = Color3.new(1, 1, 1)
  109.     minimizeButton.ClipsDescendants = true
  110.     minimizeButton.AnchorPoint = Vector2.new(0.5, 0.5)
  111.  
  112.     local minimizeCorner = Instance.new("UICorner")
  113.     minimizeCorner.Parent = minimizeButton
  114.     minimizeCorner.CornerRadius = UDim.new(1, 0)
  115.  
  116.     -- Maximize Button (Hidden initially)
  117.     local maximizeButton = Instance.new("TextButton")
  118.     maximizeButton.Name = "MaximizeButton"
  119.     maximizeButton.Parent = screenGui
  120.     maximizeButton.Size = UDim2.new(0, 100, 0, 30)
  121.     maximizeButton.Position = UDim2.new(0, 10, 0.5, 0)
  122.     maximizeButton.BackgroundColor3 = Color3.fromRGB(255, 165, 0)
  123.     maximizeButton.BorderSizePixel = 0
  124.     maximizeButton.Text = "Maximize"
  125.     maximizeButton.TextScaled = true
  126.     maximizeButton.TextColor3 = Color3.new(1, 1, 1)
  127.     maximizeButton.Visible = false
  128.  
  129.     local maximizeCorner = Instance.new("UICorner")
  130.     maximizeCorner.Parent = maximizeButton
  131.     maximizeCorner.CornerRadius = UDim.new(0.25, 0)
  132.  
  133.     minimizeButton.MouseButton1Click:Connect(function()
  134.         -- Hide all UI except Maximize
  135.         for _, v in ipairs(screenGui:GetChildren()) do
  136.             if v ~= maximizeButton then
  137.                 v.Visible = false
  138.             end
  139.         end
  140.         maximizeButton.Visible = true
  141.     end)
  142.  
  143.     maximizeButton.MouseButton1Click:Connect(function()
  144.         -- Restore UI
  145.         for _, v in ipairs(screenGui:GetChildren()) do
  146.             if v ~= maximizeButton then
  147.                 v.Visible = true
  148.             end
  149.         end
  150.         maximizeButton.Visible = false
  151.     end)
  152.  
  153.     -- Draggable title (titleLabel)
  154.     local dragging = false
  155.     local dragInput, dragStart, startPos
  156.     titleLabel.InputBegan:Connect(function(input)
  157.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  158.             dragging = true
  159.             dragStart = input.Position
  160.             startPos = titleLabel.Position
  161.         end
  162.     end)
  163.  
  164.     titleLabel.InputChanged:Connect(function(input)
  165.         if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  166.             local delta = input.Position - dragStart
  167.             titleLabel.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  168.         end
  169.     end)
  170.  
  171.     titleLabel.InputEnded:Connect(function(input)
  172.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  173.             dragging = false
  174.         end
  175.     end)
  176.  
  177.     return {
  178.         ScreenGui = screenGui,
  179.         Title = titleLabel,
  180.         MainPanel = mainPanel,
  181.         SideMenu = sideMenu
  182.     }
  183. end
  184.  
  185. -- Function to create custom buttons dynamically
  186. function AtlastobyLib:CreateCustomButton(buttonText, buttonColor, onClickAction)
  187.     -- Get the local player’s PlayerGui
  188.     local player = game:GetService("Players").LocalPlayer
  189.     local playerGui = player:WaitForChild("PlayerGui")
  190.    
  191.     -- Get the main GUI and title frame
  192.     local atlastobyGui = playerGui:WaitForChild("atlastoby_gui")  -- Assuming the main gui is called atlastoby_gui
  193.     local titleGui = atlastobyGui:WaitForChild("TextLabel")  -- Assuming title frame is a TextLabel
  194.     local sideMenu = atlastobyGui:WaitForChild("ScrollingFrame")  -- The side menu (scrolling frame)
  195.    
  196.     -- Create a new button
  197.     local customButton = Instance.new("TextButton")
  198.     customButton.Name = "CustomButton"
  199.     customButton.Parent = sideMenu
  200.     customButton.Size = UDim2.new(0, 200, 0, 50)  -- Default size for buttons
  201.     customButton.Position = UDim2.new(0.5, -100, 0, #sideMenu:GetChildren() * 60)  -- Automatically stacked buttons
  202.     customButton.BackgroundColor3 = buttonColor
  203.     customButton.BorderSizePixel = 0
  204.     customButton.Text = buttonText
  205.     customButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  206.     customButton.TextScaled = true
  207.    
  208.     -- Connect the onClick action to the button
  209.     customButton.MouseButton1Click:Connect(function()
  210.         if onClickAction then
  211.             onClickAction()
  212.         end
  213.     end)
  214. end
  215.  
  216. return AtlastobyLib
  217.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement