Advertisement
jxuser

UI Library- v0.0.6

Jul 7th, 2025 (edited)
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.96 KB | None | 0 0
  1. local TweenService = game:GetService("TweenService")
  2. local player = game.Players.LocalPlayer
  3. local parentGui = game:GetService("CoreGui")
  4. local Lighting = game:GetService("Lighting")
  5.  
  6. pcall(function()
  7.     if not parentGui:IsDescendantOf(game) then
  8.         parentGui = player:WaitForChild("PlayerGui")
  9.     end
  10. end)
  11.  
  12. -- Remove existing popup and GUI if found
  13. local existing = parentGui:FindFirstChild("CreditPopup")
  14. if existing then existing:Destroy() end
  15.  
  16. local existingGui = parentGui:FindFirstChild("DeltaUILib")
  17. if existingGui then
  18.     existingGui:Destroy()
  19. end
  20.  
  21. -- Blur effect
  22. local blur = Instance.new("BlurEffect")
  23. blur.Size = 0
  24. blur.Name = "UILibCreditBlur"
  25. blur.Parent = Lighting
  26.  
  27. TweenService:Create(blur, TweenInfo.new(0.5), {Size = 12}):Play()
  28.  
  29. -- GUI
  30. local gui = Instance.new("ScreenGui")
  31. gui.Name = "CreditPopup"
  32. gui.IgnoreGuiInset = true
  33. gui.ResetOnSpawn = false
  34. gui.Parent = parentGui
  35.  
  36. -- Popup container
  37. local popup = Instance.new("Frame")
  38. popup.Size = UDim2.new(0, 280, 0, 80)
  39. popup.Position = UDim2.new(0.5, 0, 0.5, 0)
  40. popup.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
  41. popup.BackgroundTransparency = 1
  42. popup.BorderSizePixel = 0
  43. popup.AnchorPoint = Vector2.new(0.5, 0.5)
  44. popup.Parent = gui
  45.  
  46. local corner = Instance.new("UICorner", popup)
  47. corner.CornerRadius = UDim.new(0, 8)
  48.  
  49. local stroke = Instance.new("UIStroke", popup)
  50. stroke.Color = Color3.fromRGB(0, 170, 255)
  51. stroke.Thickness = 2
  52. stroke.Transparency = 0.4
  53.  
  54. -- Icon via URL (auto-scaled)
  55. local icon = Instance.new("ImageLabel")
  56. icon.Size = UDim2.new(0, 40, 0, 40)
  57. icon.Position = UDim2.new(0, 10, 0, 20)
  58. icon.BackgroundTransparency = 1
  59. icon.Image = "rbxassetid://6031075938"
  60. icon.ScaleType = Enum.ScaleType.Fit
  61. icon.ClipsDescendants = true
  62. icon.ImageTransparency = 1 -- start invisible
  63. icon.Parent = popup
  64.  
  65. local aspect = Instance.new("UIAspectRatioConstraint")
  66. aspect.AspectRatio = 1
  67. aspect.Parent = icon
  68.  
  69. -- Main Label
  70. local mainLabel = Instance.new("TextLabel")
  71. mainLabel.Position = UDim2.new(0, 60, 0, 12)
  72. mainLabel.Size = UDim2.new(1, -70, 0, 24)
  73. mainLabel.BackgroundTransparency = 1
  74. mainLabel.Text = "Made by Chilled"
  75. mainLabel.Font = Enum.Font.GothamBold
  76. mainLabel.TextSize = 16
  77. mainLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  78. mainLabel.TextXAlignment = Enum.TextXAlignment.Left
  79. mainLabel.Parent = popup
  80.  
  81. -- Replace clickable social button with selectable TextLabel
  82. local socialLink = Instance.new("TextLabel")
  83. socialLink.Position = UDim2.new(0, 60, 0, 40)
  84. socialLink.Size = UDim2.new(1, -70, 0, 18)
  85. socialLink.BackgroundTransparency = 1
  86. socialLink.Text = "youtube.com/Chilled"
  87. socialLink.Font = Enum.Font.Gotham
  88. socialLink.TextSize = 13
  89. socialLink.TextColor3 = Color3.fromRGB(0, 170, 255)
  90. socialLink.TextXAlignment = Enum.TextXAlignment.Left
  91. socialLink.Selectable = true  -- allows text to be copied on mobile
  92. socialLink.Parent = popup
  93.  
  94.  
  95. -- Fade in popup background and icon image
  96. local tweenPopupIn = TweenService:Create(popup, TweenInfo.new(0.5), {BackgroundTransparency = 0})
  97. local tweenIconIn = TweenService:Create(icon, TweenInfo.new(0.5), {ImageTransparency = 0})
  98.  
  99. tweenPopupIn:Play()
  100. tweenIconIn:Play()
  101.  
  102. task.wait(8)
  103.  
  104. -- Fade out popup background and icon image
  105. local tweenPopupOut = TweenService:Create(popup, TweenInfo.new(0.5), {BackgroundTransparency = 1})
  106. local tweenIconOut = TweenService:Create(icon, TweenInfo.new(0.5), {ImageTransparency = 1})
  107.  
  108. tweenPopupOut:Play()
  109. tweenIconOut:Play()
  110.  
  111. TweenService:Create(blur, TweenInfo.new(0.5), {Size = 0}):Play()
  112.  
  113. task.delay(0.5, function()
  114.     blur:Destroy()
  115.     gui:Destroy()
  116. end)
  117.  
  118.  
  119. -- START OF THE UI Library V0.0.6 (Smaller UI)
  120. local UIS = game:GetService("UserInputService")
  121.  
  122. local UILib = {}
  123.  
  124. local isCollapsed = true
  125. local dragging, dragStart, startPos
  126.  
  127. local function createRounded(instance, radius)
  128.     local corner = Instance.new("UICorner")
  129.     corner.CornerRadius = UDim.new(0, radius or 6)
  130.     corner.Parent = instance
  131. end
  132.  
  133. -- UI Container
  134. local ScreenGui = Instance.new("ScreenGui")
  135. ScreenGui.Name = "DeltaUILib"
  136. ScreenGui.ResetOnSpawn = false
  137. ScreenGui.IgnoreGuiInset = true
  138. ScreenGui.Parent = parentGui
  139.  
  140. -- Main Window
  141. local MainFrame = Instance.new("Frame")
  142. MainFrame.Name = "MainFrame"
  143. MainFrame.Position = UDim2.new(0.3, 0, 0.3, 0)
  144. MainFrame.Size = UDim2.new(0, 250, 0, 25)  -- smaller width and height
  145. MainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
  146. MainFrame.BorderSizePixel = 0
  147. MainFrame.Active = true
  148. MainFrame.Parent = ScreenGui
  149. createRounded(MainFrame, 6)  -- slightly smaller corner radius
  150.  
  151. local UIStroke = Instance.new("UIStroke", MainFrame)
  152. UIStroke.Thickness = 1.5
  153. UIStroke.Color = Color3.fromRGB(0, 170, 255)
  154. UIStroke.Transparency = 0.3
  155.  
  156. -- Title Bar
  157. local TitleBar = Instance.new("TextButton")
  158. TitleBar.Text = " UI Menu "
  159. TitleBar.Font = Enum.Font.GothamBold
  160. TitleBar.TextSize = 14  -- smaller font size
  161. TitleBar.Size = UDim2.new(1, 0, 0, 25)  -- shorter height
  162. TitleBar.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  163. TitleBar.TextColor3 = Color3.fromRGB(255, 255, 255)
  164. TitleBar.BorderSizePixel = 0
  165. TitleBar.AutoButtonColor = false
  166. TitleBar.Parent = MainFrame
  167. createRounded(TitleBar, 6)
  168.  
  169. -- Collapse Button
  170. local CollapseButton = Instance.new("TextButton")
  171. CollapseButton.Size = UDim2.new(0, 25, 1, 0)
  172. CollapseButton.Position = UDim2.new(1, -25, 0, 0)
  173. CollapseButton.Text = "+"
  174. CollapseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  175. CollapseButton.Font = Enum.Font.GothamBold
  176. CollapseButton.TextSize = 14
  177. CollapseButton.BackgroundTransparency = 1
  178. CollapseButton.Parent = TitleBar
  179.  
  180. -- Add icon to TitleBar
  181. local titleIcon = Instance.new("ImageLabel")
  182. titleIcon.Size = UDim2.new(0, 20, 0, 20)  -- small square icon
  183. titleIcon.Position = UDim2.new(0, 5, 0.5, -10)  -- left side with vertical center alignment
  184. titleIcon.BackgroundTransparency = 1
  185. titleIcon.Image = "rbxassetid://6031075938"  -- same asset ID as your popup icon
  186. titleIcon.ScaleType = Enum.ScaleType.Fit
  187. titleIcon.Parent = TitleBar
  188.  
  189. -- Container (scrolling frame for controls)
  190. local Container = Instance.new("ScrollingFrame")
  191. Container.Size = UDim2.new(1, -8, 1, -32)
  192. Container.Position = UDim2.new(0, 4, 0, 29)
  193. Container.CanvasSize = UDim2.new(0, 0, 0, 0)
  194. Container.ScrollBarThickness = 5
  195. Container.AutomaticCanvasSize = Enum.AutomaticSize.Y
  196. Container.BackgroundTransparency = 1
  197. Container.Visible = false
  198. Container.Parent = MainFrame
  199.  
  200. local UIListLayout = Instance.new("UIListLayout", Container)
  201. UIListLayout.Padding = UDim.new(0, 5)  -- smaller padding
  202. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  203.  
  204. -- Collapse toggle logic
  205. CollapseButton.MouseButton1Click:Connect(function()
  206.     isCollapsed = not isCollapsed
  207.     Container.Visible = not isCollapsed
  208.     MainFrame.Size = isCollapsed and UDim2.new(0, 250, 0, 25) or UDim2.new(0, 250, 0, 320)  -- adjusted height for expanded
  209.     CollapseButton.Text = isCollapsed and "+" or "–"
  210. end)
  211.  
  212. -- Draggable logic (exclude collapse button area)
  213. TitleBar.InputBegan:Connect(function(input)
  214.     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  215.         if UIS:GetFocusedTextBox() == nil then
  216.             local mousePos = input.Position
  217.             local cbPos = CollapseButton.AbsolutePosition
  218.             local cbSize = CollapseButton.AbsoluteSize
  219.             if not (mousePos.X >= cbPos.X and mousePos.X <= cbPos.X + cbSize.X) then
  220.                 dragging = true
  221.                 dragStart = input.Position
  222.                 startPos = MainFrame.Position
  223.                 input.Changed:Connect(function()
  224.                     if input.UserInputState == Enum.UserInputState.End then
  225.                         dragging = false
  226.                     end
  227.                 end)
  228.             end
  229.         end
  230.     end
  231. end)
  232.  
  233. UIS.InputChanged:Connect(function(input)
  234.     if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  235.         local delta = input.Position - dragStart
  236.         MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  237.     end
  238. end)
  239.  
  240. -- API Functions --
  241.  
  242. function UILib:SetTitle(text)
  243.     TitleBar.Text = " " .. tostring(text)
  244. end
  245.  
  246. function UILib:AddSection(text)
  247.     local lbl = Instance.new("TextLabel")
  248.     lbl.Text = tostring(text)
  249.     lbl.Font = Enum.Font.GothamBold
  250.     lbl.TextSize = 12  -- smaller font size
  251.     lbl.TextColor3 = Color3.fromRGB(180, 180, 180)
  252.     lbl.BackgroundTransparency = 1
  253.     lbl.Size = UDim2.new(1, -8, 0, 20)  -- smaller height
  254.     lbl.TextXAlignment = Enum.TextXAlignment.Left
  255.     lbl.Parent = Container
  256. end
  257.  
  258. function UILib:AddButton(text, callback)
  259.     local btn = Instance.new("TextButton")
  260.     btn.Text = tostring(text)
  261.     btn.Font = Enum.Font.Gotham
  262.     btn.TextSize = 13  -- smaller font size
  263.     btn.Size = UDim2.new(1, -8, 0, 24)  -- smaller height
  264.     btn.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  265.     btn.TextColor3 = Color3.fromRGB(255, 255, 255)
  266.     btn.BorderSizePixel = 0
  267.     btn.AutoButtonColor = true
  268.     btn.MouseButton1Click:Connect(callback)
  269.     btn.Parent = Container
  270.     createRounded(btn, 5)
  271. end
  272.  
  273. function UILib:AddToggle(text, config, callback)
  274.     if typeof(config) == "function" then
  275.         callback = config
  276.         config = {}
  277.     end
  278.  
  279.     local loop = config.loop
  280.     local toggle = Instance.new("TextButton")
  281.     toggle.Font = Enum.Font.Gotham
  282.     toggle.TextSize = 13  -- smaller font size
  283.     toggle.Size = UDim2.new(1, -8, 0, 24)  -- smaller height
  284.     toggle.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  285.     toggle.BorderSizePixel = 0
  286.     toggle.AutoButtonColor = true
  287.     toggle.Parent = Container
  288.     createRounded(toggle, 5)
  289.  
  290.     local state = false
  291.     local loopingThread = nil
  292.  
  293.     local function updateText()
  294.         local status = state and "[ON] " or "[OFF] "
  295.         local color = state and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 80, 80)
  296.         toggle.Text = status .. text
  297.         toggle.TextColor3 = color
  298.     end
  299.  
  300.     toggle.MouseButton1Click:Connect(function()
  301.         state = not state
  302.         updateText()
  303.         if loop then
  304.             if state then
  305.                 local delayTime = tonumber(config.loopdelay) or 0.2
  306.                 loopingThread = coroutine.create(function()
  307.                     while state do
  308.                         pcall(callback)
  309.                         task.wait(delayTime)
  310.                     end
  311.                 end)
  312.                 coroutine.resume(loopingThread)
  313.             else
  314.                 loopingThread = nil
  315.             end
  316.         else
  317.             pcall(callback, state)
  318.         end
  319.     end)
  320.  
  321.     updateText()
  322. end
  323.  
  324. function UILib:AddSlider(text, settings, callback)
  325.     local frame = Instance.new("Frame")
  326.     frame.Size = UDim2.new(1, -8, 0, 35)  -- smaller height
  327.     frame.BackgroundTransparency = 1
  328.     frame.Parent = Container
  329.  
  330.     local lbl = Instance.new("TextLabel")
  331.     lbl.Text = text .. ": " .. tostring(settings.default)
  332.     lbl.Font = Enum.Font.Gotham
  333.     lbl.TextSize = 12  -- smaller font size
  334.     lbl.TextColor3 = Color3.fromRGB(200, 200, 200)
  335.     lbl.BackgroundTransparency = 1
  336.     lbl.Size = UDim2.new(1, 0, 0, 16)
  337.     lbl.TextXAlignment = Enum.TextXAlignment.Left
  338.     lbl.Parent = frame
  339.  
  340.     local sliderBG = Instance.new("Frame")
  341.     sliderBG.Size = UDim2.new(1, 0, 0, 8)  -- thinner slider
  342.     sliderBG.Position = UDim2.new(0, 0, 0, 22)
  343.     sliderBG.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  344.     sliderBG.BorderSizePixel = 0
  345.     sliderBG.Parent = frame
  346.     createRounded(sliderBG, 5)
  347.  
  348.     local sliderFG = Instance.new("Frame")
  349.     sliderFG.Size = UDim2.new((settings.default - settings.min)/(settings.max-settings.min), 0, 1, 0)
  350.     sliderFG.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
  351.     sliderFG.BorderSizePixel = 0
  352.     sliderFG.Parent = sliderBG
  353.     createRounded(sliderFG, 5)
  354.  
  355.     local draggingSlider = false
  356.  
  357.     local function updateSlider(input)
  358.         local pos = math.clamp((input.Position.X - sliderBG.AbsolutePosition.X) / sliderBG.AbsoluteSize.X, 0, 1)
  359.         local value = math.floor(settings.min + (settings.max - settings.min) * pos)
  360.         sliderFG.Size = UDim2.new(pos, 0, 1, 0)
  361.         lbl.Text = text .. ": " .. tostring(value)
  362.         callback(value)
  363.     end
  364.  
  365.     sliderBG.InputBegan:Connect(function(input)
  366.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  367.             draggingSlider = true
  368.             updateSlider(input)
  369.         end
  370.     end)
  371.  
  372.     UIS.InputEnded:Connect(function(input)
  373.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  374.             draggingSlider = false
  375.         end
  376.     end)
  377.  
  378.     UIS.InputChanged:Connect(function(input)
  379.         if draggingSlider and input.UserInputType == Enum.UserInputType.MouseMovement then
  380.             updateSlider(input)
  381.         end
  382.     end)
  383. end
  384.  
  385. return UILib
  386.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement