Advertisement
zotiyacW

Untitled

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