Advertisement
M0nkePr0

Untitled

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