AugusTH

Untitled

Jan 1st, 2024 (edited)
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.25 KB | None | 0 0
  1. local library = {}
  2. local windowCount = 0
  3. local sizes = {}
  4. local listOffset = {}
  5. local windows = {}
  6. local pastSliders = {}
  7. local dropdowns = {}
  8. local dropdownSizes = {}
  9. local destroyed
  10.  
  11. local colorPickers = {}
  12.  
  13. if game.CoreGui:FindFirstChild('TurtleUiLib') then
  14. game.CoreGui:FindFirstChild('TurtleUiLib'):Destroy()
  15. destroyed = true
  16. end
  17.  
  18. function Lerp(a, b, c)
  19. return a + ((b - a) * c)
  20. end
  21.  
  22. local players = game:service('Players');
  23. local player = players.LocalPlayer;
  24. local mouse = player:GetMouse();
  25. local run = game:service('RunService');
  26. local stepped = run.Stepped;
  27. function Dragify(obj)
  28. spawn(function()
  29. local minitial;
  30. local initial;
  31. local isdragging;
  32. obj.InputBegan:Connect(function(input)
  33. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  34. isdragging = true;
  35. minitial = input.Position;
  36. initial = obj.Position;
  37. local con;
  38. con = stepped:Connect(function()
  39. if isdragging then
  40. local delta = Vector3.new(mouse.X, mouse.Y, 0) - minitial;
  41. obj.Position = UDim2.new(initial.X.Scale, initial.X.Offset + delta.X, initial.Y.Scale, initial.Y.Offset + delta.Y);
  42. else
  43. con:Disconnect();
  44. end;
  45. end);
  46. input.Changed:Connect(function()
  47. if input.UserInputState == Enum.UserInputState.End then
  48. isdragging = false;
  49. end;
  50. end);
  51. end;
  52. end);
  53. end)
  54. end
  55.  
  56. -- Instances:
  57.  
  58. local function protect_gui(obj)
  59. if destroyed then
  60. obj.Parent = game.CoreGui
  61. return
  62. end
  63. if syn and syn.protect_gui then
  64. syn.protect_gui(obj)
  65. obj.Parent = game.CoreGui
  66. elseif PROTOSMASHER_LOADED then
  67. obj.Parent = get_hidden_gui()
  68. else
  69. obj.Parent = game.CoreGui
  70. end
  71. end
  72. local TurtleUiLib = Instance.new("ScreenGui")
  73.  
  74. TurtleUiLib.Name = "TurtleUiLib"
  75.  
  76. protect_gui(TurtleUiLib)
  77.  
  78. local xOffset = 20
  79.  
  80. local uis = game:GetService("UserInputService")
  81.  
  82. local keybindConnection
  83.  
  84. function library:Destroy()
  85. TurtleUiLib:Destroy()
  86. if keybindConnection then
  87. keybindConnection:Disconnect()
  88. end
  89. end
  90. function library:Keybind(key)
  91. if keybindConnection then keybindConnection:Disconnect() end
  92.  
  93. keybindConnection = uis.InputBegan:Connect(function(input, gp)
  94. if not gp and input.KeyCode == Enum.KeyCode[key] then
  95. TurtleUiLib.Enabled = not TurtleUiLib.Enabled
  96. end
  97. end)
  98. end
  99.  
  100. function library:Window(name)
  101. windowCount = windowCount + 1
  102. local winCount = windowCount
  103. local zindex = winCount * 7
  104. local UiWindow = Instance.new("Frame")
  105.  
  106. UiWindow.Name = "UiWindow"
  107. UiWindow.Parent = TurtleUiLib
  108. UiWindow.BackgroundColor3 = Color3.fromRGB(0.01, 0, 0)
  109. UiWindow.BorderColor3 = Color3.fromRGB(0.01, 0, 0)
  110. UiWindow.Position = UDim2.new(0, xOffset, 0, 20)
  111. UiWindow.Size = UDim2.new(0, 207, 0, 33)
  112. UiWindow.ZIndex = 4 + zindex
  113. UiWindow.Active = true
  114. Dragify(UiWindow)
  115.  
  116. xOffset = xOffset + 230
  117.  
  118. local Header = Instance.new("Frame")
  119. Header.Name = "Header"
  120. Header.Parent = UiWindow
  121. Header.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  122. Header.BorderColor3 = Color3.fromRGB(0.01, 0, 0)
  123. Header.Position = UDim2.new(0, 0, -0.0202544238, 0)
  124. Header.Size = UDim2.new(0, 207, 0, 26)
  125. Header.ZIndex = 5 + zindex
  126.  
  127. local HeaderText = Instance.new("TextLabel")
  128. HeaderText.Name = "HeaderText"
  129. HeaderText.Parent = Header
  130. HeaderText.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  131. HeaderText.BackgroundTransparency = 1.000
  132. HeaderText.Position = UDim2.new(0, 0, -0.0020698905, 0)
  133. HeaderText.Size = UDim2.new(0, 206, 0, 33)
  134. HeaderText.ZIndex = 6 + zindex
  135. HeaderText.Font = Enum.Font.PermanentMarker
  136. HeaderText.Text = name or "Window"
  137. HeaderText.TextColor3 = Color3.fromRGB(47, 54, 64)
  138. HeaderText.TextSize = 17.000
  139.  
  140. local Minimise = Instance.new("TextButton")
  141. local Window = Instance.new("Frame")
  142. Minimise.Name = "Minimise"
  143. Minimise.Parent = Header
  144. Minimise.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  145. Minimise.BorderColor3 = Color3.fromRGB(255, 0, 0)
  146. Minimise.Position = UDim2.new(0, 185, 0, 2)
  147. Minimise.Size = UDim2.new(0, 22, 0, 22)
  148. Minimise.ZIndex = 7 + zindex
  149. Minimise.Font = Enum.Font.PermanentMarker
  150. Minimise.Text = "_"
  151. Minimise.TextColor3 = Color3.fromRGB(0, 0, 0)
  152. Minimise.TextSize = 20.000
  153. Minimise.MouseButton1Up:connect(function()
  154. Window.Visible = not Window.Visible
  155. if Window.Visible then
  156. Minimise.Text = "_"
  157. else
  158. Minimise.Text = "+"
  159. end
  160. end)
  161.  
  162. Window.Name = "Window"
  163. Window.Parent = Header
  164. Window.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  165. Window.BorderColor3 = Color3.fromRGB(47, 54, 64)
  166. Window.Position = UDim2.new(0, 0, 0, 0)
  167. Window.Size = UDim2.new(0, 207, 0, 33)
  168. Window.ZIndex = 1 + zindex
  169.  
  170. local functions = {}
  171. sizes[winCount] = 33
  172. listOffset[winCount] = 10
  173. function functions:Button(name, callback)
  174. local name = name or "Button"
  175. local callback = callback or function() end
  176.  
  177. sizes[winCount] = sizes[winCount] + 32
  178. Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  179.  
  180. local Button = Instance.new("TextButton")
  181. listOffset[winCount] = listOffset[winCount] + 32
  182. Button.Name = "Button"
  183. Button.Parent = Window
  184. Button.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  185. Button.BorderColor3 = Color3.fromRGB(113, 128, 147)
  186. Button.Position = UDim2.new(0, 12, 0, listOffset[winCount])
  187. Button.Size = UDim2.new(0, 182, 0, 26)
  188. Button.ZIndex = 2 + zindex
  189. Button.Selected = true
  190. Button.Font = Enum.Font.PermanentMarker
  191. Button.TextColor3 = Color3.fromRGB(245, 246, 250)
  192. Button.TextSize = 16.000
  193. Button.TextStrokeTransparency = 123.000
  194. Button.TextWrapped = true
  195. Button.Text = name
  196. Button.MouseButton1Down:Connect(callback)
  197.  
  198. pastSliders[winCount] = false
  199. end
  200. function functions:Label(text, color)
  201. local color = color or Color3.fromRGB(220, 221, 225)
  202.  
  203. sizes[winCount] = sizes[winCount] + 32
  204. Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  205.  
  206. listOffset[winCount] = listOffset[winCount] + 32
  207. local Label = Instance.new("TextLabel")
  208. Label.Name = "Label"
  209. Label.Parent = Window
  210. Label.BackgroundColor3 = Color3.fromRGB(220, 221, 225)
  211. Label.BackgroundTransparency = 1.000
  212. Label.BorderColor3 = Color3.fromRGB(27, 42, 53)
  213. Label.Position = UDim2.new(0, 0, 0, listOffset[winCount])
  214. Label.Size = UDim2.new(0, 206, 0, 29)
  215. Label.Font = Enum.Font.PermanentMarker
  216. Label.Text = text or "Label"
  217. Label.TextSize = 16.000
  218. Label.ZIndex = 2 + zindex
  219.  
  220. if type(color) == "boolean" and color then
  221. spawn(function()
  222. while wait() do
  223. local hue = tick() % 5 / 5
  224. Label.TextColor3 = Color3.fromHSV(hue, 1, 1)
  225. end
  226. end)
  227. else
  228. Label.TextColor3 = color
  229. end
  230. pastSliders[winCount] = false
  231. end
  232. function functions:Toggle(text, on, callback)
  233. local callback = callback or function() end
  234.  
  235. sizes[winCount] = sizes[winCount] + 32
  236. Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  237.  
  238. listOffset[winCount] = listOffset[winCount] + 32
  239.  
  240. local ToggleDescription = Instance.new("TextLabel")
  241. local ToggleButton = Instance.new("TextButton")
  242. local ToggleFiller = Instance.new("Frame")
  243.  
  244. ToggleDescription.Name = "ToggleDescription"
  245. ToggleDescription.Parent = Window
  246. ToggleDescription.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  247. ToggleDescription.BackgroundTransparency = 1.000
  248. ToggleDescription.Position = UDim2.new(0, 14, 0, listOffset[winCount])
  249. ToggleDescription.Size = UDim2.new(0, 131, 0, 26)
  250. ToggleDescription.Font = Enum.Font.PermanentMarker
  251. ToggleDescription.Text = text or "Toggle"
  252. ToggleDescription.TextColor3 = Color3.fromRGB(245, 246, 250)
  253. ToggleDescription.TextSize = 16.000
  254. ToggleDescription.TextWrapped = true
  255. ToggleDescription.TextXAlignment = Enum.TextXAlignment.Left
  256. ToggleDescription.ZIndex = 2 + zindex
  257.  
  258. ToggleButton.Name = "ToggleButton"
  259. ToggleButton.Parent = ToggleDescription
  260. ToggleButton.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  261. ToggleButton.BorderColor3 = Color3.fromRGB(113, 128, 147)
  262. ToggleButton.Position = UDim2.new(1.2061069, 0, 0.0769230798, 0)
  263. ToggleButton.Size = UDim2.new(0, 22, 0, 22)
  264. ToggleButton.Font = Enum.Font.PermanentMarker
  265. ToggleButton.Text = ""
  266. ToggleButton.TextColor3 = Color3.fromRGB(0, 0, 0)
  267. ToggleButton.TextSize = 14.000
  268. ToggleButton.ZIndex = 2 + zindex
  269. ToggleButton.MouseButton1Up:Connect(function()
  270. ToggleFiller.Visible = not ToggleFiller.Visible
  271. callback(ToggleFiller.Visible)
  272. end)
  273.  
  274. ToggleFiller.Name = "ToggleFiller"
  275. ToggleFiller.Parent = ToggleButton
  276. ToggleFiller.BackgroundColor3 = Color3.fromRGB(68, 189, 50)
  277. ToggleFiller.BorderColor3 = Color3.fromRGB(47, 54, 64)
  278. ToggleFiller.Position = UDim2.new(0, 5, 0, 5)
  279. ToggleFiller.Size = UDim2.new(0, 12, 0, 12)
  280. ToggleFiller.Visible = on
  281. ToggleFiller.ZIndex = 2 + zindex
  282. pastSliders[winCount] = false
  283. end
  284. function functions:Box(text, callback)
  285. local callback = callback or function() end
  286.  
  287. sizes[winCount] = sizes[winCount] + 32
  288. Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  289.  
  290. listOffset[winCount] = listOffset[winCount] + 32
  291. local TextBox = Instance.new("TextBox")
  292. local BoxDescription = Instance.new("TextLabel")
  293. TextBox.Parent = Window
  294. TextBox.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  295. TextBox.BorderColor3 = Color3.fromRGB(113, 128, 147)
  296. TextBox.Position = UDim2.new(0, 99, 0, listOffset[winCount])
  297. TextBox.Size = UDim2.new(0, 95, 0, 26)
  298. TextBox.Font = Enum.Font.PermanentMarker
  299. TextBox.PlaceholderColor3 = Color3.fromRGB(220, 221, 225)
  300. TextBox.PlaceholderText = "..."
  301. TextBox.Text = ""
  302. TextBox.TextColor3 = Color3.fromRGB(245, 246, 250)
  303. TextBox.TextSize = 16.000
  304. TextBox.TextStrokeColor3 = Color3.fromRGB(245, 246, 250)
  305. TextBox.ZIndex = 2 + zindex
  306. TextBox:GetPropertyChangedSignal('Text'):connect(function()
  307. callback(TextBox.Text, false)
  308. end)
  309. TextBox.FocusLost:Connect(function()
  310. callback(TextBox.Text, true)
  311. end)
  312.  
  313. BoxDescription.Name = "BoxDescription"
  314. BoxDescription.Parent = TextBox
  315. BoxDescription.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  316. BoxDescription.BackgroundTransparency = 1.000
  317. BoxDescription.Position = UDim2.new(-0.894736826, 0, 0, 0)
  318. BoxDescription.Size = UDim2.new(0, 75, 0, 26)
  319. BoxDescription.Font = Enum.Font.PermanentMarker
  320. BoxDescription.Text = text or "Box"
  321. BoxDescription.TextColor3 = Color3.fromRGB(245, 246, 250)
  322. BoxDescription.TextSize = 16.000
  323. BoxDescription.TextXAlignment = Enum.TextXAlignment.Left
  324. BoxDescription.ZIndex = 2 + zindex
  325. pastSliders[winCount] = false
  326. end
  327. function functions:Slider(text, min, max, default, callback)
  328. local text = text or "Slider"
  329. local min = min or 1
  330. local max = max or 100
  331. local default = default or max/2
  332. local callback = callback or function() end
  333. local offset = 70
  334. if default > max then
  335. default = max
  336. elseif default < min then
  337. default = min
  338. end
  339.  
  340. if pastSliders[winCount] then
  341. offset = 60
  342. end
  343.  
  344. sizes[winCount] = sizes[winCount] + offset
  345. Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  346.  
  347. listOffset[winCount] = listOffset[winCount] + offset
  348.  
  349. local Slider = Instance.new("Frame")
  350. local SliderButton = Instance.new("Frame")
  351. local Description = Instance.new("TextLabel")
  352. local SilderFiller = Instance.new("Frame")
  353. local Current = Instance.new("TextLabel")
  354. local Min = Instance.new("TextLabel")
  355. local Max = Instance.new("TextLabel")
  356.  
  357. function SliderMovement(input)
  358. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  359. isdragging = true;
  360. minitial = input.Position.X;
  361. initial = SliderButton.Position.X.Offset;
  362. local delta1 = SliderButton.AbsolutePosition.X - initial
  363. local con;
  364. con = stepped:Connect(function()
  365. if isdragging then
  366. local xOffset = mouse.X - delta1 - 3
  367. if xOffset > 175 then
  368. xOffset = 175
  369. elseif xOffset< 0 then
  370. xOffset = 0
  371. end
  372. SliderButton.Position = UDim2.new(0, xOffset , -1.33333337, 0);
  373. SilderFiller.Size = UDim2.new(0, xOffset, 0, 6)
  374. local value = Lerp(min, max, SliderButton.Position.X.Offset/(Slider.Size.X.Offset-5))
  375. Current.Text = tostring(math.round(value))
  376. else
  377. con:Disconnect();
  378. end;
  379. end);
  380. input.Changed:Connect(function()
  381. if input.UserInputState == Enum.UserInputState.End then
  382. isdragging = false;
  383. end;
  384. end);
  385. end;
  386. end
  387. function SliderEnd(input)
  388. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  389. local value = Lerp(min, max, SliderButton.Position.X.Offset/(Slider.Size.X.Offset-5))
  390. callback(math.round(value))
  391. end
  392. end
  393.  
  394. Slider.Name = "Slider"
  395. Slider.Parent = Window
  396. Slider.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  397. Slider.BorderColor3 = Color3.fromRGB(113, 128, 147)
  398. Slider.Position = UDim2.new(0, 13, 0, listOffset[winCount])
  399. Slider.Size = UDim2.new(0, 180, 0, 6)
  400. Slider.ZIndex = 2 + zindex
  401. Slider.InputBegan:Connect(SliderMovement)
  402. Slider.InputEnded:Connect(SliderEnd)
  403.  
  404. SliderButton.Position = UDim2.new(0, (Slider.Size.X.Offset - 5) * ((default - min)/(max-min)), -1.333337, 0)
  405. SliderButton.Name = "SliderButton"
  406. SliderButton.Parent = Slider
  407. SliderButton.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  408. SliderButton.BorderColor3 = Color3.fromRGB(113, 128, 147)
  409. SliderButton.Size = UDim2.new(0, 6, 0, 22)
  410. SliderButton.ZIndex = 3 + zindex
  411. SliderButton.InputBegan:Connect(SliderMovement)
  412. SliderButton.InputEnded:Connect(SliderEnd)
  413.  
  414. Current.Name = "Current"
  415. Current.Parent = SliderButton
  416. Current.BackgroundTransparency = 1.000
  417. Current.Position = UDim2.new(0, 3, 0, 22 )
  418. Current.Size = UDim2.new(0, 0, 0, 18)
  419. Current.Font = Enum.Font.PermanentMarker
  420. Current.Text = tostring(default)
  421. Current.TextColor3 = Color3.fromRGB(220, 221, 225)
  422. Current.TextSize = 14.000
  423. Current.ZIndex = 2 + zindex
  424.  
  425. Description.Name = "Description"
  426. Description.Parent = Slider
  427. Description.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  428. Description.BackgroundTransparency = 1.000
  429. Description.Position = UDim2.new(0, -10, 0, -35)
  430. Description.Size = UDim2.new(0, 200, 0, 21)
  431. Description.Font = Enum.Font.PermanentMarker
  432. Description.Text = text
  433. Description.TextColor3 = Color3.fromRGB(245, 246, 250)
  434. Description.TextSize = 16.000
  435. Description.ZIndex = 2 + zindex
  436.  
  437. SilderFiller.Name = "SilderFiller"
  438. SilderFiller.Parent = Slider
  439. SilderFiller.BackgroundColor3 = Color3.fromRGB(76, 209, 55)
  440. SilderFiller.BorderColor3 = Color3.fromRGB(47, 54, 64)
  441. SilderFiller.Size = UDim2.new(0, (Slider.Size.X.Offset - 5) * ((default - min)/(max-min)), 0, 6)
  442. SilderFiller.ZIndex = 2 + zindex
  443. SilderFiller.BorderMode = Enum.BorderMode.Inset
  444.  
  445. Min.Name = "Min"
  446. Min.Parent = Slider
  447. Min.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  448. Min.BackgroundTransparency = 1.000
  449. Min.Position = UDim2.new(-0.00555555569, 0, -7.33333397, 0)
  450. Min.Size = UDim2.new(0, 77, 0, 50)
  451. Min.Font = Enum.Font.PermanentMarker
  452. Min.Text = tostring(min)
  453. Min.TextColor3 = Color3.fromRGB(220, 221, 225)
  454. Min.TextSize = 14.000
  455. Min.TextXAlignment = Enum.TextXAlignment.Left
  456. Min.ZIndex = 2 + zindex
  457.  
  458. Max.Name = "Max"
  459. Max.Parent = Slider
  460. Max.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  461. Max.BackgroundTransparency = 1.000
  462. Max.Position = UDim2.new(0.577777743, 0, -7.33333397, 0)
  463. Max.Size = UDim2.new(0, 77, 0, 50)
  464. Max.Font = Enum.Font.PermanentMarker
  465. Max.Text = tostring(max)
  466. Max.TextColor3 = Color3.fromRGB(220, 221, 225)
  467. Max.TextSize = 14.000
  468. Max.TextXAlignment = Enum.TextXAlignment.Right
  469. Max.ZIndex = 2 + zindex
  470. pastSliders[winCount] = true
  471. end
  472. function functions:Dropdown(text, buttons, callback)
  473. local text = text or "Dropdown"
  474. local buttons = buttons or {}
  475. local callback = callback or function() end
  476.  
  477. local Dropdown = Instance.new("TextButton")
  478. local DownSign = Instance.new("TextLabel")
  479. local DropdownFrame = Instance.new("ScrollingFrame")
  480.  
  481. sizes[winCount] = sizes[winCount] + 32
  482. Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  483.  
  484. listOffset[winCount] = listOffset[winCount] + 32
  485.  
  486. Dropdown.Name = "Dropdown"
  487. Dropdown.Parent = Window
  488. Dropdown.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  489. Dropdown.BorderColor3 = Color3.fromRGB(113, 128, 147)
  490. Dropdown.Position = UDim2.new(0, 12, 0, listOffset[winCount])
  491. Dropdown.Size = UDim2.new(0, 182, 0, 26)
  492. Dropdown.Selected = true
  493. Dropdown.Font = Enum.Font.PermanentMarker
  494. Dropdown.Text = tostring(text)
  495. Dropdown.TextColor3 = Color3.fromRGB(245, 246, 250)
  496. Dropdown.TextSize = 16.000
  497. Dropdown.TextStrokeTransparency = 123.000
  498. Dropdown.TextWrapped = true
  499. Dropdown.ZIndex = 3 + zindex
  500. Dropdown.MouseButton1Up:Connect(function()
  501. for i, v in pairs(dropdowns) do
  502. if v ~= DropdownFrame then
  503. v.Visible = false
  504. DownSign.Rotation = 0
  505. end
  506. end
  507. if DropdownFrame.Visible then
  508. DownSign.Rotation = 0
  509. else
  510. DownSign.Rotation = 180
  511. end
  512. DropdownFrame.Visible = not DropdownFrame.Visible
  513. end)
  514.  
  515. DownSign.Name = "DownSign"
  516. DownSign.Parent = Dropdown
  517. DownSign.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  518. DownSign.BackgroundTransparency = 1.000
  519. DownSign.Position = UDim2.new(0, 155, 0, 2)
  520. DownSign.Size = UDim2.new(0, 27, 0, 22)
  521. DownSign.Font = Enum.Font.PermanentMarker
  522. DownSign.Text = "^"
  523. DownSign.TextColor3 = Color3.fromRGB(220, 221, 225)
  524. DownSign.TextSize = 20.000
  525. DownSign.ZIndex = 4 + zindex
  526. DownSign.TextYAlignment = Enum.TextYAlignment.Bottom
  527.  
  528. DropdownFrame.Name = "DropdownFrame"
  529. DropdownFrame.Parent = Dropdown
  530. DropdownFrame.Active = true
  531. DropdownFrame.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  532. DropdownFrame.BorderColor3 = Color3.fromRGB(53, 59, 72)
  533. DropdownFrame.Position = UDim2.new(0, 0, 0, 28)
  534. DropdownFrame.Size = UDim2.new(0, 182, 0, 0)
  535. DropdownFrame.Visible = false
  536. DropdownFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
  537. DropdownFrame.ScrollBarThickness = 4
  538. DropdownFrame.VerticalScrollBarPosition = Enum.VerticalScrollBarPosition.Left
  539. DropdownFrame.ZIndex = 5 + zindex
  540. DropdownFrame.ScrollingDirection = Enum.ScrollingDirection.Y
  541. DropdownFrame.ScrollBarImageColor3 = Color3.fromRGB(220, 221, 225)
  542. table.insert(dropdowns, DropdownFrame)
  543. local dropFunctions = {}
  544. local canvasSize = 0
  545. function dropFunctions:Button(name)
  546. local name = name or ""
  547. local Button_2 = Instance.new("TextButton")
  548. Button_2.Name = "Button"
  549. Button_2.Parent = DropdownFrame
  550. Button_2.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  551. Button_2.BorderColor3 = Color3.fromRGB(113, 128, 147)
  552. Button_2.Position = UDim2.new(0, 6, 0, canvasSize + 1)
  553. Button_2.Size = UDim2.new(0, 170, 0, 26)
  554. Button_2.Selected = true
  555. Button_2.Font = Enum.Font.PermanentMarker
  556. Button_2.TextColor3 = Color3.fromRGB(245, 246, 250)
  557. Button_2.TextSize = 16.000
  558. Button_2.TextStrokeTransparency = 123.000
  559. Button_2.ZIndex = 6 + zindex
  560. Button_2.Text = name
  561. Button_2.TextWrapped = true
  562. canvasSize = canvasSize + 27
  563. DropdownFrame.CanvasSize = UDim2.new(0, 182, 0, canvasSize + 1)
  564. if #DropdownFrame:GetChildren() < 8 then
  565. DropdownFrame.Size = UDim2.new(0, 182, 0, DropdownFrame.Size.Y.Offset + 27)
  566. end
  567. Button_2.MouseButton1Up:Connect(function()
  568. callback(name)
  569. DropdownFrame.Visible = false
  570. end)
  571. end
  572. function dropFunctions:Remove(name)
  573. local foundIt
  574. for i, v in pairs(DropdownFrame:GetChildren()) do
  575. if foundIt then
  576. canvasSize = canvasSize - 27
  577. v.Position = UDim2.new(0, 6, 0, v.Position.Y.Offset - 27)
  578. DropdownFrame.CanvasSize = UDim2.new(0, 182, 0, canvasSize + 1)
  579. end
  580. if v.Text == name then
  581. foundIt = true
  582. v:Destroy()
  583. if #DropdownFrame:GetChildren() < 8 then
  584. DropdownFrame.Size = UDim2.new(0, 182, 0, DropdownFrame.Size.Y.Offset - 27)
  585. end
  586. end
  587. end
  588. if not foundIt then
  589. warn("The button you tried to remove didn't exist!")
  590. end
  591. end
  592.  
  593. for i,v in pairs(buttons) do
  594. dropFunctions:Button(v)
  595. end
  596.  
  597. return dropFunctions
  598. end
  599. function functions:ColorPicker(name, default, callback)
  600. local callback = callback or function() end
  601.  
  602. local ColorPicker = Instance.new("TextButton")
  603. local PickerCorner = Instance.new("UICorner")
  604. local PickerDescription = Instance.new("TextLabel")
  605. local ColorPickerFrame = Instance.new("Frame")
  606. local ToggleRGB = Instance.new("TextButton")
  607. local ToggleFiller_2 = Instance.new("Frame")
  608. local TextLabel = Instance.new("TextLabel")
  609. local ClosePicker = Instance.new("TextButton")
  610. local Canvas = Instance.new("Frame")
  611. local CanvasGradient = Instance.new("UIGradient")
  612. local Cursor = Instance.new("ImageLabel")
  613. local Color = Instance.new("Frame")
  614. local ColorGradient = Instance.new("UIGradient")
  615. local ColorSlider = Instance.new("Frame")
  616. local Title = Instance.new("TextLabel")
  617. local UICorner = Instance.new("UICorner")
  618. local ColorCorner = Instance.new("UICorner")
  619. local BlackOverlay = Instance.new("ImageLabel")
  620.  
  621. sizes[winCount] = sizes[winCount] + 32
  622. Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  623.  
  624. listOffset[winCount] = listOffset[winCount] + 32
  625.  
  626. ColorPicker.Name = "ColorPicker"
  627. ColorPicker.Parent = Window
  628. ColorPicker.Position = UDim2.new(0, 137, 0, listOffset[winCount])
  629. ColorPicker.Size = UDim2.new(0, 57, 0, 26)
  630. ColorPicker.Font = Enum.Font.PermanentMarker
  631. ColorPicker.Text = ""
  632. ColorPicker.TextColor3 = Color3.fromRGB(0, 0, 0)
  633. ColorPicker.TextSize = 14.000
  634. ColorPicker.ZIndex = 2 + zindex
  635. ColorPicker.MouseButton1Up:Connect(function()
  636. for i, v in pairs(colorPickers) do
  637. v.Visible = false
  638. end
  639. ColorPickerFrame.Visible = not ColorPickerFrame.Visible
  640. end)
  641.  
  642. PickerCorner.Parent = ColorPicker
  643. PickerCorner.Name = "PickerCorner"
  644. PickerCorner.CornerRadius = UDim.new(0,2)
  645.  
  646. PickerDescription.Name = "PickerDescription"
  647. PickerDescription.Parent = ColorPicker
  648. PickerDescription.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  649. PickerDescription.BackgroundTransparency = 1.000
  650. PickerDescription.Position = UDim2.new(-2.15789509, 0, 0, 0)
  651. PickerDescription.Size = UDim2.new(0, 116, 0, 26)
  652. PickerDescription.Font = Enum.Font.PermanentMarker
  653. PickerDescription.Text = name or "Color picker"
  654. PickerDescription.TextColor3 = Color3.fromRGB(245, 246, 250)
  655. PickerDescription.TextSize = 16.000
  656. PickerDescription.TextXAlignment = Enum.TextXAlignment.Left
  657. PickerDescription.ZIndex = 2 + zindex
  658.  
  659. ColorPickerFrame.Name = "ColorPickerFrame"
  660. ColorPickerFrame.Parent = ColorPicker
  661. ColorPickerFrame.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  662. ColorPickerFrame.BorderColor3 = Color3.fromRGB(47, 54, 64)
  663. ColorPickerFrame.Position = UDim2.new(1.40350854, 0, -2.84615374, 0)
  664. ColorPickerFrame.Size = UDim2.new(0, 158, 0, 155)
  665. ColorPickerFrame.ZIndex = 3 + zindex
  666. ColorPickerFrame.Visible = false
  667.  
  668. ToggleRGB.Name = "ToggleRGB"
  669. ToggleRGB.Parent = ColorPickerFrame
  670. ToggleRGB.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  671. ToggleRGB.BorderColor3 = Color3.fromRGB(113, 128, 147)
  672. ToggleRGB.Position = UDim2.new(0, 125, 0, 127)
  673. ToggleRGB.Size = UDim2.new(0, 22, 0, 22)
  674. ToggleRGB.Font = Enum.Font.PermanentMarker
  675. ToggleRGB.Text = ""
  676. ToggleRGB.TextColor3 = Color3.fromRGB(0, 0, 0)
  677. ToggleRGB.TextSize = 14.000
  678. ToggleRGB.ZIndex = 4 + zindex
  679.  
  680. ToggleFiller_2.Name = "ToggleFiller"
  681. ToggleFiller_2.Parent = ToggleRGB
  682. ToggleFiller_2.BackgroundColor3 = Color3.fromRGB(76, 209, 55)
  683. ToggleFiller_2.BorderColor3 = Color3.fromRGB(47, 54, 64)
  684. ToggleFiller_2.Position = UDim2.new(0, 5, 0, 5)
  685. ToggleFiller_2.Size = UDim2.new(0, 12, 0, 12)
  686. ToggleFiller_2.ZIndex = 4 + zindex
  687. ToggleFiller_2.Visible = false
  688.  
  689. TextLabel.Parent = ToggleRGB
  690. TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  691. TextLabel.BackgroundTransparency = 1.000
  692. TextLabel.Position = UDim2.new(-5.13636351, 0, 0, 0)
  693. TextLabel.Size = UDim2.new(0, 106, 0, 22)
  694. TextLabel.Font = Enum.Font.PermanentMarker
  695. TextLabel.Text = "Rainbow"
  696. TextLabel.TextColor3 = Color3.fromRGB(245, 246, 250)
  697. TextLabel.TextSize = 16.000
  698. TextLabel.TextXAlignment = Enum.TextXAlignment.Left
  699. TextLabel.ZIndex = 4 + zindex
  700.  
  701. ClosePicker.Name = "ClosePicker"
  702. ClosePicker.Parent = ColorPickerFrame
  703. ClosePicker.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  704. ClosePicker.BorderColor3 = Color3.fromRGB(47, 54, 64)
  705. ClosePicker.Position = UDim2.new(0, 132, 0, 5)
  706. ClosePicker.Size = UDim2.new(0, 21, 0, 21)
  707. ClosePicker.Font = Enum.Font.PermanentMarker
  708. ClosePicker.Text = "X"
  709. ClosePicker.TextColor3 = Color3.fromRGB(245, 246, 250)
  710. ClosePicker.TextSize = 18.000
  711. ClosePicker.ZIndex = 4 + zindex
  712. ClosePicker.MouseButton1Down:Connect(function()
  713. ColorPickerFrame.Visible = not ColorPickerFrame.Visible
  714. end)
  715.  
  716. CanvasGradient.Color = ColorSequence.new{ColorSequenceKeypoint.new(0.00, Color3.fromRGB(255, 0, 0)), ColorSequenceKeypoint.new(1.00, Color3.fromRGB(255, 255, 255))}
  717. CanvasGradient.Name = "CanvasGradient"
  718. CanvasGradient.Parent = Canvas
  719.  
  720. BlackOverlay.Name = "BlackOverlay"
  721. BlackOverlay.Parent = Canvas
  722. BlackOverlay.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  723. BlackOverlay.BackgroundTransparency = 1.000
  724. BlackOverlay.Size = UDim2.new(1, 0, 1, 0)
  725. BlackOverlay.Image = "rbxassetid://5107152095"
  726. BlackOverlay.ZIndex = 5 + zindex
  727.  
  728. UICorner.Parent = Canvas
  729. UICorner.Name = "UICorner"
  730. UICorner.CornerRadius = UDim.new(0,2)
  731.  
  732. Cursor.Name = "Cursor"
  733. Cursor.Parent = Canvas
  734. Cursor.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  735. Cursor.BackgroundTransparency = 1.000
  736. Cursor.Size = UDim2.new(0, 8, 0, 8)
  737. Cursor.Image = "rbxassetid://5100115962"
  738. Cursor.ZIndex = 5 + zindex
  739.  
  740. local draggingColor = false
  741. local hue = 0
  742. local sat = 1
  743. local brightness = 1
  744.  
  745. local con
  746.  
  747. ToggleRGB.MouseButton1Down:Connect(function()
  748. ToggleFiller_2.Visible = not ToggleFiller_2.Visible
  749. if ToggleFiller_2.Visible then
  750. con = stepped:Connect(function()
  751. if ToggleFiller_2.Visible then
  752. local hue2 = tick() % 5 / 5
  753. color3 = Color3.fromHSV(hue2, 1, 1)
  754. callback(color3, true)
  755. ColorPicker.BackgroundColor3 = color3
  756. else
  757. con:Disconnect()
  758. end
  759. end)
  760. end
  761. end)
  762.  
  763. if default and type(default) == "boolean" then
  764. ToggleFiller_2.Visible = true
  765. if ToggleFiller_2.Visible then
  766. con = stepped:Connect(function()
  767. if ToggleFiller_2.Visible then
  768. local hue2 = tick() % 5 / 5
  769. color3 = Color3.fromHSV(hue2, 1, 1)
  770. callback(color3)
  771. ColorPicker.BackgroundColor3 = color3
  772. else
  773. con:Disconnect()
  774. end
  775. end)
  776. end
  777. else
  778. ColorPicker.BackgroundColor3 = default or Color3.fromRGB(0, 168, 255)
  779. end
  780.  
  781. Canvas.Name = "Canvas"
  782. Canvas.Parent = ColorPickerFrame
  783. Canvas.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  784. Canvas.Position = UDim2.new(0, 5, 0, 34)
  785. Canvas.Size = UDim2.new(0, 148, 0, 64)
  786. Canvas.ZIndex = 4 + zindex
  787. local canvasSize, canvasPosition = Canvas.AbsoluteSize, Canvas.AbsolutePosition
  788. Canvas.InputBegan:Connect(function(input)
  789. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  790. local initial = Vector2.new(Cursor.Position.X.Offset, Cursor.Position.Y.Offset)
  791. local delta = Cursor.AbsolutePosition - initial
  792. local con;
  793. local isdragging = true
  794.  
  795. con = stepped:Connect(function()
  796. if isdragging then
  797. local delta2 = Vector2.new(mouse.X, mouse.Y) - delta
  798. local x = math.clamp(delta2.X, 2, Canvas.Size.X.Offset - 2)
  799. local y = math.clamp(delta2.Y, 2, Canvas.Size.Y.Offset - 2)
  800.  
  801. sat = 1 - math.clamp((mouse.X - canvasPosition.X) / canvasSize.X, 0, 1)
  802. brightness = 1 - math.clamp((mouse.Y - canvasPosition.Y) / canvasSize.Y, 0, 1)
  803.  
  804. color3 = Color3.fromHSV(hue, sat, brightness)
  805.  
  806. Cursor.Position = UDim2.fromOffset(x - 4, y - 4)
  807. ColorPicker.BackgroundColor3 = color3
  808. callback(color3)
  809. else
  810. con:Disconnect();
  811. end;
  812. end);
  813. input.Changed:Connect(function()
  814. if input.UserInputState == Enum.UserInputState.End then
  815. isdragging = false;
  816. end;
  817. end);
  818. end;
  819. end);
  820.  
  821. Color.Name = "Color"
  822. Color.Parent = ColorPickerFrame
  823. Color.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  824. Color.Position = UDim2.new(0, 5, 0, 105)
  825. Color.Size = UDim2.new(0, 148, 0, 14)
  826. Color.BorderMode = Enum.BorderMode.Inset
  827. Color.ZIndex = 4 + zindex
  828. Color.InputBegan:Connect(function(input)
  829. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  830. draggingColor = true
  831. local initial2 = ColorSlider.Position.X.Offset;
  832. local delta1 = ColorSlider.AbsolutePosition.X - initial2
  833. local con
  834. con = stepped:Connect(function()
  835. if draggingColor then
  836. -- gets the position of the mouse on the color thing and divides it by its size, whcih will give u the hue
  837. local colorPosition, colorSize = Color.AbsolutePosition, Color.AbsoluteSize
  838. hue = 1 - math.clamp(1 - ((mouse.X - colorPosition.X) / colorSize.X), 0, 1)
  839. CanvasGradient.Color = ColorSequence.new{ColorSequenceKeypoint.new(0.00, Color3.fromHSV(hue, 1, 1)), ColorSequenceKeypoint.new(1.00, Color3.fromRGB(255, 255, 255))}
  840.  
  841. local xOffset = math.clamp(mouse.X - delta1, 0, Color.Size.X.Offset - 3)
  842. ColorSlider.Position = UDim2.new(0, xOffset, 0, 0);
  843.  
  844. color3 = Color3.fromHSV(hue, sat, brightness)
  845. ColorPicker.BackgroundColor3 = color3
  846. callback(color3)
  847. else
  848. con:Disconnect()
  849. end
  850. end)
  851. end
  852. end)
  853. Color.InputEnded:Connect(function(input)
  854. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  855. draggingColor = false
  856. end
  857. end)
  858. ColorGradient.Color = ColorSequence.new({
  859. ColorSequenceKeypoint.new(0.00, Color3.fromRGB(255, 0, 0)),
  860. ColorSequenceKeypoint.new(0.17, Color3.fromRGB(255, 255, 0)),
  861. ColorSequenceKeypoint.new(0.33, Color3.fromRGB(0, 255, 0)),
  862. ColorSequenceKeypoint.new(0.50, Color3.fromRGB(0, 255, 255)),
  863. ColorSequenceKeypoint.new(0.66, Color3.fromRGB(0, 0, 255)),
  864. ColorSequenceKeypoint.new(0.82, Color3.fromRGB(255, 0, 255)),
  865. ColorSequenceKeypoint.new(1.00, Color3.fromRGB(255, 0, 0))
  866. })
  867. ColorGradient.Name = "ColorGradient"
  868. ColorGradient.Parent = Color
  869.  
  870. ColorCorner.Parent = Color
  871. ColorCorner.Name = "ColorCorner"
  872. ColorCorner.CornerRadius = UDim.new(0,2)
  873.  
  874. ColorSlider.Name = "ColorSlider"
  875. ColorSlider.Parent = Color
  876. ColorSlider.BackgroundColor3 = Color3.fromRGB(245, 246, 250)
  877. ColorSlider.BorderColor3 = Color3.fromRGB(245, 246, 250)
  878. ColorSlider.Size = UDim2.new(0, 2, 0, 14)
  879. ColorSlider.ZIndex = 5 + zindex
  880.  
  881. Title.Name = "Title"
  882. Title.Parent = ColorPickerFrame
  883. Title.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  884. Title.BackgroundTransparency = 1.000
  885. Title.Position = UDim2.new(0, 10, 0, 5)
  886. Title.Size = UDim2.new(0, 118, 0, 21)
  887. Title.Font = Enum.Font.SourceSans
  888. Title.Text = name or "Color picker"
  889. Title.TextColor3 = Color3.fromRGB(245, 246, 250)
  890. Title.TextSize = 16.000
  891. Title.TextXAlignment = Enum.TextXAlignment.Left
  892. Title.ZIndex = 4 + zindex
  893.  
  894. table.insert(colorPickers, ColorPickerFrame)
  895.  
  896. local colorFuncs = {}
  897. function colorFuncs:UpdateColorPicker(color)
  898. if type(color) == "userdata" then
  899. ToggleFiller_2.Visible = false
  900. ColorPicker.BackgroundColor3 = color
  901. elseif color and type(color) == "boolean" and not con then
  902. ToggleFiller_2.Visible = true
  903. con = stepped:Connect(function()
  904. if ToggleFiller_2.Visible then
  905. local hue2 = tick() % 5 / 5
  906. color3 = Color3.fromHSV(hue2, 1, 1)
  907. callback(color3)
  908. ColorPicker.BackgroundColor3 = color3
  909. else
  910. con:Disconnect()
  911. end
  912. end)
  913. end
  914. end
  915. return colorFuncs
  916. end
  917.  
  918. return functions
  919. end
  920.  
  921. return library
Advertisement
Add Comment
Please, Sign In to add comment