Jarxay

OctoHook

Jan 5th, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 214.16 KB | None | 0 0
  1. --[[
  2.  
  3. Library Made for https://octohook.xyz/
  4. Developed by liam#4567
  5. Modified by tatar0071#0627
  6.  
  7. Ik this code is really shit in some places lol
  8. will rewrite again i was just using some rly old stuff that i was lazy to rewrite
  9. could've been a lot better and more optimized in some places and some things arent done as they should've been
  10. got lazy when trying to make disable all roblox input when ui is open sooo that will be added later =)
  11.  
  12. ]]
  13.  
  14. -- // Load
  15.  
  16. local startupArgs = ({...})[1] or {}
  17.  
  18. if getgenv().library ~= nil then
  19. getgenv().library:Unload();
  20. end
  21.  
  22. if not game:IsLoaded() then
  23. game.Loaded:Wait()
  24. end
  25.  
  26. local function gs(a)
  27. return game:GetService(a)
  28. end
  29.  
  30. -- // Variables
  31. local players, http, runservice, inputservice, tweenService, stats, actionservice = gs('Players'), gs('HttpService'), gs('RunService'), gs('UserInputService'), gs('TweenService'), gs('Stats'), gs('ContextActionService')
  32. local localplayer = players.LocalPlayer
  33.  
  34. local setByConfig = false
  35. local floor, ceil, huge, pi, clamp = math.floor, math.ceil, math.huge, math.pi, math.clamp
  36. local c3new, fromrgb, fromhsv = Color3.new, Color3.fromRGB, Color3.fromHSV
  37. local next, newInstance, newUDim2, newVector2 = next, Instance.new, UDim2.new, Vector2.new
  38. local isexecutorclosure = isexecutorclosure or is_synapse_function or is_sirhurt_closure or iskrnlclosure;
  39. local executor = (
  40. syn and 'syn' or
  41. getexecutorname and getexecutorname() or
  42. 'unknown'
  43. )
  44.  
  45. local library = {
  46. windows = {};
  47. indicators = {};
  48. flags = {};
  49. options = {};
  50. connections = {};
  51. drawings = {};
  52. instances = {};
  53. utility = {};
  54. notifications = {};
  55. tweens = {};
  56. theme = {};
  57. zindexOrder = {
  58. ['indicator'] = 950;
  59. ['window'] = 1000;
  60. ['dropdown'] = 1200;
  61. ['colorpicker'] = 1100;
  62. ['watermark'] = 1300;
  63. ['notification'] = 1400;
  64. ['cursor'] = 1500;
  65. },
  66. stats = {
  67. ['fps'] = 0;
  68. ['ping'] = 0;
  69. };
  70. images = {
  71. ['gradientp90'] = 'https://raw.githubusercontent.com/portallol/luna/main/modules/gradient90.png';
  72. ['gradientp45'] = 'https://raw.githubusercontent.com/portallol/luna/main/modules/gradient45.png';
  73. ['colorhue'] = 'https://raw.githubusercontent.com/portallol/luna/main/modules/lgbtqshit.png';
  74. ['colortrans'] = 'https://raw.githubusercontent.com/portallol/luna/main/modules/trans.png';
  75. };
  76. numberStrings = {['Zero'] = 0, ['One'] = 1, ['Two'] = 2, ['Three'] = 3, ['Four'] = 4, ['Five'] = 5, ['Six'] = 6, ['Seven'] = 7, ['Eight'] = 8, ['Nine'] = 9};
  77. signal = loadstring(game:HttpGet('https://raw.githubusercontent.com/Quenty/NevermoreEngine/main/src/signal/src/Shared/Signal.lua'))();
  78. open = false;
  79. opening = false;
  80. hasInit = false;
  81. cheatname = startupArgs.cheatname or 'octohook';
  82. gamename = startupArgs.gamename or 'universal';
  83. fileext = startupArgs.fileext or '.txt';
  84. }
  85.  
  86. library.themes = {
  87. {
  88. name = 'Default',
  89. theme = {
  90. ['Accent'] = fromrgb(255, 153, 0);
  91. ['Background'] = fromrgb(18,18,18);
  92. ['Border'] = fromrgb(0,0,0);
  93. ['Border 1'] = fromrgb(60,60,60);
  94. ['Border 2'] = fromrgb(35,35,35);
  95. ['Border 3'] = fromrgb(10,10,10);
  96. ['Primary Text'] = fromrgb(235,235,235);
  97. ['Group Background'] = fromrgb(35,35,35);
  98. ['Selected Tab Background'] = fromrgb(35,35,35);
  99. ['Unselected Tab Background'] = fromrgb(18,18,18);
  100. ['Selected Tab Text'] = fromrgb(245,245,245);
  101. ['Unselected Tab Text'] = fromrgb(145,145,145);
  102. ['Section Background'] = fromrgb(18,18,18);
  103. ['Option Text 1'] = fromrgb(245,245,245);
  104. ['Option Text 2'] = fromrgb(195,195,195);
  105. ['Option Text 3'] = fromrgb(145,145,145);
  106. ['Option Border 1'] = fromrgb(50,50,50);
  107. ['Option Border 2'] = fromrgb(0,0,0);
  108. ['Option Background'] = fromrgb(35,35,35);
  109. ["Risky Text"] = fromrgb(175, 21, 21);
  110. ["Risky Text Enabled"] = fromrgb(255, 41, 41);
  111. }
  112. },
  113. {
  114. name = 'Tokyo Night',
  115. theme = {
  116. ['Accent'] = fromrgb(103,89,179);
  117. ['Background'] = fromrgb(22,22,31);
  118. ['Border'] = fromrgb(0,0,0);
  119. ['Border 1'] = fromrgb(50,50,50);
  120. ['Border 2'] = fromrgb(24,25,37);
  121. ['Border 3'] = fromrgb(10,10,10);
  122. ['Primary Text'] = fromrgb(235,235,235);
  123. ['Group Background'] = fromrgb(24,25,37);
  124. ['Selected Tab Background'] = fromrgb(24,25,37);
  125. ['Unselected Tab Background'] = fromrgb(22,22,31);
  126. ['Selected Tab Text'] = fromrgb(245,245,245);
  127. ['Unselected Tab Text'] = fromrgb(145,145,145);
  128. ['Section Background'] = fromrgb(22,22,31);
  129. ['Option Text 1'] = fromrgb(245,245,245);
  130. ['Option Text 2'] = fromrgb(195,195,195);
  131. ['Option Text 3'] = fromrgb(145,145,145);
  132. ['Option Border 1'] = fromrgb(50,50,50);
  133. ['Option Border 2'] = fromrgb(0,0,0);
  134. ['Option Background'] = fromrgb(24,25,37);
  135. ["Risky Text"] = fromrgb(175, 21, 21);
  136. ["Risky Text Enabled"] = fromrgb(255, 41, 41);
  137. }
  138. },
  139. {
  140. name = 'Nekocheat',
  141. theme = {
  142. ["Accent"] = fromrgb(226, 30, 112);
  143. ["Background"] = fromrgb(18,18,18);
  144. ["Border"] = fromrgb(0,0,0);
  145. ["Border 1"] = fromrgb(60,60,60);
  146. ["Border 2"] = fromrgb(18,18,18);
  147. ["Border 3"] = fromrgb(10,10,10);
  148. ["Primary Text"] = fromrgb(255,255,255);
  149. ["Group Background"] = fromrgb(18,18,18);
  150. ["Selected Tab Background"] = fromrgb(18,18,18);
  151. ["Unselected Tab Background"] = fromrgb(18,18,18);
  152. ["Selected Tab Text"] = fromrgb(245,245,245);
  153. ["Unselected Tab Text"] = fromrgb(145,145,145);
  154. ["Section Background"] = fromrgb(18,18,18);
  155. ["Option Text 1"] = fromrgb(255,255,255);
  156. ["Option Text 2"] = fromrgb(255,255,255);
  157. ["Option Text 3"] = fromrgb(255,255,255);
  158. ["Option Border 1"] = fromrgb(50,50,50);
  159. ["Option Border 2"] = fromrgb(0,0,0);
  160. ["Option Background"] = fromrgb(23,23,23);
  161. ["Risky Text"] = fromrgb(175, 21, 21);
  162. ["Risky Text Enabled"] = fromrgb(255, 41, 41);
  163. }
  164. },
  165. {
  166. name = 'Nekocheat Blue',
  167. theme = {
  168. ["Accent"] = fromrgb(0, 247, 255);
  169. ["Background"] = fromrgb(18,18,18);
  170. ["Border"] = fromrgb(0,0,0);
  171. ["Border 1"] = fromrgb(60,60,60);
  172. ["Border 2"] = fromrgb(18,18,18);
  173. ["Border 3"] = fromrgb(10,10,10);
  174. ["Primary Text"] = fromrgb(255,255,255);
  175. ["Group Background"] = fromrgb(18,18,18);
  176. ["Selected Tab Background"] = fromrgb(18,18,18);
  177. ["Unselected Tab Background"] = fromrgb(18,18,18);
  178. ["Selected Tab Text"] = fromrgb(245,245,245);
  179. ["Unselected Tab Text"] = fromrgb(145,145,145);
  180. ["Section Background"] = fromrgb(18,18,18);
  181. ["Option Text 1"] = fromrgb(255,255,255);
  182. ["Option Text 2"] = fromrgb(255,255,255);
  183. ["Option Text 3"] = fromrgb(255,255,255);
  184. ["Option Border 1"] = fromrgb(50,50,50);
  185. ["Option Border 2"] = fromrgb(0,0,0);
  186. ["Option Background"] = fromrgb(23,23,23);
  187. ["Risky Text"] = fromrgb(175, 21, 21);
  188. ["Risky Text Enabled"] = fromrgb(255, 41, 41);
  189. }
  190. },
  191. {
  192. name = 'Fatality',
  193. theme = {
  194. ['Accent'] = fromrgb(197,7,83);
  195. ['Background'] = fromrgb(25,19,53);
  196. ['Border'] = fromrgb(0,0,0);
  197. ['Border 1'] = fromrgb(60,53,93);
  198. ['Border 2'] = fromrgb(29,23,66);
  199. ['Border 3'] = fromrgb(10,10,10);
  200. ['Primary Text'] = fromrgb(235,235,235);
  201. ['Group Background'] = fromrgb(29,23,66);
  202. ['Selected Tab Background'] = fromrgb(29,23,66);
  203. ['Unselected Tab Background'] = fromrgb(25,19,53);
  204. ['Selected Tab Text'] = fromrgb(245,245,245);
  205. ['Unselected Tab Text'] = fromrgb(145,145,145);
  206. ['Section Background'] = fromrgb(25,19,53);
  207. ['Option Text 1'] = fromrgb(245,245,245);
  208. ['Option Text 2'] = fromrgb(195,195,195);
  209. ['Option Text 3'] = fromrgb(145,145,145);
  210. ['Option Border 1'] = fromrgb(60,53,93);
  211. ['Option Border 2'] = fromrgb(0,0,0);
  212. ['Option Background'] = fromrgb(29,23,66);
  213. ["Risky Text"] = fromrgb(175, 21, 21);
  214. ["Risky Text Enabled"] = fromrgb(255, 41, 41);
  215. }
  216. },
  217. {
  218. name = 'Gamesense',
  219. theme = {
  220. ['Accent'] = fromrgb(147,184,26);
  221. ['Background'] = fromrgb(17,17,17);
  222. ['Border'] = fromrgb(0,0,0);
  223. ['Border 1'] = fromrgb(47,47,47);
  224. ['Border 2'] = fromrgb(17,17,17);
  225. ['Border 3'] = fromrgb(10,10,10);
  226. ['Primary Text'] = fromrgb(235,235,235);
  227. ['Group Background'] = fromrgb(17,17,17);
  228. ['Selected Tab Background'] = fromrgb(17,17,17);
  229. ['Unselected Tab Background'] = fromrgb(17,17,17);
  230. ['Selected Tab Text'] = fromrgb(245,245,245);
  231. ['Unselected Tab Text'] = fromrgb(145,145,145);
  232. ['Section Background'] = fromrgb(17,17,17);
  233. ['Option Text 1'] = fromrgb(245,245,245);
  234. ['Option Text 2'] = fromrgb(195,195,195);
  235. ['Option Text 3'] = fromrgb(145,145,145);
  236. ['Option Border 1'] = fromrgb(47,47,47);
  237. ['Option Border 2'] = fromrgb(0,0,0);
  238. ['Option Background'] = fromrgb(35,35,35);
  239. ["Risky Text"] = fromrgb(175, 21, 21);
  240. ["Risky Text Enabled"] = fromrgb(255, 41, 41);
  241. }
  242. },
  243. {
  244. name = 'Twitch',
  245. theme = {
  246. ['Accent'] = fromrgb(169,112,255);
  247. ['Background'] = fromrgb(14,14,14);
  248. ['Border'] = fromrgb(0,0,0);
  249. ['Border 1'] = fromrgb(45,45,45);
  250. ['Border 2'] = fromrgb(31,31,35);
  251. ['Border 3'] = fromrgb(10,10,10);
  252. ['Primary Text'] = fromrgb(235,235,235);
  253. ['Group Background'] = fromrgb(31,31,35);
  254. ['Selected Tab Background'] = fromrgb(31,31,35);
  255. ['Unselected Tab Background'] = fromrgb(17,17,17);
  256. ['Selected Tab Text'] = fromrgb(225,225,225);
  257. ['Unselected Tab Text'] = fromrgb(160,170,175);
  258. ['Section Background'] = fromrgb(17,17,17);
  259. ['Option Text 1'] = fromrgb(245,245,245);
  260. ['Option Text 2'] = fromrgb(195,195,195);
  261. ['Option Text 3'] = fromrgb(145,145,145);
  262. ['Option Border 1'] = fromrgb(45,45,45);
  263. ['Option Border 2'] = fromrgb(0,0,0);
  264. ['Option Background'] = fromrgb(24,24,27);
  265. ["Risky Text"] = fromrgb(175, 21, 21);
  266. ["Risky Text Enabled"] = fromrgb(255, 41, 41);
  267. }
  268. }
  269. }
  270.  
  271. local blacklistedKeys = {
  272. Enum.KeyCode.Unknown,
  273. Enum.KeyCode.W,
  274. Enum.KeyCode.A,
  275. Enum.KeyCode.S,
  276. Enum.KeyCode.D,
  277. Enum.KeyCode.Slash,
  278. Enum.KeyCode.Tab,
  279. Enum.KeyCode.Escape
  280. }
  281.  
  282. local whitelistedBoxKeys = {
  283. Enum.KeyCode.Zero,
  284. Enum.KeyCode.One,
  285. Enum.KeyCode.Two,
  286. Enum.KeyCode.Three,
  287. Enum.KeyCode.Four,
  288. Enum.KeyCode.Five,
  289. Enum.KeyCode.Six,
  290. Enum.KeyCode.Seven,
  291. Enum.KeyCode.Eight,
  292. Enum.KeyCode.Nine
  293. }
  294.  
  295. local keyNames = {
  296. [Enum.KeyCode.LeftControl] = 'LCTRL';
  297. [Enum.KeyCode.RightControl] = 'RCTRL';
  298. [Enum.KeyCode.LeftShift] = 'LSHIFT';
  299. [Enum.KeyCode.RightShift] = 'RSHIFT';
  300. [Enum.UserInputType.MouseButton1] = 'MB1';
  301. [Enum.UserInputType.MouseButton2] = 'MB2';
  302. [Enum.UserInputType.MouseButton3] = 'MB3';
  303. }
  304.  
  305. library.button1down = library.signal.new()
  306. library.button1up = library.signal.new()
  307. library.mousemove = library.signal.new()
  308. library.unloaded = library.signal.new();
  309.  
  310. local button1down, button1up, mousemove = library.button1down, library.button1up, library.mousemove
  311. local mb1down = false;
  312.  
  313. local utility = library.utility
  314. do
  315.  
  316. function utility:Connection(signal, func)
  317. local c = signal:Connect(func)
  318. table.insert(library.connections, c)
  319. return c
  320. end
  321.  
  322. function utility:Instance(class, properties)
  323. local inst = newInstance(class)
  324. for prop, val in next, properties or {} do
  325. local s,e = pcall(function()
  326. inst[prop] = val
  327. end)
  328. if not s then
  329. printconsole(e, 255,0,0)
  330. end
  331. end
  332. return inst
  333. end
  334.  
  335. function utility:HasProperty(obj, prop)
  336. return ({(pcall(function() local a = obj[prop] end))})[1]
  337. end
  338.  
  339. function utility:ToRGB(c3)
  340. return c3.R*255,c3.G*255,c3.B*255
  341. end
  342.  
  343. function utility:AddRGB(a,b)
  344. local r1,g1,b1 = self:ToRGB(a);
  345. local r2,g2,b2 = self:ToRGB(b);
  346. return fromrgb(clamp(r1+r2,0,255),clamp(g1+g2,0,255),clamp(b1+b2,0,255))
  347. end
  348.  
  349. function utility:ConvertNumberRange(val,oldmin,oldmax,newmin,newmax)
  350. return (((val - oldmin) * (newmax - newmin)) / (oldmax - oldmin)) + newmin
  351. end
  352.  
  353. function utility:UDim2ToVector2(udim2, vector2)
  354. local x,y
  355. x = udim2.X.Offset + self:ConvertNumberRange(udim2.X.Scale,0,1,0,vector2.X)
  356. y = udim2.Y.Offset + self:ConvertNumberRange(udim2.Y.Scale,0,1,0,vector2.Y)
  357. return newVector2(x,y)
  358. end
  359.  
  360. function utility:Lerp(a,b,c)
  361. return a + (b-a) * c
  362. end
  363.  
  364. function utility:Tween(obj, prop, val, time, direction, style)
  365. if self:HasProperty(obj, prop) then
  366. if library.tweens[obj] then
  367. if library.tweens[obj][prop] then
  368. library.tweens[obj][prop]:Cancel()
  369. end
  370. end
  371.  
  372. local startVal = obj[prop];
  373. local a = 0;
  374. local tween = {
  375. Completed = library.signal.new();
  376. };
  377.  
  378. library.tweens[obj] = library.tweens[obj] or {};
  379. library.tweens[obj][prop] = tween;
  380.  
  381. tween.Connection = self:Connection(runservice.RenderStepped, function(dt)
  382. a = a + (dt / time);
  383. if a >= 1 or obj == nil then
  384. tween:Cancel();
  385. end
  386. pcall(function()
  387. local progress = tweenService:GetValue(a, style or Enum.EasingStyle.Linear, direction or Enum.EasingDirection.In)
  388. local newVal
  389. if typeof(startVal) == 'number' then
  390. newVal = utility:Lerp(startVal, val, progress);
  391. else
  392. newVal = startVal:Lerp(val, progress);
  393. end
  394. obj[prop] = newVal;
  395. end)
  396. end)
  397.  
  398. function tween:Cancel()
  399. tween.Connection:Disconnect();
  400. tween.Completed:Fire();
  401. table.clear(tween);
  402. library.tweens[obj][prop] = nil;
  403. end
  404.  
  405. return tween;
  406. else
  407. printconsole('unable to tween: invalid property '..tostring(prop)..' for object '..tostring(obj), 255,0,0)
  408. end
  409. end
  410.  
  411. function utility:DetectTableChange(indexcallback,newindexcallback)
  412. if indexcallback == nil then
  413. warn('DetectTableChange: Argument #1 (indexcallback) is nil, function may not work as expected.')
  414. elseif newindexcallback == nil then
  415. warn('DetectTableChange: Argument #2 (newindexcallback) is nil, function may not work as expected.')
  416. end
  417. local proxy = newproxy(true);
  418. local mt = getmetatable(proxy);
  419. mt.__index = indexcallback
  420. mt.__newindex = newindexcallback
  421. return proxy
  422. end
  423.  
  424. function utility:MouseOver(obj)
  425. local mousePos = inputservice:GetMouseLocation();
  426. local x1 = obj.Position.X
  427. local y1 = obj.Position.Y
  428. local x2 = x1 + obj.Size.X
  429. local y2 = y1 + obj.Size.Y
  430. return (mousePos.X >= x1 and mousePos.Y >= y1 and mousePos.X <= x2 and mousePos.Y <= y2)
  431. end
  432.  
  433. function utility:GetHoverObject()
  434. local objects = {}
  435. for i,v in next, library.drawings do
  436. if v.Object.Visible and v.Class == 'Square' and self:MouseOver(v.Object) then
  437. table.insert(objects,v.Object)
  438. end
  439. end
  440. table.sort(objects,function(a,b)
  441. return a.ZIndex > b.ZIndex
  442. end)
  443. return objects[1]
  444. end
  445.  
  446. function utility:Draw(class, properties)
  447. local blacklistedProperties = {'Object','Children','Class'}
  448. local drawing = {
  449. Object = Drawing.new(class);
  450. Children = {};
  451. ThemeColor = '';
  452. OutlineThemeColor = '';
  453. ThemeColorOffset = 0;
  454. OutlineThemeColorOffset = 0;
  455. Parent = nil;
  456. Size = newUDim2(0,0,0,0);
  457. Position = newUDim2(0,0,0,0);
  458. AbsoluteSize = newVector2(0,0);
  459. AbsolutePosition = newVector2(0,0);
  460. Hover = false;
  461. Visible = true;
  462. MouseButton1Down = library.signal.new();
  463. MouseButton2Down = library.signal.new();
  464. MouseButton1Up = library.signal.new();
  465. MouseButton2Up = library.signal.new();
  466. MouseEnter = library.signal.new();
  467. MouseLeave = library.signal.new();
  468. Class = class;
  469. }
  470.  
  471. function drawing:Update()
  472. -- if drawing.Parent then
  473. local parent = drawing.Parent ~= nil and library.drawings[drawing.Parent.Object] or nil
  474. local parentSize,parentPos,parentVis = workspace.CurrentCamera.ViewportSize, Vector2.new(0,0), true;
  475. if parent ~= nil then
  476. parentSize = (parent.Class == 'Square' or parent.Class == 'Image') and parent.Object.Size or parent.Class == 'Text' and parent.TextBounds or workspace.CurrentCamera.ViewportSize
  477. parentPos = parent.Object.Position
  478. parentVis = parent.Object.Visible
  479. end
  480.  
  481. if drawing.Class == 'Square' or drawing.Class == 'Image' then
  482. drawing.Object.Size = typeof(drawing.Size) == 'Vector2' and drawing.Size or typeof(drawing.Size) == 'UDim2' and utility:UDim2ToVector2(drawing.Size,parentSize)
  483. end
  484.  
  485. if drawing.Class == 'Square' or drawing.Class == 'Image' or drawing.Class == 'Circle' or drawing.Class == 'Text' then
  486. drawing.Object.Position = parentPos + (typeof(drawing.Position) == 'Vector2' and drawing.Position or utility:UDim2ToVector2(drawing.Position,parentSize))
  487. end
  488.  
  489. drawing.Object.Visible = (parentVis and drawing.Visible) and true or false
  490.  
  491. -- end
  492. drawing:UpdateChildren()
  493. end
  494.  
  495. function drawing:UpdateChildren()
  496. for i,v in next, drawing.Children do
  497. v:Update()
  498. end
  499. end
  500.  
  501. function drawing:GetDescendants()
  502. local descendants = {};
  503. local function a(t)
  504. for _,v in next, t.Children do
  505. table.insert(descendants, v);
  506. a(v)
  507. end
  508. end
  509. a(self)
  510. return descendants;
  511. end
  512.  
  513. library.drawings[drawing.Object] = drawing
  514.  
  515. -- this is really stupid lol
  516. local proxy = utility:DetectTableChange(
  517. function(obj,i)
  518. return drawing[i] == nil and drawing.Object[i] or drawing[i]
  519. end,
  520. function(obj,i,v)
  521. if not table.find(blacklistedProperties,i) then
  522.  
  523. local lastval = drawing[i]
  524.  
  525. if i == 'Size' and (class == 'Square' or class == 'Image') then
  526. drawing.Object.Size = utility:UDim2ToVector2(v,drawing.Parent == nil and workspace.CurrentCamera.ViewportSize or drawing.Parent.Object.Size);
  527. drawing.AbsoluteSize = drawing.Object.Size;
  528. elseif i == 'Position' and (class == 'Square' or class == 'Image' or class == 'Text') then
  529. drawing.Object.Position = utility:UDim2ToVector2(v,drawing.Parent == nil and newVector2(0,0) or drawing.Parent.Object.Position);
  530. drawing.AbsolutePosition = drawing.Object.Position;
  531. elseif i == 'Parent' then
  532. if drawing.Parent ~= nil then
  533. drawing.Parent.Children[drawing] = nil
  534. end
  535. if v ~= nil then
  536. table.insert(v.Children,drawing)
  537. end
  538. elseif i == 'Visible' then
  539. drawing.Visible = v
  540. elseif i == 'Font' and v == 2 and executor == 'ScriptWare' then
  541. v = 1
  542. end
  543.  
  544. pcall(function()
  545. drawing.Object[i] = v
  546. end)
  547. if drawing[i] ~= nil or i == 'Parent' then
  548. drawing[i] = v
  549. end
  550.  
  551. if table.find({'Size','Position','Position','Visible','Parent'},i) then
  552. drawing:Update()
  553. end
  554. if table.find({'ThemeColor','OutlineThemeColor','ThemeColorOffset','OutlineThemeColorOffset'},i) and lastval ~= v then
  555. library.UpdateThemeColors()
  556. end
  557.  
  558. end
  559. end)
  560.  
  561. function drawing:Remove()
  562. for i,v in next, self.Children do
  563. v:Remove();
  564. end
  565.  
  566. if drawing.Parent then
  567. drawing.Parent.Children[drawing.Object] = nil;
  568. end
  569.  
  570. library.drawings[drawing.Object] = nil;
  571. drawing.Object:Remove();
  572. table.clear(drawing);
  573.  
  574. end
  575.  
  576. properties = typeof(properties) == 'table' and properties or {}
  577.  
  578. if class == 'Square' and properties.Filled == nil then
  579. properties.Filled = true;
  580. end
  581.  
  582. if properties.Visible == nil then
  583. properties.Visible = true;
  584. end
  585.  
  586. for i,v in next, properties do
  587. proxy[i] = v
  588. end
  589.  
  590. drawing:Update()
  591. return proxy
  592. end
  593. end
  594.  
  595. library.utility = utility
  596.  
  597. function library:Unload()
  598. library.unloaded:Fire();
  599. for _,c in next, self.connections do
  600. c:Disconnect()
  601. end
  602. for obj in next, self.drawings do
  603. obj:Remove()
  604. end
  605. table.clear(self.drawings)
  606. getgenv().library = nil
  607. end
  608.  
  609. function library:init()
  610. if self.hasInit then
  611. return
  612. end
  613.  
  614. local tooltipObjects = {};
  615.  
  616. makefolder(self.cheatname)
  617. makefolder(self.cheatname..'/assets')
  618. makefolder(self.cheatname..'/'..self.gamename)
  619. makefolder(self.cheatname..'/'..self.gamename..'/configs');
  620.  
  621. function self:SetTheme(theme)
  622. for i,v in next, theme do
  623. self.theme[i] = v;
  624. end
  625. self.UpdateThemeColors();
  626. end
  627.  
  628. function self:GetConfig(name)
  629. if isfile(self.cheatname..'/'..self.gamename..'/configs/'..name..self.fileext) then
  630. return readfile(self.cheatname..'/'..self.gamename..'/configs/'..name..self.fileext);
  631. end
  632. end
  633.  
  634. function self:LoadConfig(name)
  635. local cfg = self:GetConfig(name)
  636. if not cfg then
  637. self:SendNotification('Error loading config: Config does not exist. ('..tostring(name)..')', 5, c3new(1,0,0));
  638. return
  639. end
  640.  
  641. local s,e = pcall(function()
  642. setByConfig = true
  643. for flag,value in next, http:JSONDecode(cfg) do
  644. local option = library.options[flag]
  645. if option ~= nil then
  646. if option.class == 'toggle' then
  647. option:SetState(value == nil and false or (value == 1 and true or false));
  648. elseif option.class == 'slider' then
  649. option:SetValue(value == nil and 0 or value)
  650. elseif option.class == 'bind' then
  651. option:SetBind(value == nil and 'none' or (utility:HasProperty(Enum.KeyCode, value) and Enum.KeyCode[value] or Enum.UserInputType[value]));
  652. elseif option.class == 'color' then
  653. option:SetColor(value == nil and c3new(1,1,1) or c3new(value[1], value[2], value[3]));
  654. option:SetTrans(value == nil and 1 or value[4]);
  655. elseif option.class == 'list' then
  656. option:Select(value == nil and '' or value);
  657. elseif option.class == 'box' then
  658. option:SetInput(value == nil and '' or value)
  659. end
  660. end
  661. end
  662. setByConfig = false
  663. end)
  664.  
  665. if s then
  666. self:SendNotification('Successfully loaded config: '..name, 5, c3new(0,1,0));
  667. else
  668. self:SendNotification('Error loading config: '..tostring(e)..'. ('..tostring(name)..')', 5, c3new(1,0,0));
  669. end
  670. end
  671.  
  672. function self:SaveConfig(name)
  673. if not self:GetConfig(name) then
  674. self:SendNotification('Error saving config: Config does not exist. ('..tostring(name)..')', 5, c3new(1,0,0));
  675. return
  676. end
  677.  
  678. local s,e = pcall(function()
  679. local cfg = {};
  680. for flag,option in next, self.options do
  681. if option.class == 'toggle' then
  682. cfg[flag] = option.state and 1 or 0;
  683. elseif option.class == 'slider' then
  684. cfg[flag] = option.value;
  685. elseif option.class == 'bind' then
  686. cfg[flag] = option.bind.Name;
  687. elseif option.class == 'color' then
  688. cfg[flag] = {
  689. option.color.r,
  690. option.color.g,
  691. option.color.b,
  692. option.trans,
  693. }
  694. elseif option.class == 'list' then
  695. cfg[flag] = option.selected;
  696. elseif option.class == 'box' then
  697. cfg[flag] = option.input
  698. end
  699. end
  700. writefile(self.cheatname..'/'..self.gamename..'/configs/'..name..self.fileext, http:JSONEncode(cfg));
  701. end)
  702.  
  703. if s then
  704. self:SendNotification('Successfully saved config: '..name, 5, c3new(0,1,0));
  705. else
  706. self:SendNotification('Error saving config: '..tostring(e)..'. ('..tostring(name)..')', 5, c3new(1,0,0));
  707. end
  708. end
  709.  
  710. for i,v in next, self.images do
  711. if not isfile(self.cheatname..'/assets/'..i..'.oh') then
  712. writefile(self.cheatname..'/assets/'..i..'.oh', game:HttpGet(v))
  713. end
  714. self.images[i] = readfile(self.cheatname..'/assets/'..i..'.oh');
  715. end
  716.  
  717. self.cursor1 = utility:Draw('Triangle', {Filled = true, Color = fromrgb(255,255,255), ZIndex = self.zindexOrder.cursor});
  718. self.cursor2 = utility:Draw('Triangle', {Filled = true, Color = fromrgb(85,85,85), self.zindexOrder.cursor-1});
  719. local function updateCursor()
  720. self.cursor1.Visible = self.open
  721. self.cursor2.Visible = self.open
  722. if self.cursor1.Visible then
  723. local pos = inputservice:GetMouseLocation();
  724. self.cursor1.PointA = pos;
  725. self.cursor1.PointB = pos + newVector2(16,5);
  726. self.cursor1.PointC = pos + newVector2(5,16);
  727. self.cursor2.PointA = self.cursor1.PointA + newVector2(0, 0)
  728. self.cursor2.PointB = self.cursor1.PointB + newVector2(1, 1)
  729. self.cursor2.PointC = self.cursor1.PointC + newVector2(1, 1)
  730. end
  731. end
  732.  
  733. local screenGui = Instance.new('ScreenGui');
  734. if syn then syn.protect_gui(screenGui); end
  735. screenGui.Parent = game:GetService('CoreGui');
  736. screenGui.Enabled = true;
  737. utility:Instance('ImageButton', {
  738. Parent = screenGui,
  739. Visible = true,
  740. Modal = true,
  741. Size = UDim2.new(1,0,1,0),
  742. ZIndex = 9999999999,
  743. Transparency = 1;
  744. })
  745.  
  746. utility:Connection(library.unloaded, function()
  747. screenGui:Destroy()
  748. end)
  749.  
  750. utility:Connection(inputservice.InputBegan, function(input, gpe)
  751. if self.hasInit then
  752. if input.KeyCode == self.toggleKey and not library.opening and not gpe then
  753. self:SetOpen(not self.open)
  754. task.spawn(function()
  755. library.opening = true;
  756. task.wait(.15);
  757. library.opening = false;
  758. end)
  759. end
  760. if library.open then
  761. local hoverObj = utility:GetHoverObject();
  762. local hoverObjData = library.drawings[hoverObj];
  763. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  764. mb1down = true;
  765. button1down:Fire()
  766. if hoverObj and hoverObjData then
  767. hoverObjData.MouseButton1Down:Fire(inputservice:GetMouseLocation())
  768. end
  769.  
  770. -- // Update Sliders Click
  771. if library.draggingSlider ~= nil then
  772. local rel = inputservice:GetMouseLocation() - library.draggingSlider.objects.background.Object.Position;
  773. local val = utility:ConvertNumberRange(rel.X, 0 , library.draggingSlider.objects.background.Object.Size.X, library.draggingSlider.min, library.draggingSlider.max);
  774. library.draggingSlider:SetValue(val)
  775. end
  776.  
  777. elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
  778. if hoverObj and hoverObjData then
  779. hoverObjData.MouseButton2Down:Fire(inputservice:GetMouseLocation())
  780. end
  781. end
  782. end
  783. end
  784. end)
  785.  
  786. utility:Connection(inputservice.InputEnded, function(input, gpe)
  787. if self.hasInit and library.open then
  788. local hoverObj = utility:GetHoverObject();
  789. local hoverObjData = library.drawings[hoverObj];
  790.  
  791. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  792. mb1down = false;
  793. button1up:Fire();
  794. if hoverObj and hoverObjData then
  795. hoverObjData.MouseButton1Up:Fire(inputservice:GetMouseLocation())
  796. end
  797. elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
  798. if hoverObj and hoverObjData then
  799. hoverObjData.MouseButton2Up:Fire(inputservice:GetMouseLocation())
  800. end
  801. end
  802. end
  803. end)
  804.  
  805. utility:Connection(inputservice.InputChanged, function(input, gpe)
  806. if input.UserInputType == Enum.UserInputType.MouseMovement then
  807. if library.open then
  808. mousemove:Fire(inputservice:GetMouseLocation());
  809. updateCursor();
  810.  
  811. if library.CurrentTooltip ~= nil then
  812. local mousePos = inputservice:GetMouseLocation()
  813. tooltipObjects.background.Position = UDim2.new(0,mousePos.X + 15,0,mousePos.Y + 15)
  814. tooltipObjects.background.Size = UDim2.new(0,tooltipObjects.text.TextBounds.X + 6 + (library.CurrentTooltip.risky and 60 or 0),0,tooltipObjects.text.TextBounds.Y + 2)
  815. end
  816.  
  817. local hoverObj = utility:GetHoverObject();
  818. for _,v in next, library.drawings do
  819. local hover = hoverObj == v.Object;
  820. if hover and not v.Hover then
  821. v.Hover = true;
  822. v.MouseEnter:Fire(inputservice:GetMouseLocation());
  823. elseif not hover and v.Hover then
  824. v.Hover = false;
  825. v.MouseLeave:Fire(inputservice:GetMouseLocation());
  826. end
  827. end
  828.  
  829. if mb1down then
  830.  
  831. -- // Update Sliders Drag
  832. if library.draggingSlider ~= nil then
  833. local rel = inputservice:GetMouseLocation() - library.draggingSlider.objects.background.Object.Position;
  834. local val = utility:ConvertNumberRange(rel.X, 0 , library.draggingSlider.objects.background.Object.Size.X, library.draggingSlider.min, library.draggingSlider.max);
  835. library.draggingSlider:SetValue(val)
  836. end
  837.  
  838. end
  839. end
  840. end
  841. end)
  842.  
  843. function self:SetOpen(bool)
  844. self.open = bool;
  845. screenGui.Enabled = bool;
  846.  
  847. if bool and library.flags.disablemenumovement then
  848. actionservice:BindAction(
  849. 'FreezeMovement',
  850. function()
  851. return Enum.ContextActionResult.Sink
  852. end,
  853. false,
  854. unpack(Enum.PlayerActions:GetEnumItems())
  855. )
  856. else
  857. actionservice:UnbindAction('FreezeMovement');
  858. end
  859.  
  860. updateCursor();
  861. for _,window in next, self.windows do
  862. window:SetOpen(bool);
  863. end
  864.  
  865. library.CurrentTooltip = nil;
  866. tooltipObjects.background.Visible = false
  867. end
  868.  
  869. function self.UpdateThemeColors()
  870. for _,v in next, library.drawings do
  871. if v.ThemeColor and library.theme[v.ThemeColor] then
  872. v.Object.Color = utility:AddRGB(library.theme[v.ThemeColor],fromrgb(v.ThemeColorOffset,v.ThemeColorOffset,v.ThemeColorOffset))
  873. end
  874. if v.ThemeColorOutline and library.theme[v.ThemeColorOutline] then
  875. v.Object.OutlineColor = utility:AddRGB(library.theme[v.ThemeColorOutline],fromrgb(v.OutlineThemeColorOffset,v.OutlineThemeColorOffset,v.OutlineThemeColorOffset))
  876. end
  877. end
  878. end
  879.  
  880. function self:SendNotification(message, time, color)
  881. time = time or 5
  882. if typeof(message) ~= 'string' then
  883. return error(string.format('invalid message type, got %s, expected string', typeof(message)))
  884. elseif typeof(time) ~= 'number' then
  885. return error(string.format('invalid time type, got %s, expected number', typeof(time)))
  886. elseif color ~= nil and typeof(color) ~= 'Color3' then
  887. return error(string.format('invalid color type, got %s, expected color3', typeof(time)))
  888. end
  889.  
  890. local notification = {};
  891.  
  892. self.notifications[notification] = true
  893.  
  894. do
  895. local objs = notification;
  896. local z = self.zindexOrder.notification;
  897.  
  898. notification.holder = utility:Draw('Square', {
  899. Position = newUDim2(0, 0, 0, 75);
  900. Transparency = 0;
  901. })
  902.  
  903. notification.background = utility:Draw('Square', {
  904. Size = newUDim2(1,0,1,0);
  905. Position = newUDim2(0, -500, 0, 0);
  906. Parent = notification.holder;
  907. ThemeColor = 'Background';
  908. ZIndex = z;
  909. })
  910.  
  911. notification.border1 = utility:Draw('Square', {
  912. Size = newUDim2(1,2,1,2);
  913. Position = newUDim2(0,-1,0,-1);
  914. ThemeColor = 'Border 2';
  915. Parent = notification.background;
  916. ZIndex = z-1;
  917. })
  918.  
  919. objs.border2 = utility:Draw('Square', {
  920. Size = newUDim2(1,2,1,2);
  921. Position = newUDim2(0,-1,0,-1);
  922. ThemeColor = 'Border 3';
  923. Parent = objs.border1;
  924. ZIndex = z-2;
  925. })
  926.  
  927. notification.gradient = utility:Draw('Image', {
  928. Size = newUDim2(1,0,1,0);
  929. Data = self.images.gradientp90;
  930. Parent = notification.background;
  931. Transparency = .5;
  932. ZIndex = z+1;
  933. })
  934.  
  935. notification.accentBar = utility:Draw('Square',{
  936. Size = newUDim2(0,5,1,4);
  937. Position = newUDim2(0,0,0,-2);
  938. Parent = notification.background;
  939. ThemeColor = color == nil and 'Accent' or '';
  940. ZIndex = z+5;
  941. })
  942.  
  943. notification.text = utility:Draw('Text', {
  944. Position = newUDim2(0,13,0,2);
  945. ThemeColor = 'Primary Text';
  946. Text = message;
  947. Outline = true;
  948. Font = 2;
  949. Size = 13;
  950. ZIndex = z+4;
  951. Parent = notification.background;
  952. })
  953.  
  954. if color then
  955. notification.accentBar.Color = color;
  956. end
  957.  
  958. end
  959.  
  960. function notification:Remove()
  961. library.notifications[notification] = nil;
  962. self.holder:Remove();
  963. library:UpdateNotifications()
  964. end
  965.  
  966. task.spawn(function()
  967. self:UpdateNotifications();
  968. notification.background.Size = newUDim2(0, notification.text.TextBounds.X + 20, 0, 19)
  969. task.wait();
  970. utility:Tween(notification.background, 'Position', newUDim2(0,0,0, 0), .1);
  971. task.wait(time);
  972. for i,v in next, notification do
  973. if typeof(v) ~= 'function' then
  974. utility:Tween(v, 'Transparency', 0, .15);
  975. end
  976. end
  977. utility:Connection(utility:Tween(notification.background, 'Position', newUDim2(0,-500,0, 0), .25).Completed, (function()
  978. notification:Remove();
  979. end))
  980. end)
  981.  
  982. end
  983.  
  984. function self:UpdateNotifications()
  985. local i = 0
  986. for v in next, self.notifications do
  987. utility:Tween(v.holder, 'Position', newUDim2(0,0,0, 75 + (i * 30)), .15)
  988. i += 1
  989. end
  990. end
  991.  
  992. function self.NewIndicator(data)
  993. local indicator = {
  994. title = data.title or 'indicator',
  995. enabled = data.enabled or false,
  996. position = data.position or newUDim2(0,15,0,300),
  997. values = {},
  998. objects = {valueObjects = {}},
  999. spacing = ' ',
  1000. };
  1001.  
  1002. table.insert(self.indicators, indicator)
  1003.  
  1004. -- Create Objects --
  1005. do
  1006. local z = self.zindexOrder.indicator;
  1007. local objs = indicator.objects;
  1008.  
  1009. objs.background = utility:Draw('Square', {
  1010. Size = newUDim2(0, 200, 0, 16);
  1011. Position = indicator.position;
  1012. ThemeColor = 'Background';
  1013. ZIndex = z;
  1014. })
  1015.  
  1016. objs.border1 = utility:Draw('Square', {
  1017. Size = newUDim2(1,2,1,2);
  1018. Position = newUDim2(0,-1,0,-1);
  1019. ThemeColor = 'Border 2';
  1020. Parent = objs.background;
  1021. ZIndex = z-1;
  1022. })
  1023.  
  1024. objs.border2 = utility:Draw('Square', {
  1025. Size = newUDim2(1,2,1,2);
  1026. Position = newUDim2(0,-1,0,-1);
  1027. ThemeColor = 'Border 3';
  1028. Parent = objs.border1;
  1029. ZIndex = z-2;
  1030. })
  1031.  
  1032. objs.topborder = utility:Draw('Square', {
  1033. Size = newUDim2(1,0,0,1);
  1034. ThemeColor = 'Accent';
  1035. Parent = objs.background;
  1036. ZIndex = z+1;
  1037. })
  1038.  
  1039. objs.textlabel = utility:Draw('Text', {
  1040. Position = newUDim2(.5,0,0,1);
  1041. ThemeColor = 'Primary Text';
  1042. Text = indicator.title;
  1043. Size = 13;
  1044. Font = 2;
  1045. ZIndex = z+2;
  1046. Center = true;
  1047. Outline = true;
  1048. Parent = objs.background;
  1049. });
  1050.  
  1051. end
  1052. --------------------
  1053.  
  1054. function indicator:Update()
  1055. local xSize = 125
  1056. local yPos = 0
  1057. table.sort(self.values, function(a,b)
  1058. return a.order < b.order;
  1059. end)
  1060.  
  1061. for _,v in next, self.values do
  1062. v.objects.keyLabel.Text = tostring(v.key);
  1063. v.objects.valueLabel.Text = tostring(v.value);
  1064.  
  1065. v.objects.valueLabel.Position = newUDim2(1,-(v.objects.valueLabel.TextBounds.X + 3),0,0)
  1066. v.objects.background.Position = newUDim2(0,0,1,3 + yPos)
  1067. v.objects.background.Visible = v.enabled
  1068.  
  1069. if v.enabled then
  1070. yPos = yPos + 16 + 3
  1071. local x = (v.objects.keyLabel.TextBounds.X + 10 + v.objects.valueLabel.TextBounds.X)
  1072. if x > xSize then
  1073. xSize = x
  1074. end
  1075. end
  1076. end
  1077.  
  1078. self.objects.background.Size = newUDim2(0,xSize + 8,0,16)
  1079. self.objects.background.Position = self.position
  1080. end
  1081.  
  1082. function indicator:AddValue(data)
  1083. local value = {
  1084. key = data.key or '',
  1085. value = data.value or '',
  1086. order = data.order or #self.values+1,
  1087. enabled = data.enabled == nil and true or data.enabled,
  1088. objects = {},
  1089. }
  1090.  
  1091. table.insert(self.values, value);
  1092.  
  1093. -- Create Objects --
  1094. do
  1095. local z = library.zindexOrder.indicator;
  1096. local objs = value.objects;
  1097.  
  1098. objs.background = utility:Draw('Square', {
  1099. Size = newUDim2(1, 0, 0, 16);
  1100. ThemeColor = 'Background';
  1101. ZIndex = z;
  1102. Parent = indicator.objects.background;
  1103. })
  1104.  
  1105. objs.border1 = utility:Draw('Square', {
  1106. Size = newUDim2(1,2,1,2);
  1107. Position = newUDim2(0,-1,0,-1);
  1108. ThemeColor = 'Border 2';
  1109. Parent = objs.background;
  1110. ZIndex = z-1;
  1111. })
  1112.  
  1113. objs.border2 = utility:Draw('Square', {
  1114. Size = newUDim2(1,2,1,2);
  1115. Position = newUDim2(0,-1,0,-1);
  1116. ThemeColor = 'Border 3';
  1117. Parent = objs.border1;
  1118. ZIndex = z-2;
  1119. })
  1120.  
  1121. objs.keyLabel = utility:Draw('Text', {
  1122. Position = newUDim2(0,3,0,1);
  1123. ThemeColor = 'Option Text 2';
  1124. Size = 13;
  1125. Font = 2;
  1126. ZIndex = z+2;
  1127. Outline = true;
  1128. Parent = objs.background;
  1129. });
  1130.  
  1131. objs.valueLabel = utility:Draw('Text', {
  1132. Position = newUDim2(0,0,0,1);
  1133. ThemeColor = 'Option Text 2';
  1134. Size = 13;
  1135. Font = 2;
  1136. ZIndex = z+2;
  1137. Outline = true;
  1138. Parent = objs.background;
  1139. });
  1140.  
  1141. end
  1142. --------------------
  1143.  
  1144. function value:Remove()
  1145. table.remove(indicator.values, table.find(indicator.values, value))
  1146. self.objects.background:Remove()
  1147. table.clear(self)
  1148. indicator:Update();
  1149. end
  1150.  
  1151. function value:SetEnabled(bool)
  1152. if typeof(bool) == 'boolean' then
  1153. self.enabled = bool
  1154. indicator:Update()
  1155. end
  1156. end
  1157.  
  1158. function value:SetValue(str)
  1159. if typeof(str) == 'string' then
  1160. self.value = str
  1161. indicator:Update()
  1162. end
  1163. end
  1164.  
  1165. function value:SetKey(str)
  1166. if typeof(str) == 'string' then
  1167. self.key = str
  1168. indicator:Update()
  1169. end
  1170. end
  1171.  
  1172. self:Update()
  1173. return value
  1174. end
  1175.  
  1176. function indicator:GetValue(idx)
  1177. if typeof(idx) == 'number' then
  1178. return self.values[idx]
  1179. else
  1180. for i,v in next, self.values do
  1181. if v.key == idx then
  1182. return v
  1183. end
  1184. end
  1185. end
  1186. end
  1187.  
  1188. function indicator:SetEnabled(bool)
  1189. if typeof(bool) == 'boolean' then
  1190. self.enabled = bool;
  1191. self.objects.background.Visible = bool;
  1192. self:Update();
  1193. end
  1194. end
  1195.  
  1196. function indicator:SetPosition(udim2)
  1197. if typeof(udim2) == 'UDim2' then
  1198. self.position = udim2
  1199. self.objects.background.Position = udim2;
  1200. end
  1201. end
  1202.  
  1203. for i,v in next, data.values or {} do
  1204. indicator:AddValue({key = tostring(i), value = tostring(v)})
  1205. end
  1206.  
  1207. indicator:SetEnabled(indicator.enabled);
  1208. return indicator
  1209. end
  1210.  
  1211. function self.NewWindow(data)
  1212. local window = {
  1213. title = data.title or '',
  1214. selectedTab = nil;
  1215. tabs = {},
  1216. objects = {},
  1217. colorpicker = {
  1218. objects = {};
  1219. color = c3new(1,0,0);
  1220. trans = 0;
  1221. };
  1222. dropdown = {
  1223. objects = {
  1224. values = {};
  1225. };
  1226. max = 5;
  1227. }
  1228. };
  1229.  
  1230. table.insert(library.windows, window);
  1231.  
  1232. ----- Create Objects ----
  1233. do
  1234. local size = data.size or newUDim2(0, 525, 0, 650);
  1235. local position = data.position or newUDim2(0, 250, 0, 150);
  1236. local objs = window.objects;
  1237. local z = library.zindexOrder.window;
  1238.  
  1239. objs.background = utility:Draw('Square', {
  1240. Size = size;
  1241. Position = position;
  1242. ThemeColor = 'Background';
  1243. ZIndex = z;
  1244. })
  1245.  
  1246. objs.innerBorder1 = utility:Draw('Square', {
  1247. Size = newUDim2(1,2,1,2);
  1248. Position = newUDim2(0,-1,0,-1);
  1249. ThemeColor = 'Border 3';
  1250. ZIndex = z-1;
  1251. Parent = objs.background;
  1252. })
  1253.  
  1254. objs.innerBorder2 = utility:Draw('Square', {
  1255. Size = newUDim2(1,2,1,2);
  1256. Position = newUDim2(0,-1,0,-1);
  1257. ThemeColor = 'Border 1';
  1258. ZIndex = z-2;
  1259. Parent = objs.innerBorder1;
  1260. })
  1261.  
  1262. objs.midBorder = utility:Draw('Square', {
  1263. Size = newUDim2(1,10,1,25);
  1264. Position = newUDim2(0,-5,0,-20);
  1265. ThemeColor = 'Border 2';
  1266. ZIndex = z-3;
  1267. Parent = objs.innerBorder2;
  1268. })
  1269.  
  1270. objs.outerBorder1 = utility:Draw('Square', {
  1271. Size = newUDim2(1,2,1,2);
  1272. Position = newUDim2(0,-1,0,-1);
  1273. ThemeColor = 'Border 1';
  1274. ZIndex = z-4;
  1275. Parent = objs.midBorder;
  1276. })
  1277.  
  1278. objs.outerBorder2 = utility:Draw('Square', {
  1279. Size = newUDim2(1,2,1,2);
  1280. Position = newUDim2(0,-1,0,-1);
  1281. ThemeColor = 'Border 3';
  1282. ZIndex = z-5;
  1283. Parent = objs.outerBorder1;
  1284. })
  1285.  
  1286. objs.topBorder = utility:Draw('Square', {
  1287. Size = newUDim2(1,0,0,1);
  1288. ThemeColor = 'Accent';
  1289. ZIndex = z+1;
  1290. Parent = objs.background;
  1291. })
  1292.  
  1293. objs.title = utility:Draw('Text', {
  1294. Position = newUDim2(0,7,0,2);
  1295. ThemeColor = 'Primary Text';
  1296. Text = window.title;
  1297. Font = 2;
  1298. Size = 13;
  1299. ZIndex = z+1;
  1300. Outline = true;
  1301. Parent = objs.midBorder;
  1302. })
  1303.  
  1304. objs.groupBackground = utility:Draw('Square', {
  1305. Size = newUDim2(1,-16,1,-(16+23));
  1306. Position = newUDim2(0,8,0,8+23);
  1307. ThemeColor = 'Group Background';
  1308. ZIndex = z+5;
  1309. Parent = objs.background;
  1310. })
  1311.  
  1312. objs.groupInnerBorder = utility:Draw('Square', {
  1313. Size = newUDim2(1,2,1,2);
  1314. Position = newUDim2(0,-1,0,-1);
  1315. ThemeColor = 'Border 1';
  1316. ZIndex = z+4;
  1317. Parent = objs.groupBackground;
  1318. })
  1319.  
  1320. objs.groupOuterBorder = utility:Draw('Square', {
  1321. Size = newUDim2(1,2,1,2);
  1322. Position = newUDim2(0,-1,0,-1);
  1323. ThemeColor = 'Border 3';
  1324. ZIndex = z+3;
  1325. Parent = objs.groupInnerBorder;
  1326. })
  1327.  
  1328. objs.tabHolder = utility:Draw('Square', {
  1329. Size = newUDim2(1,0,0,20);
  1330. Position = newUDim2(0,0,0,-21);
  1331. Parent = objs.groupBackground;
  1332. Transparency = 0;
  1333. ZIndex = z+1;
  1334. })
  1335.  
  1336. objs.columnholder1 = utility:Draw('Square', {
  1337. Size = newUDim2(.48, 0, .96, 0);
  1338. Position = newUDim2(.01, 0, .02, 0);
  1339. Transparency = 0;
  1340. ZIndex = z+6;
  1341. Parent = objs.groupBackground;
  1342. })
  1343.  
  1344. objs.columnholder2 = utility:Draw('Square', {
  1345. Size = newUDim2(.48, 0, .96, 0);
  1346. Position = newUDim2(1 - (.48 + .01), 0, .02, 0);
  1347. Transparency = 0;
  1348. ZIndex = z+6;
  1349. Parent = objs.groupBackground;
  1350. })
  1351.  
  1352.  
  1353. objs.dragdetector = utility:Draw('Square',{
  1354. Size = newUDim2(1,0,1,0);
  1355. Parent = objs.midBorder;
  1356. Transparency = 0;
  1357. ZIndex = z+2;
  1358. })
  1359.  
  1360. local dragging, mouseStart, objStart;
  1361.  
  1362. utility:Connection(objs.dragdetector.MouseButton1Down, function(pos)
  1363. dragging = true;
  1364. mouseStart = newUDim2(0, pos.X, 0, pos.Y);
  1365. objStart = objs.background.Position;
  1366. end)
  1367.  
  1368. utility:Connection(button1up, function()
  1369. dragging = false;
  1370. end)
  1371.  
  1372. utility:Connection(mousemove, function(pos)
  1373. if dragging then
  1374. if window.open then
  1375. objs.background.Position = objStart + newUDim2(0, pos.X, 0, pos.Y) - mouseStart;
  1376. else
  1377. dragging = false
  1378. end
  1379. end
  1380. end)
  1381.  
  1382. end
  1383. -------------------------
  1384.  
  1385. -- Create Color Picker --
  1386. do
  1387. -- Objects
  1388. do
  1389. local objs = window.colorpicker.objects;
  1390. local z = library.zindexOrder.colorpicker;
  1391.  
  1392. objs.background = utility:Draw('Square', {
  1393. Visible = false;
  1394. Size = newUDim2(0,200,0,242);
  1395. Position = newUDim2(1,-200,1,10);
  1396. ThemeColor = 'Background';
  1397. ZIndex = z;
  1398. Parent = window.objects.background;
  1399. })
  1400.  
  1401. objs.border1 = utility:Draw('Square', {
  1402. Size = newUDim2(1,2,1,2);
  1403. Position = newUDim2(0,-1,0,-1);
  1404. ThemeColor = 'Border';
  1405. ZIndex = z-1;
  1406. Parent = objs.background;
  1407. })
  1408.  
  1409. objs.border2 = utility:Draw('Square', {
  1410. Size = newUDim2(1,2,1,2);
  1411. Position = newUDim2(0,-1,0,-1);
  1412. ThemeColor = 'Border 1';
  1413. ZIndex = z-2;
  1414. Parent = objs.border1;
  1415. })
  1416.  
  1417. objs.border3 = utility:Draw('Square', {
  1418. Size = newUDim2(1,2,1,2);
  1419. Position = newUDim2(0,-1,0,-1);
  1420. ThemeColor = 'Border';
  1421. ZIndex = z-3;
  1422. Parent = objs.border2;
  1423. })
  1424.  
  1425. objs.statusText = utility:Draw('Text', {
  1426. Position = newUDim2(0,5,0,4);
  1427. Text = 'colorpicker_status_text';
  1428. ThemeColor = 'Option Text 1';
  1429. Size = 13;
  1430. Font = 2;
  1431. Outline = true;
  1432. ZIndex = z+1;
  1433. Parent = objs.background;
  1434. })
  1435.  
  1436. objs.mainColor = utility:Draw('Square', {
  1437. Size = newUDim2(0, 175, 0, 175);
  1438. Position = newUDim2(0, 5, 0, 25);
  1439. Color = c3new(1,0,0);
  1440. ZIndex = z+2;
  1441. Parent = objs.background;
  1442. })
  1443.  
  1444. objs.sat1 = utility:Draw('Image', {
  1445. Size = newUDim2(1,0,1,0);
  1446. Data = syn.crypt.base64.decode"iVBORw0KGgoAAAANSUhEUgAAAaQAAAGkCAQAAADURZm+AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQflBwwSLzK3wl3KAAADrElEQVR42u3TORLCMBBFwT+6/50hMqXSZgonBN0BWCDGYPwqeSWVZPWYVHd0Pc5H86v9areu4Sz9u7XZXT/vvtZtu6dtJtYw525iGya05afnWW17ltPE8fzfTZy/yf3vmCes59xf0Sf/42l3lnvGOyyH+y/bo/X689wCPCYkEBIICYQECAmEBEICIQFCAiGBkEBIgJBASCAkEBIgJBASCAmEBAgJhARCAiEBQgIhgZAAIYGQQEggJEBIICQQEggJEBIICYQEQgKEBEICIYGQACGBkEBIICRASCAkEBIICRASCAmEBAgJhARCAiEBQgIhgZBASICQQEggJBASICQQEggJhAQICYQEQgIhAUICIYGQQEguAQgJhARCAoQEQgIhgZAAIYGQQEggJEBIICQQEggJEBIICYQEQgKEBEICIYGQACGBkEBIgJBASCAkEBIgJBASCAmEBAgJhARCAiEBQgIhgZBASICQQEggJBASICQQEggJhAQICYQEQgKEBEICIYGQACGBkEBIICRASCAkEBIICRASCAmEBEIChARCAiGBkAAhgZBASCAkQEggJBASICQQEggJhAQICYQEQgIhAUICIYGQQEiAkEBIICQQEiAkEBIICYQECAmEBEIChARCAiGBkAAhgZBASCAkQEggJBASCAkQEggJhARCAoQEQgIhgZAAIYGQQEggJEBIICQQEiAkEBIICYQECAmEBEICIQFCAiGBkEBIgJBASCAkEBIgJBASCAmEBAgJhARCAiEBQgIhgZAAIYGQQEggJEBIICQQEggJEBIICYQEQgKEBEICIYGQACGBkEBIICRASCAkEBIgJBASCAmEBAgJhARCAiEBQgIhgZBASICQQEggJBASICQQEggJhAQICYQEQgIhAUICIYGQACGBkEBIICRASCAkEBIICRASCAmEBEIChARCAiGBkAAhgZBASCAkQEggJBASCAkQEggJhAQICYQEQgIhAUICIYGQQEiAkEBIICQQEiAkEBIICYQECAmEBEICIQFCAiGBkEBILgEICYQEQgKEBEICIYGQACGBkEBIICRASCAkEBIICRASCAmEBEIChARCAiGBkAAhgZBASICQQEggJBASICQQEggJhAQICYQEQgIhAUICIYGQQEiAkEBIICQQEiAkEBIICYQECAmEBEIChARCAiGBkAAhgZBASCAkQEggJBASCAkQEggJhARCAoQEQgIhgZAAIYGQQEggJEBIICQQEiAkEBL8lzft9AVFFzN+ywAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMS0wNy0xMlQxODo0Nzo1MCswMDowMIxlM90AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMDctMTJUMTg6NDc6NTArMDA6MDD9OIthAAAAAElFTkSuQmCC";
  1447. ZIndex = z+3;
  1448. Parent = objs.mainColor;
  1449. })
  1450.  
  1451. objs.sat2 = utility:Draw('Image', {
  1452. Size = newUDim2(1,0,1,0);
  1453. Data = syn.crypt.base64.decode"iVBORw0KGgoAAAANSUhEUgAAAaQAAAGkCAQAAADURZm+AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQflBwwSLyBEeyyCAAAD4klEQVR42u3YwQnAQAhFQTek/5pz9eBtEYzMlBD4PDcRADDBieMjwK3HJwBDghFepx0oEhgSOO0ARQJDAqcdKBJgSGBI4I0EhgQ47cCQwJDAGwlQJDAkcNqBIgGKBIoEhgROO0CRQJFAkQBDAqcdGBI47QBFAkUCQwKnHaBIoEigSKBIgCKBIYHTDhQJUCQwJHDagSIBigSGBE47UCRAkcCQwGkHKBIoEigSGBLgtANDAkMCbyTAkMBpB4oEigQoEhgSOO1AkQBDAqcdKBIoEqBIYEjgtANFUiRQJFAkMCTAaQeKBIoEigQYEjjtQJFAkQBFAkMCpx0oEmBI4LQDRQJFAhQJDAmcdqBIgCKBIoEhAU47UCRQJFAkwJDAaQeKBIYEOO1AkUCRYHuRTAmcduC0A0UCFAkUCQwJnHaAIoEigSKBIQFOO2gvkimBIoE3EhgS4LQDRQJDAqcdoEigSKBIYEiAIYEhwXx+NoAigSGB0w5QJDAkMCQwJKDiZwMoEhgSOO0ARQJFgnlFMiVw2oHTDhQJUCRQJDAkcNoBVZFMCRQJvJHAkACnHSgSKBIoElANSZPAaQdOOzAkwGkHigSGBIYEGBK08LMBFAkUCRQJMCQwJDAkWMjPBlAkMCRw2gG5SKYEigTeSGBIgNMOFAkMCQwJMCRo4WcDKBIYEjjtgFwkUwJFAm8kMCTAaQeKBIoEigRUQ9IkcNqB0w4MCXDagSKBIsHCIpkSOO3AaQeKBCgSKBIYEhgSYEjQws8GUCQwJHDaAblIpgSKBN5IYEiA0w4UCQwJDAkwJGjhZwMoEhgSOO0ARQJDAkMCQwIqfjaAIoEigSIBhgROO5hXJFMCpx047UCRAEUCRQJDAqcdUBXJlECRwBsJDAlw2oEigSKBIgGGBIYEhgSL+dkAigSGBE47QJHAkMBpB4oEGBIYEhgSrOZnAygSKBIoEmBI4LQDRQJFAhQJDAmcdrC8SKYEigTeSGBIgNMOFAkMCZx2gCKBIoEigSEBTjtQJFAkUCTAkMBpB4oEigQoEhgSOO1AkQBDAqcdKBKgSKBIYEjgtAMUCRQJFAkMCXDagSKBIoEiAYYETjtQJFAkQJHAkMBpB4oEGBI47UCRQJEARQJDAqcdoEigSGBI4LQDFAkUCRQJFAkwJHDagSKBIQFOOzAkMCTwRgIMCZx2oEigSIAigSKBIYHTzkcARQJFAkMCnHZgSGBI4I0EGBI47UCRQJEAQwKnHSgSKBKgSGBI4LQDRQIUCRQJDAmcdoAigSGB0w5QJFAkUCQwJMBpB4oEhgROO0CRwJDAkMAbCVAkMCT4gw/reQYigE05fAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMS0wNy0xMlQxODo0NzozMiswMDowMN2VK3MAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMDctMTJUMTg6NDc6MzIrMDA6MDCsyJPPAAAAAElFTkSuQmCC";
  1454. ZIndex = z+4;
  1455. Parent = objs.mainColor;
  1456. })
  1457.  
  1458. objs.colorBorder = utility:Draw('Square', {
  1459. Size = newUDim2(1,2,1,2);
  1460. Position = newUDim2(0,-1,0,-1);
  1461. ThemeColor = 'Border';
  1462. ZIndex = z+1;
  1463. Parent = objs.mainColor;
  1464. })
  1465.  
  1466. objs.mainDetector = utility:Draw('Square',{
  1467. Size = newUDim2(1,0,1,0);
  1468. Transparency = 0;
  1469. ZIndex = z+10;
  1470. Parent = objs.mainColor;
  1471. })
  1472.  
  1473. objs.hue = utility:Draw('Image', {
  1474. Size = newUDim2(0,175,0,10);
  1475. Position = newUDim2(0,5,0,205);
  1476. Data = library.images.colorhue;
  1477. ZIndex = z+2;
  1478. Parent = objs.background;
  1479. })
  1480.  
  1481. objs.hueBorder = utility:Draw('Square', {
  1482. Size = newUDim2(1,2,1,2);
  1483. Position = newUDim2(0,-1,0,-1);
  1484. ThemeColor = 'Border';
  1485. ZIndex = z+1;
  1486. Parent = objs.hue;
  1487. })
  1488.  
  1489. objs.hueDetector = utility:Draw('Square',{
  1490. Size = newUDim2(1,0,1,0);
  1491. Transparency = 0;
  1492. ZIndex = z+10;
  1493. Parent = objs.hue;
  1494. })
  1495.  
  1496. objs.transColor = utility:Draw('Square', {
  1497. Size = newUDim2(0,10,0,175);
  1498. Position = newUDim2(0,185,0,25);
  1499. Color = c3new(1,0,0);
  1500. ZIndex = z+2;
  1501. Parent = objs.background;
  1502. })
  1503.  
  1504. objs.trans = utility:Draw('Image', {
  1505. Size = newUDim2(1,0,1,0);
  1506. Data = library.images.colortrans;
  1507. ZIndex = z+3;
  1508. Parent = objs.transColor;
  1509. })
  1510.  
  1511. objs.transBorder = utility:Draw('Square', {
  1512. Size = newUDim2(1,2,1,2);
  1513. Position = newUDim2(0,-1,0,-1);
  1514. ThemeColor = 'Border';
  1515. ZIndex = z+1;
  1516. Parent = objs.transColor;
  1517. })
  1518.  
  1519. objs.transDetector = utility:Draw('Square',{
  1520. Size = newUDim2(1,0,1,0);
  1521. Transparency = 0;
  1522. ZIndex = z+10;
  1523. Parent = objs.transColor;
  1524. })
  1525.  
  1526. objs.pointer = utility:Draw('Square', {
  1527. Size = newUDim2(0,2,0,2);
  1528. Position = newUDim2(0,0,0,0);
  1529. Color = c3new(1,1,1);
  1530. ZIndex = z+6;
  1531. Parent = objs.mainColor;
  1532. })
  1533.  
  1534. objs.pointerBorder = utility:Draw('Square', {
  1535. Size = newUDim2(1,2,1,2);
  1536. Position = newUDim2(0,-1,0,-1);
  1537. Color = c3new(0,0,0);
  1538. ZIndex = z+5;
  1539. Parent = objs.pointer;
  1540. })
  1541.  
  1542. objs.hueSlider = utility:Draw('Square', {
  1543. Size = newUDim2(0,1,1,0);
  1544. Color = c3new(1,1,1);
  1545. ZIndex = z+4;
  1546. Parent = objs.hue;
  1547. })
  1548.  
  1549. objs.hueSliderBorder = utility:Draw('Square', {
  1550. Size = newUDim2(1,2,1,2);
  1551. Position = newUDim2(0,-1,0,-1);
  1552. Color = c3new(0,0,0);
  1553. ZIndex = z+3;
  1554. Parent = objs.hueSlider;
  1555. })
  1556.  
  1557. objs.transSlider = utility:Draw('Square', {
  1558. Size = newUDim2(1,0,0,1);
  1559. Color = c3new(1,1,1);
  1560. ZIndex = z+5;
  1561. Parent = objs.trans;
  1562. })
  1563.  
  1564. objs.transSliderBorder = utility:Draw('Square', {
  1565. Size = newUDim2(1,2,1,2);
  1566. Position = newUDim2(0,-1,0,-1);
  1567. Color = c3new(0,0,0);
  1568. ZIndex = z+4;
  1569. Parent = objs.transSlider;
  1570. })
  1571.  
  1572. objs.rBackground = utility:Draw('Square', {
  1573. Size = newUDim2(0, 60, 0, 15);
  1574. Position = newUDim2(0, 5, 1, - 20);
  1575. ThemeColor = 'Option Background';
  1576. Parent = objs.background;
  1577. ZIndex = z+5;
  1578. })
  1579.  
  1580. objs.rBorder = utility:Draw('Square', {
  1581. Size = newUDim2(1,2,1,2);
  1582. Position = newUDim2(0,-1,0,-1);
  1583. Color = c3new(0,0,0);
  1584. ZIndex = z+4;
  1585. Parent = objs.rBackground;
  1586. })
  1587.  
  1588. objs.rText = utility:Draw('Text', {
  1589. Position = newUDim2(.5,0,0,0);
  1590. Color = c3new(1,.1,.1);
  1591. Text = 'R';
  1592. Size = 13;
  1593. Font = 2;
  1594. Outline = true;
  1595. Center = true;
  1596. ZIndex = z+6;
  1597. Parent = objs.rBackground;
  1598. })
  1599.  
  1600. objs.gBackground = utility:Draw('Square', {
  1601. Size = newUDim2(0, 60, 0, 15);
  1602. Position = newUDim2(0, 70, 1, - 20);
  1603. ThemeColor = 'Option Background';
  1604. Parent = objs.background;
  1605. ZIndex = z+5;
  1606. })
  1607.  
  1608. objs.gBorder = utility:Draw('Square', {
  1609. Size = newUDim2(1,2,1,2);
  1610. Position = newUDim2(0,-1,0,-1);
  1611. Color = c3new(0,0,0);
  1612. ZIndex = z+4;
  1613. Parent = objs.gBackground;
  1614. })
  1615.  
  1616. objs.gText = utility:Draw('Text', {
  1617. Position = newUDim2(.5,0,0,0);
  1618. Color = c3new(.1,1,.1);
  1619. Text = 'G';
  1620. Size = 13;
  1621. Font = 2;
  1622. Outline = true;
  1623. Center = true;
  1624. ZIndex = z+6;
  1625. Parent = objs.gBackground;
  1626. })
  1627.  
  1628. objs.bBackground = utility:Draw('Square', {
  1629. Size = newUDim2(0, 60, 0, 15);
  1630. Position = newUDim2(0, 135, 1, - 20);
  1631. ThemeColor = 'Option Background';
  1632. Parent = objs.background;
  1633. ZIndex = z+5;
  1634. })
  1635.  
  1636. objs.bBorder = utility:Draw('Square', {
  1637. Size = newUDim2(1,2,1,2);
  1638. Position = newUDim2(0,-1,0,-1);
  1639. Color = c3new(0,0,0);
  1640. ZIndex = z+4;
  1641. Parent = objs.bBackground;
  1642. })
  1643.  
  1644. objs.bText = utility:Draw('Text', {
  1645. Position = newUDim2(.5,0,0,0);
  1646. Color = c3new(.1,.1,1);
  1647. Text = 'B';
  1648. Size = 13;
  1649. Font = 2;
  1650. Outline = true;
  1651. Center = true;
  1652. ZIndex = z+6;
  1653. Parent = objs.bBackground;
  1654. })
  1655.  
  1656. local draggingHue, draggingSat, draggingTrans = false, false, false;
  1657.  
  1658. local function updateSatVal(pos)
  1659. if window.colorpicker.selected ~= nil then
  1660. local hue, sat, val = window.colorpicker.selected.color:ToHSV()
  1661. X = (objs.mainColor.Object.Position.X + objs.mainColor.Object.Size.X) - objs.mainColor.Object.Position.X
  1662. Y = (objs.mainColor.Object.Position.Y + objs.mainColor.Object.Size.Y) - objs.mainColor.Object.Position.Y
  1663. X = math.clamp((pos.X - objs.mainColor.Object.Position.X) / X, 0, 0.995)
  1664. Y = math.clamp((pos.Y - objs.mainColor.Object.Position.Y) / Y, 0, 0.995)
  1665. sat, val = 1 - X, 1 - Y;
  1666. window.colorpicker.selected:SetColor(fromhsv(hue,sat,val));
  1667. window.colorpicker:Visualize(fromhsv(hue, sat, val), window.colorpicker.selected.trans);
  1668. end
  1669. end
  1670.  
  1671. local function updateHue(pos)
  1672. if window.colorpicker.selected ~= nil then
  1673. local hue, sat, val = window.colorpicker.selected.color:ToHSV()
  1674. X = (objs.hue.Object.Position.X + objs.hue.Object.Size.X) - objs.hue.Object.Position.X
  1675. X = math.clamp((pos.X - objs.hue.Object.Position.X) / X, 0, 0.995)
  1676. hue = 1 - X
  1677. window.colorpicker.selected:SetColor(fromhsv(hue,sat,val));
  1678. window.colorpicker:Visualize(fromhsv(hue, sat, val), window.colorpicker.selected.trans);
  1679. end
  1680. end
  1681.  
  1682. local function updateTrans(pos)
  1683. if window.colorpicker.selected ~= nil then
  1684. Y = (objs.trans.Object.Position.Y + objs.trans.Object.Size.Y) - objs.trans.Object.Position.Y
  1685. Y = math.clamp((pos.Y - objs.transColor.Object.Position.Y) / Y, 0, 0.995)
  1686. window.colorpicker.selected:SetTrans(Y);
  1687. window.colorpicker:Visualize(window.colorpicker.selected.color, Y);
  1688. end
  1689. end
  1690.  
  1691. utility:Connection(objs.mainDetector.MouseButton1Down, function(pos)
  1692. draggingSat = true;
  1693. updateSatVal(pos)
  1694. end)
  1695.  
  1696. utility:Connection(objs.hueDetector.MouseButton1Down, function(pos)
  1697. draggingHue = true;
  1698. updateHue(pos)
  1699. end)
  1700.  
  1701. utility:Connection(objs.transDetector.MouseButton1Down, function(pos)
  1702. draggingTrans = true;
  1703. updateTrans(pos)
  1704. end)
  1705.  
  1706. utility:Connection(mousemove, function(pos)
  1707. if library.open then
  1708. if draggingSat then
  1709. updateSatVal(pos)
  1710. elseif draggingHue then
  1711. updateHue(pos)
  1712. elseif draggingTrans then
  1713. updateTrans(pos)
  1714. end
  1715. end
  1716. end)
  1717.  
  1718. utility:Connection(button1up, function()
  1719. draggingSat = false;
  1720. draggingHue = false;
  1721. draggingTrans = false;
  1722. end)
  1723.  
  1724. end
  1725.  
  1726. function window.colorpicker:Visualize(c3, a)
  1727. if typeof(c3) ~= 'Color3' then return end
  1728. if typeof(a) ~= 'number' then return end
  1729. local h,s,v = c3:ToHSV();
  1730. h = h == 0 and 1 or h;
  1731. self.color = c3;
  1732. self.trans = a;
  1733. self.objects.mainColor.Color = fromhsv(h,1,1);
  1734. self.objects.transColor.Color = fromhsv(h,s,v);
  1735. self.objects.hueSlider.Position = newUDim2(1 - h, 0,0,0);
  1736. self.objects.transSlider.Position = newUDim2(0,0,a,0);
  1737. self.objects.pointer.Position = newUDim2(1 - s, 0, 1 - v, 0);
  1738. self.objects.statusText.Text = 'Editing : Unknown';
  1739. if self.selected ~= nil then
  1740. local txt = 'Editing : Unknown';
  1741. if self.selected.text ~= nil and self.selected.text ~= '' then
  1742. txt = tostring(self.selected.text)
  1743. elseif self.selected.flag ~= nil and self.selected.flag ~= '' then
  1744. txt = tostring(self.selected.flag)
  1745. end
  1746. self.objects.statusText.Text = tostring(txt);
  1747. end
  1748. end
  1749.  
  1750. window.colorpicker:Visualize(window.colorpicker.color, window.colorpicker.trans)
  1751.  
  1752. end
  1753. -------------------------
  1754.  
  1755. ---- Create Dropdown ----
  1756. do
  1757. -- Default Objects
  1758. do
  1759. local objs = window.dropdown.objects;
  1760. local z = library.zindexOrder.dropdown;
  1761.  
  1762. objs.background = utility:Draw('Square', {
  1763. Visible = false;
  1764. Size = newUDim2(1,-3,0,50);
  1765. Position = newUDim2(0,3,1,0);
  1766. ThemeColor = 'Background';
  1767. ZIndex = z;
  1768. Parent = window.objects.background;
  1769. })
  1770.  
  1771. objs.border1 = utility:Draw('Square', {
  1772. Size = newUDim2(1,2,1,2);
  1773. Position = newUDim2(0,-1,0,-1);
  1774. ThemeColor = 'Border';
  1775. ZIndex = z-1;
  1776. Parent = objs.background;
  1777. })
  1778.  
  1779. objs.border2 = utility:Draw('Square', {
  1780. Size = newUDim2(1,2,1,2);
  1781. Position = newUDim2(0,-1,0,-1);
  1782. ThemeColor = 'Border 1';
  1783. ZIndex = z-2;
  1784. Parent = objs.border1;
  1785. })
  1786.  
  1787. objs.border3 = utility:Draw('Square', {
  1788. Size = newUDim2(1,2,1,2);
  1789. Position = newUDim2(0,-1,0,-1);
  1790. ThemeColor = 'Border';
  1791. ZIndex = z-3;
  1792. Parent = objs.border2;
  1793. })
  1794.  
  1795. end
  1796.  
  1797. function window.dropdown:Refresh()
  1798. if self.selected ~= nil then
  1799. local list = self.selected
  1800. for idx, value in next, list.values do
  1801. local valueObject = self.objects.values[idx]
  1802. if valueObject == nil then
  1803. valueObject = {};
  1804. valueObject.background = utility:Draw('Square', {
  1805. Size = newUDim2(1,-4,0,18);
  1806. Color = Color3.new(.25,.25,.25);
  1807. Transparency = 0;
  1808. ZIndex = library.zindexOrder.dropdown+1;
  1809. Parent = self.objects.background;
  1810. })
  1811. valueObject.text = utility:Draw('Text', {
  1812. Position = newUDim2(0,3,0,1);
  1813. ThemeColor = 'Option Text 2';
  1814. Text = tostring(value);
  1815. Size = 13;
  1816. Font = 2;
  1817. ZIndex = library.zindexOrder.dropdown+2;
  1818. Parent = valueObject.background;
  1819. })
  1820. valueObject.connection = utility:Connection(valueObject.background.MouseButton1Down, function()
  1821. local currentList = self.selected
  1822. if currentList then
  1823. local val = currentList.values[idx]
  1824. local currentSelected = currentList.selected;
  1825. local newSelected = currentList.multi and {} or val;
  1826.  
  1827. if currentList.multi then
  1828. for i,v in next, currentSelected do
  1829. if v == "none" then continue end
  1830. newSelected[i] = v;
  1831. end
  1832. if table.find(newSelected, val) then
  1833. table.remove(newSelected, table.find(newSelected, val));
  1834. else
  1835. table.insert(newSelected, val)
  1836. end
  1837. end
  1838.  
  1839. currentList:Select(newSelected);
  1840. if not currentList.multi then
  1841. currentList.open = false;
  1842. currentList.objects.openText.Text = '+';
  1843. window.dropdown.selected = nil;
  1844. window.dropdown.objects.background.Visible = false;
  1845. end
  1846.  
  1847. for idx, val in next, currentList.values do
  1848. local valueObj = self.objects.values[idx]
  1849. if valueObj then
  1850. valueObj.background.Transparency = (typeof(newSelected) == 'table' and table.find(newSelected, val) or newSelected == val) and 1 or 0
  1851. end
  1852. end
  1853.  
  1854. end
  1855. end)
  1856. self.objects.values[idx] = valueObject
  1857. end
  1858. end
  1859.  
  1860. for idx, val in next, list.values do
  1861. local valueObj = self.objects.values[idx]
  1862. if valueObj then
  1863. valueObj.background.Transparency = (typeof(list.selected) == 'table' and table.find(list.selected, val) or list.selected == val) and 1 or 0
  1864. end
  1865. end
  1866.  
  1867. local y,padding = 2,2
  1868. for idx, obj in next, self.objects.values do
  1869. local valueStr = list.values[idx]
  1870. obj.background.Visible = valueStr ~= nil
  1871. if valueStr ~= nil then
  1872. obj.background.Position = newUDim2(0,2,0,y);
  1873. obj.text.Text = valueStr;
  1874. y = y + obj.background.Object.Size.Y + padding;
  1875. end
  1876. end
  1877.  
  1878. self.objects.background.Size = newUDim2(1,-6,0,y);
  1879.  
  1880. end
  1881. end
  1882.  
  1883. window.dropdown:Refresh();
  1884. end
  1885. -------------------------
  1886.  
  1887. local function tooltip(option)
  1888. utility:Connection(option.objects.holder.MouseEnter, function()
  1889. tooltipObjects.background.Visible = (not (option.tooltip == '' or option.tooltip == nil)) and true or false;
  1890. tooltipObjects.riskytext.Visible = option.risky;
  1891. tooltipObjects.text.Position = option.risky and newUDim2(0,60,0,0) or newUDim2(0,3,0,0)
  1892. tooltipObjects.text.Text = tostring(option.tooltip);
  1893. library.CurrentTooltip = option;
  1894. end)
  1895. utility:Connection(option.objects.holder.MouseLeave, function()
  1896. if library.CurrentTooltip == option then
  1897. library.CurrentTooltip = nil;
  1898. tooltipObjects.background.Visible = false
  1899. end
  1900. end)
  1901. end
  1902.  
  1903.  
  1904. local visValues = {};
  1905.  
  1906. function window:SetOpen(bool)
  1907. if typeof(bool) == 'boolean' then
  1908. self.open = bool;
  1909.  
  1910. local objs = self.objects.background:GetDescendants()
  1911. table.insert(objs, self.objects.background)
  1912.  
  1913. task.spawn(function()
  1914. if not bool then
  1915. task.wait(.1);
  1916. end
  1917. self.objects.background.Visible = bool;
  1918. end)
  1919.  
  1920. for _,v in next, objs do
  1921. if v.Object.Transparency ~= 0 then
  1922. task.spawn(function()
  1923. if bool then
  1924. utility:Tween(v.Object, 'Transparency', visValues[v] or 1, .1);
  1925. else
  1926. visValues[v] = v.Object.Transparency;
  1927. utility:Tween(v.Object, 'Transparency', .05, .1);
  1928. end
  1929. end)
  1930. end
  1931. end
  1932. end
  1933. end
  1934.  
  1935. function window:AddTab(text, order)
  1936. local tab = {
  1937. text = text;
  1938. order = order or #self.tabs+1;
  1939. callback = function() end;
  1940. objects = {};
  1941. sections = {};
  1942. }
  1943.  
  1944. table.insert(self.tabs, tab);
  1945.  
  1946. --- Create Objects ---
  1947. do
  1948. local objs = tab.objects;
  1949. local z = library.zindexOrder.window + 5;
  1950.  
  1951. objs.background = utility:Draw('Square', {
  1952. Size = newUDim2(0,50,1,0);
  1953. Parent = self.objects.tabHolder;
  1954. ThemeColor = 'Unselected Tab Background';
  1955. ZIndex = z;
  1956. })
  1957.  
  1958. objs.innerBorder = utility:Draw('Square', {
  1959. Size = newUDim2(1,2,1,2);
  1960. Position = newUDim2(0,-1,0,-1);
  1961. ThemeColor = 'Border 1';
  1962. ZIndex = z-1;
  1963. Parent = objs.background;
  1964. })
  1965.  
  1966. objs.outerBorder = utility:Draw('Square', {
  1967. Size = newUDim2(1,2,1,2);
  1968. Position = newUDim2(0,-1,0,-1);
  1969. ThemeColor = 'Border 3';
  1970. ZIndex = z-2;
  1971. Parent = objs.innerBorder;
  1972. })
  1973.  
  1974. objs.topBorder = utility:Draw('Square', {
  1975. Size = newUDim2(1,0,0,1);
  1976. ThemeColor = 'Unselected Tab Background';
  1977. ZIndex = z+1;
  1978. Parent = objs.background;
  1979. })
  1980.  
  1981. objs.text = utility:Draw('Text', {
  1982. ThemeColor = 'Unselected Tab Text';
  1983. Text = text;
  1984. Size = 13;
  1985. Font = 2;
  1986. ZIndex = z+1;
  1987. Outline = true;
  1988. Center = true;
  1989. Parent = objs.background;
  1990. })
  1991.  
  1992. utility:Connection(objs.background.MouseButton1Down, function()
  1993. tab:Select();
  1994. end)
  1995.  
  1996. end
  1997. ----------------------
  1998.  
  1999. function tab:AddSection(text, side, order)
  2000. local section = {
  2001. text = tostring(text);
  2002. side = side == nil and 1 or clamp(side,1,2);
  2003. order = order or #self.sections+1;
  2004. enabled = true;
  2005. objects = {};
  2006. options = {};
  2007. };
  2008.  
  2009. table.insert(self.sections, section);
  2010.  
  2011. --- Create Objects ---
  2012. do
  2013. local objs = section.objects;
  2014. local z = library.zindexOrder.window+15;
  2015.  
  2016. objs.background = utility:Draw('Square', {
  2017. ThemeColor = 'Section Background';
  2018. ZIndex = z;
  2019. Parent = window.objects['columnholder'..(section.side)];
  2020. })
  2021.  
  2022. objs.innerBorder = utility:Draw('Square', {
  2023. Size = newUDim2(1,2,1,1);
  2024. Position = newUDim2(0,-1,0,0);
  2025. ThemeColor = 'Border 3';
  2026. ZIndex = z-1;
  2027. Parent = objs.background;
  2028. })
  2029.  
  2030. objs.outerBorder = utility:Draw('Square', {
  2031. Size = newUDim2(1,2,1,1);
  2032. Position = newUDim2(0,-1,0,0);
  2033. ThemeColor = 'Border 1';
  2034. ZIndex = z-2;
  2035. Parent = objs.innerBorder;
  2036. })
  2037.  
  2038. objs.topBorder1 = utility:Draw('Square', {
  2039. Size = newUDim2(.025,1,0,1);
  2040. Position = newUDim2(0,-1,0,0);
  2041. ThemeColor = 'Accent';
  2042. ZIndex = z+1;
  2043. Parent = objs.background;
  2044. })
  2045.  
  2046. objs.topBorder2 = utility:Draw('Square', {
  2047. ThemeColor = 'Accent';
  2048. ZIndex = z+1;
  2049. Parent = objs.background;
  2050. })
  2051.  
  2052. objs.textlabel = utility:Draw('Text', {
  2053. Position = newUDim2(.0425,0,0,-7);
  2054. ThemeColor = 'Primary Text';
  2055. Size = 13;
  2056. Font = 2;
  2057. ZIndex = z+1;
  2058. Parent = objs.background;
  2059. })
  2060.  
  2061. objs.optionholder = utility:Draw('Square',{
  2062. Size = newUDim2(1-.03,0,1,-15);
  2063. Position = newUDim2(.015,0,0,13);
  2064. Transparency = 0;
  2065. ZIndex = z+1;
  2066. Parent = objs.background;
  2067. })
  2068.  
  2069. end
  2070. ----------------------
  2071.  
  2072. function section:SetText(text)
  2073. self.text = tostring(text);
  2074. self.objects.textlabel.Text = self.text;
  2075. local x = self.objects.background.Object.Size.X - self.objects.textlabel.TextBounds.X - 13
  2076. self.objects.topBorder2.Size = newUDim2(0, x, 0, 1)
  2077. self.objects.topBorder2.Position = newUDim2(1, 1 + -x, 0, 0)
  2078. end
  2079.  
  2080. function section:UpdateOptions()
  2081. table.sort(self.options, function(a,b)
  2082. return a.order < b.order
  2083. end)
  2084.  
  2085. local ySize, padding = 15, 0;
  2086. for i,option in next, self.options do
  2087. option.objects.holder.Visible = option.enabled
  2088. if option.enabled then
  2089. option.objects.holder.Position = newUDim2(0,0,0,ySize-15);
  2090. ySize += option.objects.holder.Object.Size.Y + padding;
  2091. end
  2092. end
  2093.  
  2094. self.objects.background.Size = newUDim2(1,0,0,ySize);
  2095.  
  2096. end
  2097.  
  2098. function section:SetEnabled(bool)
  2099. if typeof(bool) == 'boolean' then
  2100. section.enabled = bool;
  2101. tab:UpdateSections();
  2102. end
  2103. end
  2104.  
  2105. ------- Options -------
  2106.  
  2107. -- // Toggle
  2108. function section:AddToggle(data)
  2109. local toggle = {
  2110. class = 'toggle';
  2111. flag = data.flag;
  2112. text = '';
  2113. tooltip = '';
  2114. order = #self.options+1;
  2115. state = false;
  2116. risky = false;
  2117. callback = function() end;
  2118. enabled = true;
  2119. options = {};
  2120. objects = {};
  2121. };
  2122.  
  2123. local blacklist = {'objects'};
  2124. for i,v in next, data do
  2125. if not table.find(blacklist, i) ~= toggle[i] ~= nil then
  2126. toggle[i] = v
  2127. end
  2128. end
  2129.  
  2130. table.insert(self.options, toggle)
  2131.  
  2132. if toggle.flag then
  2133. library.flags[toggle.flag] = toggle.state;
  2134. library.options[toggle.flag] = toggle;
  2135. end
  2136.  
  2137. --- Create Objects ---
  2138. do
  2139. local objs = toggle.objects;
  2140. local z = library.zindexOrder.window+25;
  2141.  
  2142. objs.holder = utility:Draw('Square', {
  2143. Size = newUDim2(1,0,0,17);
  2144. Transparency = 0;
  2145. ZIndex = z+5;
  2146. Parent = section.objects.optionholder;
  2147. })
  2148.  
  2149. objs.background = utility:Draw('Square', {
  2150. Size = newUDim2(0,8,0,8);
  2151. Position = newUDim2(0,2,0,4);
  2152. ThemeColor = 'Option Background';
  2153. ZIndex = z+3;
  2154. Parent = objs.holder;
  2155. })
  2156.  
  2157. objs.gradient = utility:Draw('Image', {
  2158. Size = newUDim2(1,0,1,0);
  2159. Data = library.images.gradientp45;
  2160. Transparency = .25;
  2161. ZIndex = z+4;
  2162. Parent = objs.background;
  2163. })
  2164.  
  2165. objs.border1 = utility:Draw('Square', {
  2166. Size = newUDim2(1,2,1,2);
  2167. Position = newUDim2(0,-1,0,-1);
  2168. ThemeColor = 'Option Border 1';
  2169. ZIndex = z+2;
  2170. Parent = objs.background;
  2171. })
  2172.  
  2173. objs.border2 = utility:Draw('Square', {
  2174. Size = newUDim2(1,2,1,2);
  2175. Position = newUDim2(0,-1,0,-1);
  2176. ThemeColor = 'Option Border 2';
  2177. ZIndex = z+1;
  2178. Parent = objs.border1;
  2179. })
  2180.  
  2181. objs.text = utility:Draw('Text', {
  2182. Position = newUDim2(0,19,0,1);
  2183. ThemeColor = 'Option Text 3';
  2184. Size = 13;
  2185. Font = 2;
  2186. ZIndex = z+1;
  2187. Outline = true;
  2188. Parent = objs.holder;
  2189. })
  2190.  
  2191. utility:Connection(objs.holder.MouseEnter, function()
  2192. objs.border1.ThemeColor = 'Accent';
  2193. end)
  2194.  
  2195. utility:Connection(objs.holder.MouseLeave, function()
  2196. objs.border1.ThemeColor = toggle.state and 'Accent' or 'Option Border 1';
  2197. end)
  2198.  
  2199. utility:Connection(objs.holder.MouseButton1Down, function()
  2200. toggle:SetState(not toggle.state);
  2201. end)
  2202.  
  2203. end
  2204. ----------------------
  2205.  
  2206. function toggle:SetState(bool, nocallback)
  2207. if typeof(bool) == 'boolean' then
  2208. self.state = bool;
  2209. if self.flag then
  2210. library.flags[self.flag] = bool;
  2211. end
  2212.  
  2213. self.objects.border1.ThemeColor = bool and 'Accent' or (self.objects.holder.Hover and 'Accent' or 'Option Border 1');
  2214. self.objects.text.ThemeColor = bool and (self.risky and 'Risky Text Enabled' or 'Option Text 1') or (self.risky and 'Risky Text' or 'Option Text 3');
  2215. self.objects.background.ThemeColor = bool and 'Accent' or 'Option Background';
  2216. self.objects.background.ThemeColorOffset = bool and -55 or 0
  2217.  
  2218. if not nocallback then
  2219. self.callback(bool);
  2220. end
  2221.  
  2222. end
  2223. end
  2224.  
  2225. function toggle:SetText(str)
  2226. if typeof(str) == 'string' then
  2227. self.text = str;
  2228. self.objects.text.Text = str;
  2229. end
  2230. end
  2231.  
  2232. function toggle:UpdateOptions()
  2233. table.sort(self.options, function(a,b)
  2234. return a.order < b.order
  2235. end)
  2236.  
  2237. local x, y = 0, 0
  2238. for i,option in next, self.options do
  2239. option.objects.holder.Visible = option.enabled
  2240. if option.enabled then
  2241. if option.class == 'color' or option.class == 'bind' then
  2242. option.objects.holder.Position = newUDim2(1,-option.objects.holder.Object.Size.X-x,0,0);
  2243. x = x + option.objects.holder.Object.Size.X;
  2244. elseif option.class == 'slider' or option.class == 'list' then
  2245. option.objects.holder.Position = newUDim2(0,0,1,-option.objects.holder.Object.Size.Y-y);
  2246. y = y + option.objects.holder.Object.Size.Y;
  2247. end
  2248. end
  2249. end
  2250.  
  2251. self.objects.holder.Size = newUDim2(1,0,0,17 + y);
  2252. section:UpdateOptions()
  2253.  
  2254. end
  2255.  
  2256. -- // Toggle Addons
  2257. function toggle:AddColor(data)
  2258. local color = {
  2259. class = 'color';
  2260. flag = data.flag;
  2261. text = '';
  2262. tooltip = '';
  2263. order = #self.options+1;
  2264. callback = function() end;
  2265. color = Color3.new(1,1,1);
  2266. trans = 0;
  2267. open = false;
  2268. enabled = true;
  2269. objects = {};
  2270. };
  2271.  
  2272. local blacklist = {'objects'};
  2273. for i,v in next, data do
  2274. if not table.find(blacklist, i) and color[i] ~= nil then
  2275. color[i] = v
  2276. end
  2277. end
  2278.  
  2279. table.insert(self.options, color)
  2280.  
  2281. if color.flag then
  2282. library.flags[color.flag] = color.color;
  2283. library.options[color.flag] = color;
  2284. end
  2285.  
  2286. --- Create Objects ---
  2287. do
  2288. local objs = color.objects;
  2289. local z = library.zindexOrder.window+25;
  2290.  
  2291. objs.holder = utility:Draw('Square', {
  2292. Size = newUDim2(0,21,0,17);
  2293. Transparency = 0;
  2294. ZIndex = z+6;
  2295. Parent = self.objects.holder;
  2296. })
  2297.  
  2298. objs.background = utility:Draw('Square', {
  2299. Size = newUDim2(0,15,0,8);
  2300. Position = newUDim2(0,4,0,5);
  2301. ZIndex = z+3;
  2302. Parent = objs.holder;
  2303. })
  2304.  
  2305. objs.gradient = utility:Draw('Image', {
  2306. Size = newUDim2(1,0,1,0);
  2307. Data = library.images.gradientp45;
  2308. Transparency = .25;
  2309. ZIndex = z+4;
  2310. Parent = objs.background;
  2311. })
  2312.  
  2313. objs.border1 = utility:Draw('Square', {
  2314. Size = newUDim2(1,2,1,2);
  2315. Position = newUDim2(0,-1,0,-1);
  2316. ThemeColor = 'Option Border 1';
  2317. ZIndex = z+2;
  2318. Parent = objs.background;
  2319. })
  2320.  
  2321. objs.border2 = utility:Draw('Square', {
  2322. Size = newUDim2(1,2,1,2);
  2323. Position = newUDim2(0,-1,0,-1);
  2324. ThemeColor = 'Option Border 2';
  2325. ZIndex = z+1;
  2326. Parent = objs.border1;
  2327. })
  2328.  
  2329. utility:Connection(objs.holder.MouseEnter, function()
  2330. objs.border1.ThemeColor = 'Accent';
  2331. end)
  2332.  
  2333. utility:Connection(objs.holder.MouseLeave, function()
  2334. objs.border1.ThemeColor = color.state and 'Accent' or 'Option Border 1';
  2335. end)
  2336.  
  2337. utility:Connection(objs.holder.MouseButton1Down, function()
  2338. color:SetOpen(not color.open);
  2339. end)
  2340.  
  2341. end
  2342. ----------------------
  2343.  
  2344.  
  2345. function color:SetColor(c3, nocallback)
  2346. if typeof(c3) == 'Color3' then
  2347. local h,s,v = c3:ToHSV(); c3 = fromhsv(h, clamp(s,.005,.995), clamp(v,.005,.995))
  2348. self.color = c3;
  2349. self.objects.background.Color = c3;
  2350. if not nocallback then
  2351. self.callback(c3, self.trans);
  2352. end
  2353. if self.open then
  2354. window.colorpicker:Visualize(self.color, self.trans);
  2355. end
  2356. if self.flag then
  2357. library.flags[self.flag] = c3;
  2358. end
  2359. end
  2360. end
  2361.  
  2362. function color:SetTrans(trans, nocallback)
  2363. if typeof(trans) == 'number' then
  2364. self.trans = trans;
  2365. if not nocallback then
  2366. self.callback(self.color, trans);
  2367. end
  2368. if self.open then
  2369. window.colorpicker:Visualize(self.color, self.trans);
  2370. end
  2371. end
  2372. end
  2373.  
  2374. function color:SetOpen(bool)
  2375. if typeof(bool) == 'boolean' then
  2376. self.open = bool
  2377. if bool then
  2378. if window.colorpicker.selected then
  2379. window.colorpicker.selected.open = false;
  2380. end
  2381. window.colorpicker.selected = color
  2382. window.colorpicker.objects.background.Parent = self.objects.background;
  2383. window.colorpicker.objects.background.Visible = true;
  2384. window.colorpicker:Visualize(color.color, color.trans)
  2385. elseif window.colorpicker.selected == color then
  2386. window.colorpicker.selected = nil;
  2387. window.colorpicker.objects.background.Parent = window.objects.background;
  2388. window.colorpicker.objects.background.Visible = false;
  2389. end
  2390. end
  2391. end
  2392.  
  2393. tooltip(color);
  2394. color:SetColor(color.color, true);
  2395. color:SetTrans(color.trans, true);
  2396. self:UpdateOptions();
  2397. return color
  2398. end
  2399.  
  2400. function toggle:AddBind(data)
  2401. local bind = {
  2402. class = 'bind';
  2403. flag = data.flag;
  2404. text = '';
  2405. tooltip = '';
  2406. bind = 'none';
  2407. mode = 'toggle';
  2408. order = #self.options+1;
  2409. callback = function() end;
  2410. keycallback = function() end;
  2411. indicatorValue = library.keyIndicator:AddValue({value = 'value', key = 'key', enabled = false});
  2412. noindicator = false;
  2413. invertindicator = false;
  2414. state = false;
  2415. nomouse = false;
  2416. enabled = true;
  2417. binding = false;
  2418. objects = {};
  2419. };
  2420.  
  2421. local blacklist = {'objects'};
  2422. for i,v in next, data do
  2423. if not table.find(blacklist, i) and bind[i] ~= nil then
  2424. bind[i] = v
  2425. end
  2426. end
  2427.  
  2428. table.insert(self.options, bind)
  2429.  
  2430. if bind.flag then
  2431. library.options[bind.flag] = bind;
  2432. end
  2433.  
  2434. if bind.bind == 'none' then
  2435. bind.state = true
  2436. if bind.flag then
  2437. library.flags[bind.flag] = bind.state;
  2438. end
  2439. bind.callback(true)
  2440. local display = bind.state; if bind.invertindicator then display = not bind.state; end
  2441. bind.indicatorValue:SetEnabled(display and not bind.noindicator);
  2442. bind.indicatorValue:SetKey((bind.text == nil or bind.text == '') and (bind.flag == nil and 'unknown' or bind.flag) or bind.text); -- this is so dumb
  2443. bind.indicatorValue:SetValue('[Always]');
  2444. end
  2445.  
  2446. --- Create Objects ---
  2447. do
  2448. local objs = bind.objects;
  2449. local z = library.zindexOrder.window+25;
  2450.  
  2451. objs.holder = utility:Draw('Square', {
  2452. Size = newUDim2(0,0,0,17);
  2453. Transparency = 0;
  2454. ZIndex = z+6;
  2455. Parent = self.objects.holder;
  2456. })
  2457.  
  2458. objs.keyText = utility:Draw('Text', {
  2459. ThemeColor = 'Option Text 3';
  2460. Size = 13;
  2461. Font = 2;
  2462. ZIndex = z+1;
  2463. Parent = objs.holder;
  2464. })
  2465.  
  2466. utility:Connection(objs.holder.MouseEnter, function()
  2467. objs.keyText.ThemeColor = 'Accent';
  2468. end)
  2469.  
  2470. utility:Connection(objs.holder.MouseLeave, function()
  2471. objs.keyText.ThemeColor = bind.binding and 'Accent' or 'Option Text 3';
  2472. end)
  2473.  
  2474. utility:Connection(objs.holder.MouseButton1Down, function()
  2475. if not bind.binding then
  2476. bind:SetKeyText('...');
  2477. bind.binding = true;
  2478. end
  2479. end)
  2480.  
  2481. end
  2482. ----------------------
  2483.  
  2484. local c
  2485. function bind:SetBind(keybind)
  2486. if c then
  2487. c:Disconnect();
  2488. if bind.flag then
  2489. library.flags[bind.flag] = false;
  2490. end
  2491. bind.callback(false);
  2492. end
  2493. local keyName = 'NONE'
  2494. self.bind = (keybind and keybind) or keybind or self.bind
  2495. if self.bind == Enum.KeyCode.Backspace then
  2496. self.bind = 'none';
  2497. bind.state = true
  2498. if bind.flag then
  2499. library.flags[bind.flag] = bind.state;
  2500. end
  2501. self.callback(true)
  2502. local display = bind.state; if bind.invertindicator then display = not bind.state; end
  2503. bind.indicatorValue:SetEnabled(display and not bind.noindicator);
  2504. else
  2505. keyName = keyNames[keybind] or keybind.Name or keybind
  2506. end
  2507. if self.bind ~= 'none' then
  2508. bind.state = false
  2509. if bind.flag then
  2510. library.flags[bind.flag] = bind.state;
  2511. end
  2512. self.callback(false)
  2513. local display = bind.state; if bind.invertindicator then display = not bind.state; end
  2514. bind.indicatorValue:SetEnabled(display and not bind.noindicator);
  2515. end
  2516. self.keycallback(self.bind);
  2517. self:SetKeyText(keyName:upper());
  2518. self.indicatorValue:SetKey((self.text == nil or self.text == '') and (self.flag == nil and 'unknown' or self.flag) or self.text); -- this is so dumb
  2519. self.indicatorValue:SetValue('['..keyName:upper()..']');
  2520. if self.bind == 'none' then
  2521. self.indicatorValue:SetValue('[Always]');
  2522. end
  2523. self.objects.keyText.ThemeColor = self.objects.holder.Hover and 'Accent' or 'Option Text 3';
  2524. end
  2525.  
  2526. function bind:SetKeyText(str)
  2527. str = tostring(str);
  2528. self.objects.keyText.Text = '['..str..']';
  2529. self.objects.keyText.Position = newUDim2(0, 2, 0, 2);
  2530. self.objects.holder.Size = newUDim2(0,self.objects.keyText.TextBounds.X+2,0,17)
  2531. toggle:UpdateOptions();
  2532. end
  2533.  
  2534. utility:Connection(inputservice.InputBegan, function(inp)
  2535. if inputservice:GetFocusedTextBox() then
  2536. return
  2537. elseif bind.binding then
  2538. local key = (table.find({Enum.UserInputType.MouseButton1, Enum.UserInputType.MouseButton2, Enum.UserInputType.MouseButton3}, inp.UserInputType) and not bind.nomouse) and inp.UserInputType
  2539. bind:SetBind(key or (not table.find(blacklistedKeys, inp.KeyCode)) and inp.KeyCode)
  2540. bind.binding = false
  2541. elseif not bind.binding and self.bind == 'none' then
  2542. bind.state = true
  2543. library.flags[bind.flag] = bind.state
  2544. local display = bind.state; if bind.invertindicator then display = not bind.state; end
  2545. bind.indicatorValue:SetEnabled(display and not bind.noindicator)
  2546. elseif (inp.KeyCode == bind.bind or inp.UserInputType == bind.bind) and not bind.binding then
  2547. if bind.mode == 'toggle' then
  2548. bind.state = not bind.state
  2549. if bind.flag then
  2550. library.flags[bind.flag] = bind.state;
  2551. end
  2552. bind.callback(bind.state)
  2553. local display = bind.state; if bind.invertindicator then display = not bind.state; end
  2554. bind.indicatorValue:SetEnabled(display and not bind.noindicator);
  2555. elseif bind.mode == 'hold' then
  2556. if bind.flag then
  2557. library.flags[bind.flag] = true;
  2558. end
  2559. bind.indicatorValue:SetEnabled((not bind.invertindicator and true or false) and not bind.noindicator);
  2560. c = utility:Connection(runservice.RenderStepped, function()
  2561. if bind.callback then
  2562. bind.callback(true);
  2563. end
  2564. end)
  2565. end
  2566. end
  2567. end)
  2568.  
  2569. utility:Connection(inputservice.InputEnded, function(inp)
  2570. if bind.bind ~= 'none' then
  2571. if inp.KeyCode == bind.bind or inp.UserInputType == bind.bind then
  2572. if c then
  2573. c:Disconnect();
  2574. if bind.flag then
  2575. library.flags[bind.flag] = false;
  2576. end
  2577. if bind.callback then
  2578. bind.callback(false);
  2579. end
  2580. bind.indicatorValue:SetEnabled(bind.invertindicator and true or false);
  2581. end
  2582. end
  2583. end
  2584. end)
  2585.  
  2586. tooltip(bind);
  2587. bind:SetBind(bind.bind);
  2588. self:UpdateOptions();
  2589. return bind
  2590. end
  2591.  
  2592. function toggle:AddSlider(data)
  2593. local slider = {
  2594. class = 'slider';
  2595. flag = data.flag;
  2596. suffix = '';
  2597. tooltip = '';
  2598. order = #self.options+1;
  2599. value = 0;
  2600. min = 0;
  2601. max = 100;
  2602. increment = 1;
  2603. callback = function() end;
  2604. enabled = true;
  2605. dragging = false;
  2606. focused = false;
  2607. objects = {};
  2608. };
  2609.  
  2610. local blacklist = {'objects', 'dragging'};
  2611. for i,v in next, data do
  2612. if not table.find(blacklist, i) and (slider[i] ~= nil and typeof(slider[i]) == typeof(v)) then
  2613. slider[i] = v;
  2614. end
  2615. end
  2616.  
  2617. table.insert(self.options, slider)
  2618.  
  2619. if slider.flag then
  2620. library.flags[slider.flag] = slider.value;
  2621. library.options[slider.flag] = slider;
  2622. end
  2623.  
  2624. --- Create Objects ---
  2625. do
  2626. local objs = slider.objects;
  2627. local z = library.zindexOrder.window+25;
  2628.  
  2629. objs.holder = utility:Draw('Square', {
  2630. Size = newUDim2(1,0,0,20);
  2631. Transparency = 0;
  2632. ZIndex = z+6;
  2633. Parent = toggle.objects.holder;
  2634. })
  2635.  
  2636. objs.background = utility:Draw('Square', {
  2637. Size = newUDim2(1,-4,1,-8);
  2638. Position = newUDim2(0,2,0,4);
  2639. ThemeColor = 'Option Background';
  2640. ZIndex = z+2;
  2641. Parent = objs.holder;
  2642. })
  2643.  
  2644. objs.slider = utility:Draw('Square', {
  2645. Size = newUDim2(0,0,1,0);
  2646. ThemeColor = 'Accent';
  2647. ZIndex = z+3;
  2648. Parent = objs.background;
  2649. })
  2650.  
  2651. objs.border1 = utility:Draw('Square', {
  2652. Size = newUDim2(1,2,1,2);
  2653. Position = newUDim2(0,-1,0,-1);
  2654. ThemeColor = 'Option Border 1';
  2655. ZIndex = z+1;
  2656. Parent = objs.background;
  2657. })
  2658.  
  2659. objs.border2 = utility:Draw('Square', {
  2660. Size = newUDim2(1,2,1,2);
  2661. Position = newUDim2(0,-1,0,-1);
  2662. ThemeColor = 'Option Border 2';
  2663. ZIndex = z;
  2664. Parent = objs.border1;
  2665. })
  2666.  
  2667. objs.gradient = utility:Draw('Image', {
  2668. Size = newUDim2(1,0,1,0);
  2669. Data = library.images.gradientp90;
  2670. Transparency = .65;
  2671. ZIndex = z+4;
  2672. Parent = objs.background;
  2673. })
  2674.  
  2675. objs.text = utility:Draw('Text', {
  2676. Position = newUDim2(.5,0,0,-1);
  2677. ThemeColor = 'Option Text 3';
  2678. Size = 13;
  2679. Font = 2;
  2680. ZIndex = z+5;
  2681. Outline = true;
  2682. Center = true;
  2683. Parent = objs.background;
  2684. })
  2685.  
  2686. utility:Connection(objs.holder.MouseEnter, function()
  2687. objs.border1.ThemeColor = 'Accent';
  2688. end)
  2689.  
  2690. utility:Connection(objs.holder.MouseLeave, function()
  2691. objs.border1.ThemeColor = slider.dragging and 'Accent' or 'Option Border 1';
  2692. end)
  2693.  
  2694. local c;
  2695. local inputNumber = '';
  2696. utility:Connection(slider.objects.holder.MouseButton1Down, function()
  2697. if inputservice:IsKeyDown(Enum.KeyCode.LeftControl) then
  2698. if slider.focused then
  2699. slider.focused = false;
  2700. c:Disconnect();
  2701. else
  2702. objs.text.Text = tostring(slider.value)..tostring(slider.suffix)..'/'..tostring(slider.max)..tostring(slider.suffix)..' []';
  2703. slider.focused = true;
  2704. inputNumber = '';
  2705. c = utility:Connection(inputservice.InputBegan, function(inp)
  2706. if library.numberStrings[inp.KeyCode.Name] then
  2707. local number = library.numberStrings[inp.KeyCode.Name];
  2708. inputNumber = inputNumber..tostring(number);
  2709. objs.text.Text = string.format("%.14g", slider.value) .. tostring(slider.suffix) .. "/" .. slider.max .. tostring(slider.suffix) .. " [" .. inputNumber .. "]";
  2710. elseif inp.KeyCode == Enum.KeyCode.Backspace then
  2711. inputNumber = inputNumber:sub(1,-2);
  2712. objs.text.Text = string.format("%.14g", slider.value)..tostring(slider.suffix)..'/'..slider.max..tostring(slider.suffix)..' ['..inputNumber..']';
  2713. elseif inp.KeyCode == Enum.KeyCode.Return then
  2714. slider:SetValue(tonumber(inputNumber))
  2715. slider.focused = false;
  2716. c:Disconnect();
  2717. elseif inp.KeyCode == Enum.KeyCode.Escape then
  2718. slider:SetValue(slider.value, true)
  2719. slider.focused = false;
  2720. c:Disconnect();
  2721. end
  2722. end)
  2723. end
  2724. else
  2725. slider.dragging = true;
  2726. library.draggingSlider = slider;
  2727. end
  2728. end)
  2729.  
  2730. utility:Connection(button1up, function()
  2731. objs.border1.ThemeColor = objs.holder.Hover and 'Accent' or 'Option Border 1';
  2732. slider.dragging = false;
  2733. library.draggingSlider = nil;
  2734. end)
  2735.  
  2736. end
  2737. ----------------------
  2738.  
  2739. function slider:SetValue(value, nocallback)
  2740. if typeof(value) == 'number' then
  2741. local newValue = clamp(self.increment * floor(value/self.increment), self.min, self.max);
  2742. local size, pos = self.objects.slider.Size, self.objects.slider.Position;
  2743.  
  2744. if self.min >= 0 then
  2745. size = newUDim2((newValue - self.min) / (self.max - self.min), 0, 1, 0);
  2746. else
  2747. size = newUDim2(newValue / (self.max - self.min), 0, 1, 0);
  2748. pos = newUDim2((0 - self.min) / (self.max - self.min), 0, 0, 0);
  2749. end
  2750.  
  2751. utility:Tween(self.objects.slider, 'Size', size, .05, Enum.EasingDirection.Out, Enum.EasingStyle.Quad);
  2752. utility:Tween(self.objects.slider, 'Position', pos, .05, Enum.EasingDirection.Out, Enum.EasingStyle.Quad);
  2753.  
  2754. self.value = newValue;
  2755. library.flags[self.flag] = newValue;
  2756. self.objects.text.Text = string.format("%.14g",newValue)..tostring(self.suffix)..'/'..self.max..tostring(self.suffix);
  2757. self.objects.text.ThemeColor = (self.min < 0 and newValue == 0 or newValue == self.min) and (self.risky and 'Risky Text' or 'Option Text 3') or (self.risky and 'Risky Text Enabled' or 'Option Text 1');
  2758.  
  2759. if not nocallback then
  2760. self.callback(newValue);
  2761. end
  2762.  
  2763. end
  2764. end
  2765.  
  2766. tooltip(slider);
  2767. slider:SetValue(slider.value, true);
  2768. self:UpdateOptions();
  2769. return slider
  2770. end
  2771.  
  2772. function toggle:AddList(data)
  2773. local list = {
  2774. class = 'list';
  2775. flag = data.flag;
  2776. text = '';
  2777. selected = '';
  2778. tooltip = '';
  2779. order = #self.options+1;
  2780. callback = function() end;
  2781. enabled = true;
  2782. multi = false;
  2783. open = false;
  2784. values = {};
  2785. objects = {};
  2786. }
  2787.  
  2788. table.insert(self.options, list);
  2789.  
  2790. local blacklist = {'objects'};
  2791. for i,v in next, data do
  2792. if not table.find(blacklist, i) ~= list[i] ~= nil then
  2793. list[i] = v
  2794. end
  2795. end
  2796.  
  2797. if list.flag then
  2798. library.flags[list.flag] = list.selected;
  2799. library.options[list.flag] = list;
  2800. end
  2801.  
  2802. -- Create Objects --
  2803. do
  2804. local objs = list.objects;
  2805. local z = library.zindexOrder.window+25;
  2806.  
  2807. objs.holder = utility:Draw('Square', {
  2808. Size = newUDim2(1,0,0,22);
  2809. Transparency = 0;
  2810. ZIndex = z+6;
  2811. Parent = toggle.objects.holder;
  2812. })
  2813.  
  2814. objs.background = utility:Draw('Square', {
  2815. Size = newUDim2(1,-4,1,-8);
  2816. Position = newUDim2(0,2,0,4);
  2817. ThemeColor = 'Option Background';
  2818. ZIndex = z+2;
  2819. Parent = objs.holder;
  2820. })
  2821.  
  2822. objs.border1 = utility:Draw('Square', {
  2823. Size = newUDim2(1,2,1,2);
  2824. Position = newUDim2(0,-1,0,-1);
  2825. ThemeColor = 'Option Border 1';
  2826. ZIndex = z+1;
  2827. Parent = objs.background;
  2828. })
  2829.  
  2830. objs.border2 = utility:Draw('Square', {
  2831. Size = newUDim2(1,2,1,2);
  2832. Position = newUDim2(0,-1,0,-1);
  2833. ThemeColor = 'Option Border 2';
  2834. ZIndex = z;
  2835. Parent = objs.border1;
  2836. })
  2837.  
  2838. objs.gradient = utility:Draw('Image', {
  2839. Size = newUDim2(1,0,1,0);
  2840. Data = library.images.gradientp90;
  2841. Transparency = .65;
  2842. ZIndex = z+4;
  2843. Parent = objs.background;
  2844. })
  2845.  
  2846. objs.inputText = utility:Draw('Text', {
  2847. Position = newUDim2(0,4,0,0);
  2848. ThemeColor = 'Option Text 2';
  2849. Text = 'none',
  2850. Size = 13;
  2851. Font = 2;
  2852. ZIndex = z+5;
  2853. Outline = true;
  2854. Parent = objs.background;
  2855. })
  2856.  
  2857. objs.openText = utility:Draw('Text', {
  2858. Position = newUDim2(1,-10,0,0);
  2859. ThemeColor = 'Option Text 3';
  2860. Text = '+';
  2861. Size = 13;
  2862. Font = 2;
  2863. ZIndex = z+5;
  2864. Outline = true;
  2865. Parent = objs.background;
  2866. })
  2867.  
  2868. utility:Connection(objs.holder.MouseEnter, function()
  2869. objs.border1.ThemeColor = 'Accent';
  2870. end)
  2871.  
  2872. utility:Connection(objs.holder.MouseLeave, function()
  2873. objs.border1.ThemeColor = 'Option Border 1';
  2874. end)
  2875.  
  2876. utility:Connection(objs.holder.MouseButton1Down, function()
  2877. if list.open then
  2878. list.open = false;
  2879. objs.openText.Text = '+';
  2880. if window.dropdown.selected == list then
  2881. window.dropdown.selected = nil;
  2882. window.dropdown.objects.background.Visible = false;
  2883. end
  2884. else
  2885. if window.dropdown.selected ~= nil then
  2886. window.dropdown.selected.open = false
  2887. end
  2888. list.open = true;
  2889. objs.openText.Text = '-';
  2890. window.dropdown.selected = list;
  2891. window.dropdown.objects.background.Visible = true;
  2892. window.dropdown.objects.background.Parent = objs.holder;
  2893. window.dropdown:Refresh();
  2894. end
  2895. end)
  2896.  
  2897.  
  2898. end
  2899. --------------------
  2900.  
  2901. function list:Select(option, nocallback)
  2902. option = typeof(option) == 'table' and (self.multi == true and option or (#option == 0 and nil or option[1])) or self.multi == true and {option} or option;
  2903. if option ~= nil then
  2904. self.selected = option;
  2905. local text = typeof(option) == 'table' and (#option == 0 and "none" or table.concat(option, ', ')) or tostring(option);
  2906. local label = self.objects.inputText
  2907. label.Text = text;
  2908. if label.TextBounds.X > self.objects.background.Object.Size.X - 10 then
  2909. local split = text:split('');
  2910. for i = 1,#split do
  2911. label.Text = table.concat(split, '', 1, i)
  2912. if label.TextBounds.X > self.objects.background.Object.Size.X - 10 then
  2913. label.Text = label.Text:sub(1,-6)..'...';
  2914. break
  2915. end
  2916. end
  2917. end
  2918. if self.flag then
  2919. library.flags[self.flag] = self.selected
  2920. end
  2921. if not nocallback then
  2922. self.callback(self.selected);
  2923. end
  2924. end
  2925. end
  2926.  
  2927. function list:AddValue(value)
  2928. table.insert(list.values, tostring(value));
  2929. if window.dropdown.selected == list then
  2930. window.dropdown:Refresh()
  2931. end
  2932. end
  2933.  
  2934. function list:RemoveValue(value)
  2935. if table.find(list.values, value) then
  2936. table.remove(list.values, table.find(list.values, value));
  2937. if window.dropdown.selected == list then
  2938. window.dropdown:Refresh()
  2939. end
  2940. end
  2941. end
  2942.  
  2943. function list:ClearValues()
  2944. table.clear(list.values);
  2945. if window.dropdown.selected == list then
  2946. window.dropdown:Refresh()
  2947. end
  2948. end
  2949.  
  2950. tooltip(list);
  2951. list:Select((data.value or data.selected) or (list.multi and 'none' or list.values[1]), true);
  2952. self:UpdateOptions();
  2953. return list
  2954. end
  2955.  
  2956. tooltip(toggle);
  2957. toggle:SetText(toggle.text);
  2958. toggle:SetState(toggle.state, true);
  2959. self:UpdateOptions();
  2960. return toggle
  2961. end
  2962.  
  2963. -- // Slider
  2964. function section:AddSlider(data)
  2965. local slider = {
  2966. class = 'slider';
  2967. flag = data.flag;
  2968. text = '';
  2969. tooltip = '';
  2970. suffix = '';
  2971. order = #self.options+1;
  2972. value = 0;
  2973. min = 0;
  2974. max = 100;
  2975. increment = 1;
  2976. callback = function() end;
  2977. enabled = true;
  2978. dragging = false;
  2979. focused = false;
  2980. risky = false;
  2981. objects = {};
  2982. };
  2983.  
  2984. local blacklist = {'objects', 'dragging'};
  2985. for i,v in next, data do
  2986. if not table.find(blacklist, i) and (slider[i] ~= nil and typeof(slider[i]) == typeof(v)) then
  2987. slider[i] = v;
  2988. end
  2989. end
  2990.  
  2991. table.insert(self.options, slider)
  2992.  
  2993. if slider.flag then
  2994. library.flags[slider.flag] = slider.value;
  2995. library.options[slider.flag] = slider;
  2996. end
  2997.  
  2998. --- Create Objects ---
  2999. do
  3000. local objs = slider.objects;
  3001. local z = library.zindexOrder.window+25;
  3002.  
  3003. objs.holder = utility:Draw('Square', {
  3004. Size = newUDim2(1,0,0,32);
  3005. Transparency = 0;
  3006. ZIndex = z+4;
  3007. Parent = section.objects.optionholder;
  3008. })
  3009.  
  3010. objs.background = utility:Draw('Square', {
  3011. Size = newUDim2(1,-4,0,11);
  3012. Position = newUDim2(0,2,1,-14);
  3013. ThemeColor = 'Option Background';
  3014. ZIndex = z+2;
  3015. Parent = objs.holder;
  3016. })
  3017.  
  3018. objs.slider = utility:Draw('Square', {
  3019. Size = newUDim2(0,0,1,0);
  3020. ThemeColor = 'Accent';
  3021. ZIndex = z+3;
  3022. Parent = objs.background;
  3023. })
  3024.  
  3025. objs.border1 = utility:Draw('Square', {
  3026. Size = newUDim2(1,2,1,2);
  3027. Position = newUDim2(0,-1,0,-1);
  3028. ThemeColor = 'Option Border 1';
  3029. ZIndex = z+1;
  3030. Parent = objs.background;
  3031. })
  3032.  
  3033. objs.border2 = utility:Draw('Square', {
  3034. Size = newUDim2(1,2,1,2);
  3035. Position = newUDim2(0,-1,0,-1);
  3036. ThemeColor = 'Option Border 2';
  3037. ZIndex = z;
  3038. Parent = objs.border1;
  3039. })
  3040.  
  3041. objs.gradient = utility:Draw('Image', {
  3042. Size = newUDim2(1,0,1,0);
  3043. Data = library.images.gradientp90;
  3044. Transparency = .65;
  3045. ZIndex = z+4;
  3046. Parent = objs.background;
  3047. })
  3048.  
  3049. objs.text = utility:Draw('Text', {
  3050. Position = newUDim2(0,2,0,1);
  3051. ThemeColor = 'Option Text 3';
  3052. Size = 13;
  3053. Font = 2;
  3054. ZIndex = z+1;
  3055. Outline = true;
  3056. Parent = objs.holder;
  3057. })
  3058.  
  3059. objs.plusDetector = utility:Draw('Square', {
  3060. Size = newUDim2(0,14,0,14);
  3061. Position = newUDim2(1,-28,0,1);
  3062. Transparency = 0;
  3063. ZIndex = z+5;
  3064. Parent = objs.holder;
  3065. })
  3066.  
  3067. objs.minusDetector = utility:Draw('Square', {
  3068. Size = newUDim2(0,14,0,14);
  3069. Position = newUDim2(1,-14,0,1);
  3070. Transparency = 0;
  3071. ZIndex = z+5;
  3072. Parent = objs.holder;
  3073. })
  3074.  
  3075. objs.plusText = utility:Draw('Text', {
  3076. Position = newUDim2(.5,0,0,-1);
  3077. ThemeColor = 'Option Text 3';
  3078. Text = '+';
  3079. Size = 13;
  3080. Font = 2;
  3081. ZIndex = z+4;
  3082. Center = true;
  3083. Outline = true;
  3084. Parent = objs.plusDetector;
  3085. })
  3086.  
  3087. objs.minusText = utility:Draw('Text', {
  3088. Position = newUDim2(.5,0,0,-1);
  3089. ThemeColor = 'Option Text 3';
  3090. Text = '-';
  3091. Size = 13;
  3092. Font = 2;
  3093. ZIndex = z+4;
  3094. Center = true;
  3095. Outline = true;
  3096. Parent = objs.minusDetector;
  3097. })
  3098.  
  3099. utility:Connection(objs.holder.MouseEnter, function()
  3100. objs.border1.ThemeColor = 'Accent';
  3101. end)
  3102.  
  3103. utility:Connection(objs.holder.MouseLeave, function()
  3104. objs.border1.ThemeColor = slider.dragging and 'Accent' or 'Option Border 1';
  3105. end)
  3106.  
  3107. utility:Connection(slider.objects.plusDetector.MouseButton1Down,function()
  3108. slider:SetValue(slider.value + (inputservice:IsKeyDown(Enum.KeyCode.LeftShift) and 10 or slider.increment))
  3109. end)
  3110.  
  3111. utility:Connection(slider.objects.minusDetector.MouseButton1Down,function()
  3112. slider:SetValue(slider.value - (inputservice:IsKeyDown(Enum.KeyCode.LeftShift) and 10 or slider.increment))
  3113. end)
  3114.  
  3115.  
  3116. local c;
  3117. local inputNumber = '';
  3118. utility:Connection(slider.objects.holder.MouseButton1Down, function()
  3119. if inputservice:IsKeyDown(Enum.KeyCode.LeftControl) then
  3120. if slider.focused then
  3121. slider.focused = false;
  3122. c:Disconnect();
  3123. else
  3124. objs.text.Text = slider.text..': '..tostring(slider.value)..tostring(slider.suffix)..' []';
  3125. slider.focused = true;
  3126. inputNumber = '';
  3127. c = utility:Connection(inputservice.InputBegan, function(inp)
  3128. if library.numberStrings[inp.KeyCode.Name] then
  3129. local number = library.numberStrings[inp.KeyCode.Name];
  3130. inputNumber = inputNumber..tostring(number);
  3131. objs.text.Text = slider.text..': '..string.format("%.14g",slider.value)..tostring(slider.suffix)..' ['..inputNumber..']';
  3132. elseif inp.KeyCode == Enum.KeyCode.Backspace then
  3133. inputNumber = inputNumber:sub(1,-2);
  3134. objs.text.Text = slider.text..': '..string.format("%.14g",slider.value)..tostring(slider.suffix)..' ['..inputNumber..']';
  3135. elseif inp.KeyCode == Enum.KeyCode.Return then
  3136. slider:SetValue(tonumber(inputNumber))
  3137. slider.focused = false;
  3138. c:Disconnect();
  3139. elseif inp.KeyCode == Enum.KeyCode.Escape then
  3140. slider:SetValue(slider.value, true)
  3141. slider.focused = false;
  3142. c:Disconnect();
  3143. end
  3144. end)
  3145.  
  3146. end
  3147.  
  3148.  
  3149. else
  3150. slider.dragging = true;
  3151. library.draggingSlider = slider;
  3152. end
  3153. end)
  3154.  
  3155. utility:Connection(button1up, function()
  3156. objs.border1.ThemeColor = objs.holder.Hover and 'Accent' or 'Option Border 1';
  3157. slider.dragging = false;
  3158. library.draggingSlider = nil;
  3159. end)
  3160.  
  3161. end
  3162. ----------------------
  3163.  
  3164. function slider:SetValue(value, nocallback)
  3165. if typeof(value) == 'number' then
  3166. local newValue = clamp(self.increment * floor(value/self.increment), self.min, self.max);
  3167. local size, pos = self.objects.slider.Size, self.objects.slider.Position;
  3168.  
  3169. if self.min >= 0 then
  3170. size = newUDim2((newValue - self.min) / (self.max - self.min), 0, 1, 0);
  3171. else
  3172. size = newUDim2(newValue / (self.max - self.min), 0, 1, 0);
  3173. pos = newUDim2((0 - self.min) / (self.max - self.min), 0, 0, 0);
  3174. end
  3175.  
  3176. utility:Tween(self.objects.slider, 'Size', size, .05, Enum.EasingDirection.Out, Enum.EasingStyle.Quad);
  3177. utility:Tween(self.objects.slider, 'Position', pos, .05, Enum.EasingDirection.Out, Enum.EasingStyle.Quad);
  3178.  
  3179. self.value = newValue;
  3180. library.flags[self.flag] = newValue;
  3181. self.objects.text.Text = slider.text..': '..string.format("%.14g",newValue)..tostring(self.suffix);
  3182. self.objects.text.ThemeColor = (self.min < 0 and newValue == 0 or newValue == self.min) and (self.risky and 'Risky Text' or 'Option Text 3') or (self.risky and 'Risky Text Enabled' or 'Option Text 1');
  3183.  
  3184. if not nocallback then
  3185. self.callback(newValue);
  3186. end
  3187.  
  3188. end
  3189. end
  3190.  
  3191. function slider:SetText(str)
  3192. if typeof(str) == 'string' then
  3193. self.text = str;
  3194. self.objects.text.Text = str..': '..tostring(self.value)..tostring(self.suffix);
  3195. end
  3196. end
  3197.  
  3198. tooltip(slider);
  3199. slider:SetText(slider.text);
  3200. slider:SetValue(slider.value, true);
  3201. self:UpdateOptions();
  3202. return slider
  3203. end
  3204.  
  3205. -- // Button
  3206. function section:AddButton(data)
  3207. local button = {
  3208. class = 'button';
  3209. flag = data.flag;
  3210. text = '';
  3211. suffix = '';
  3212. tooltip = '';
  3213. order = #self.options+1;
  3214. callback = function() end;
  3215. confirm = false;
  3216. enabled = true;
  3217. risky = false;
  3218. objects = {};
  3219. subbuttons = {};
  3220. };
  3221.  
  3222. local blacklist = {'objects'};
  3223. for i,v in next, data do
  3224. if not table.find(blacklist, i) and button[i] ~= nil then
  3225. button[i] = v;
  3226. end
  3227. end
  3228.  
  3229. table.insert(self.options, button)
  3230.  
  3231. if button.flag then
  3232. library.options[button.flag] = button;
  3233. end
  3234.  
  3235. --- Create Objects ---
  3236. do
  3237. local objs = button.objects;
  3238. local z = library.zindexOrder.window+25;
  3239.  
  3240. objs.holder = utility:Draw('Square', {
  3241. Size = newUDim2(1,0,0,22);
  3242. Transparency = 0;
  3243. ZIndex = z+4;
  3244. Parent = section.objects.optionholder;
  3245. })
  3246.  
  3247. objs.background = utility:Draw('Square', {
  3248. Size = newUDim2(1,-4,0,14);
  3249. Position = newUDim2(0,2,0,4);
  3250. ThemeColor = 'Option Background';
  3251. ZIndex = z+2;
  3252. Parent = objs.holder;
  3253. })
  3254.  
  3255. objs.border1 = utility:Draw('Square', {
  3256. Size = newUDim2(1,2,1,2);
  3257. Position = newUDim2(0,-1,0,-1);
  3258. ThemeColor = 'Option Border 1';
  3259. ZIndex = z+1;
  3260. Parent = objs.background;
  3261. })
  3262.  
  3263. objs.border2 = utility:Draw('Square', {
  3264. Size = newUDim2(1,2,1,2);
  3265. Position = newUDim2(0,-1,0,-1);
  3266. ThemeColor = 'Option Border 2';
  3267. ZIndex = z;
  3268. Parent = objs.border1;
  3269. })
  3270.  
  3271. objs.gradient = utility:Draw('Image', {
  3272. Size = newUDim2(1,0,1,0);
  3273. Data = library.images.gradientp90;
  3274. Transparency = .65;
  3275. ZIndex = z+3;
  3276. Parent = objs.background;
  3277. })
  3278.  
  3279. objs.text = utility:Draw('Text', {
  3280. Position = newUDim2(.5,0,0,0);
  3281. ThemeColor = 'Option Text 3';
  3282. Size = 13;
  3283. Font = 2;
  3284. ZIndex = z+4;
  3285. Outline = true;
  3286. Center = true;
  3287. Parent = objs.background;
  3288. })
  3289.  
  3290. utility:Connection(objs.holder.MouseEnter, function()
  3291. objs.border1.ThemeColor = 'Accent';
  3292. end)
  3293.  
  3294. utility:Connection(objs.holder.MouseLeave, function()
  3295. objs.border1.ThemeColor = 'Option Border 1';
  3296. objs.text.ThemeColor = self.risky and 'Risky Text' or 'Option Text 3';
  3297. objs.background.ThemeColor = 'Option Background';
  3298. objs.background.ThemeColorOffset = 0;
  3299. end)
  3300.  
  3301. utility:Connection(objs.holder.MouseButton1Up, function()
  3302. objs.text.ThemeColor = self.risky and 'Risky Text' or 'Option Text 3';
  3303. objs.background.ThemeColor = 'Option Background';
  3304. objs.background.ThemeColorOffset = 0;
  3305. end)
  3306.  
  3307. local clicked, counting = false, false
  3308. utility:Connection(objs.holder.MouseButton1Down, function()
  3309. objs.text.ThemeColor = self.risky and 'Risky Text Enabled' or 'Option Text 2';
  3310. objs.background.ThemeColor = 'Accent';
  3311. objs.background.ThemeColorOffset = -95;
  3312.  
  3313. task.spawn(function() -- this is ugly and i do not care :)
  3314. if button.confirm then
  3315. if clicked then
  3316. clicked = false
  3317. counting = false
  3318. objs.text.Text = button.text
  3319. button.callback()
  3320. else
  3321. clicked = true
  3322. counting = true
  3323. for i = 3,1,-1 do
  3324. if not counting then
  3325. break
  3326. end
  3327. objs.text.Text = 'Confirm '..button.text..'? '..tostring(i)
  3328. wait(1)
  3329. end
  3330. clicked = false
  3331. counting = false
  3332. objs.text.Text = button.text
  3333. end
  3334. else
  3335. button.callback()
  3336. end
  3337. end)
  3338.  
  3339. end)
  3340.  
  3341. end
  3342. ----------------------
  3343. function button:AddButton(data)
  3344. local button = {
  3345. class = 'button';
  3346. flag = data.flag;
  3347. text = '';
  3348. suffix = '';
  3349. tooltip = '';
  3350. order = #self.subbuttons+1;
  3351. callback = function() end;
  3352. confirm = false;
  3353. enabled = true;
  3354. objects = {};
  3355. };
  3356.  
  3357. local blacklist = {'objects'};
  3358. for i,v in next, data do
  3359. if not table.find(blacklist, i) and button[i] ~= nil then
  3360. button[i] = v;
  3361. end
  3362. end
  3363.  
  3364. table.insert(self.subbuttons, button)
  3365.  
  3366. if button.flag then
  3367. library.options[button.flag] = button;
  3368. end
  3369.  
  3370. --- Create Objects ---
  3371. do
  3372. local objs = button.objects;
  3373. local z = library.zindexOrder.window+25;
  3374.  
  3375. objs.holder = utility:Draw('Square', {
  3376. Size = newUDim2(1,0,1,0);
  3377. Transparency = 0;
  3378. ZIndex = z+5;
  3379. Parent = self.objects.holder;
  3380. })
  3381.  
  3382. objs.background = utility:Draw('Square', {
  3383. Size = newUDim2(1,-4,1,-8);
  3384. Position = newUDim2(0,2,0,4);
  3385. ThemeColor = 'Option Background';
  3386. ZIndex = z+2;
  3387. Parent = objs.holder;
  3388. })
  3389.  
  3390. objs.border1 = utility:Draw('Square', {
  3391. Size = newUDim2(1,2,1,2);
  3392. Position = newUDim2(0,-1,0,-1);
  3393. ThemeColor = 'Option Border 1';
  3394. ZIndex = z+1;
  3395. Parent = objs.background;
  3396. })
  3397.  
  3398. objs.border2 = utility:Draw('Square', {
  3399. Size = newUDim2(1,2,1,2);
  3400. Position = newUDim2(0,-1,0,-1);
  3401. ThemeColor = 'Option Border 2';
  3402. ZIndex = z;
  3403. Parent = objs.border1;
  3404. })
  3405.  
  3406. objs.gradient = utility:Draw('Image', {
  3407. Size = newUDim2(1,0,1,0);
  3408. Data = library.images.gradientp90;
  3409. Transparency = .65;
  3410. ZIndex = z+3;
  3411. Parent = objs.background;
  3412. })
  3413.  
  3414. objs.text = utility:Draw('Text', {
  3415. Position = newUDim2(.5,0,0,0);
  3416. ThemeColor = 'Option Text 3';
  3417. Size = 13;
  3418. Font = 2;
  3419. ZIndex = z+4;
  3420. Outline = true;
  3421. Center = true;
  3422. Parent = objs.background;
  3423. })
  3424.  
  3425. utility:Connection(objs.holder.MouseEnter, function()
  3426. objs.border1.ThemeColor = 'Accent';
  3427. end)
  3428.  
  3429. utility:Connection(objs.holder.MouseLeave, function()
  3430. objs.border1.ThemeColor = 'Option Border 1';
  3431. objs.text.ThemeColor = self.risky and 'Risky Text' or 'Option Text 3';
  3432. objs.background.ThemeColor = 'Option Background';
  3433. objs.background.ThemeColorOffset = 0;
  3434. end)
  3435.  
  3436. utility:Connection(objs.holder.MouseButton1Up, function()
  3437. objs.text.ThemeColor = self.risky and 'Risky Text' or 'Option Text 3';
  3438. objs.background.ThemeColor = 'Option Background';
  3439. objs.background.ThemeColorOffset = 0;
  3440. end)
  3441.  
  3442. local clicked, counting = false, false
  3443. utility:Connection(objs.holder.MouseButton1Down, function()
  3444. objs.text.ThemeColor = self.risky and 'Risky Text Enabled' or 'Option Text 2';
  3445. objs.background.ThemeColor = 'Accent';
  3446. objs.background.ThemeColorOffset = -95;
  3447.  
  3448. task.spawn(function() -- this is ugly and i do not care :)
  3449. if button.confirm then
  3450. if clicked then
  3451. clicked = false
  3452. counting = false
  3453. objs.text.Text = button.text
  3454. button.callback()
  3455. else
  3456. clicked = true
  3457. counting = true
  3458. for i = 3,1,-1 do
  3459. if not counting then
  3460. break
  3461. end
  3462. objs.text.Text = 'Confirm '..button.text..'? '..tostring(i)
  3463. wait(1)
  3464. end
  3465. clicked = false
  3466. counting = false
  3467. objs.text.Text = button.text
  3468. end
  3469. else
  3470. button.callback()
  3471. end
  3472. end)
  3473.  
  3474. end)
  3475.  
  3476. end
  3477. ----------------------
  3478.  
  3479. function button:SetText(str)
  3480. if typeof(str) == 'string' then
  3481. self.text = str;
  3482. self.objects.text.Text = str;
  3483. end
  3484. end
  3485.  
  3486. tooltip(button);
  3487. button:SetText(button.text);
  3488. self:UpdateOptions();
  3489. return button
  3490. end
  3491. ----------------------
  3492.  
  3493. function button:UpdateOptions() -- this so dumb XD
  3494. local buttons = 1 + #self.subbuttons;
  3495. local buttonSize = (1 / buttons) - .005;
  3496. self.objects.background.Size = newUDim2(buttonSize,-4,0,14);
  3497. for i,v in next, self.subbuttons do
  3498. v.objects.holder.Size = newUDim2(buttonSize,0,1,0);
  3499. v.objects.holder.Position = newUDim2(i * buttonSize + .01, 0, 0, 0)
  3500. end
  3501. end
  3502.  
  3503. function button:SetText(str)
  3504. if typeof(str) == 'string' then
  3505. self.text = str;
  3506. self.objects.text.Text = str;
  3507. end
  3508. end
  3509.  
  3510. tooltip(button);
  3511. button:SetText(button.text);
  3512. self:UpdateOptions();
  3513. return button
  3514. end
  3515.  
  3516. -- // Separator
  3517. function section:AddSeparator(data)
  3518. local separator = {
  3519. class = 'separator';
  3520. flag = data.flag;
  3521. text = '';
  3522. order = #self.options+1;
  3523. enabled = true;
  3524. objects = {};
  3525. };
  3526.  
  3527. local blacklist = {'objects', 'dragging'};
  3528. for i,v in next, data do
  3529. if not table.find(blacklist, i) and (separator[i] ~= nil and typeof(separator[i]) == typeof(v)) then
  3530. separator[i] = v;
  3531. end
  3532. end
  3533.  
  3534. table.insert(self.options, separator)
  3535.  
  3536. --- Create Objects ---
  3537. do
  3538. local objs = separator.objects;
  3539. local z = library.zindexOrder.window+25;
  3540.  
  3541. objs.holder = utility:Draw('Square', {
  3542. Size = newUDim2(1,0,0,18);
  3543. Transparency = 0;
  3544. ZIndex = z;
  3545. Parent = section.objects.optionholder;
  3546. })
  3547.  
  3548. objs.line1 = utility:Draw('Square', {
  3549. Position = newUDim2(0,0,0,1);
  3550. ThemeColor = 'Option Background';
  3551. ZIndex = z+1;
  3552. Parent = objs.holder;
  3553. })
  3554.  
  3555. objs.line2 = utility:Draw('Square', {
  3556. Position = newUDim2(0,0,0,1);
  3557. ThemeColor = 'Option Background';
  3558. ZIndex = z+1;
  3559. Parent = objs.holder;
  3560. })
  3561.  
  3562. objs.border1 = utility:Draw('Square', {
  3563. Size = newUDim2(1,2,1,2);
  3564. Position = newUDim2(0,-1,0,-1);
  3565. ThemeColor = 'Option Border 2';
  3566. ZIndex = z;
  3567. Parent = objs.line1;
  3568. })
  3569.  
  3570. objs.border2 = utility:Draw('Square', {
  3571. Size = newUDim2(1,2,1,2);
  3572. Position = newUDim2(0,-1,0,-1);
  3573. ThemeColor = 'Option Border 2';
  3574. ZIndex = z;
  3575. Parent = objs.line2;
  3576. })
  3577.  
  3578. objs.text = utility:Draw('Text', {
  3579. Position = newUDim2(.5,0,0,1);
  3580. ThemeColor = 'Option Text 2';
  3581. Size = 13;
  3582. Font = 2;
  3583. ZIndex = z;
  3584. Outline = true;
  3585. Center = true;
  3586. Parent = objs.holder;
  3587. })
  3588.  
  3589. end
  3590. ----------------------
  3591.  
  3592. function separator:SetText(str)
  3593. if typeof(str) == 'string' then
  3594. self.text = str;
  3595. self.objects.text.Text = str;
  3596. local xScale = ( 1- utility:ConvertNumberRange(self.objects.text.TextBounds.X, 0, self.objects.holder.Object.Size.X, 0, 1)) / 2 - (str == '' and 0 or .04)
  3597. self.objects.line1.Size = newUDim2(xScale, 0, 0, 1)
  3598. self.objects.line2.Size = newUDim2(xScale, 0, 0, 1)
  3599. self.objects.line1.Position = newUDim2(0,1,.5,-1)
  3600. self.objects.line2.Position = newUDim2(1 - self.objects.line2.Size.X.Scale,-1,.5,-1)
  3601. end
  3602. end
  3603.  
  3604. separator:SetText(separator.text);
  3605. self:UpdateOptions();
  3606. return separator
  3607. end
  3608.  
  3609. -- // Color Picker
  3610. function section:AddColor(data)
  3611. local color = {
  3612. class = 'color';
  3613. flag = data.flag;
  3614. text = '';
  3615. tooltip = '';
  3616. order = #self.options+1;
  3617. callback = function() end;
  3618. color = Color3.new(1,1,1);
  3619. trans = 0;
  3620. open = false;
  3621. enabled = true;
  3622. risky = false;
  3623. objects = {};
  3624. };
  3625.  
  3626. local blacklist = {'objects'};
  3627. for i,v in next, data do
  3628. if not table.find(blacklist, i) and color[i] ~= nil then
  3629. color[i] = v
  3630. end
  3631. end
  3632.  
  3633. table.insert(self.options, color)
  3634.  
  3635. if color.flag then
  3636. library.flags[color.flag] = color.color;
  3637. library.options[color.flag] = color;
  3638. end
  3639.  
  3640. --- Create Objects ---
  3641. do
  3642. local objs = color.objects;
  3643. local z = library.zindexOrder.window+25;
  3644.  
  3645. objs.holder = utility:Draw('Square', {
  3646. Size = newUDim2(1,0,0,19);
  3647. Transparency = 0;
  3648. ZIndex = z+5;
  3649. Parent = section.objects.optionholder;
  3650. })
  3651.  
  3652. objs.background = utility:Draw('Square', {
  3653. Size = newUDim2(0,15,0,8);
  3654. Position = newUDim2(1,-16,0,5);
  3655. ZIndex = z+3;
  3656. Parent = objs.holder;
  3657. })
  3658.  
  3659. objs.gradient = utility:Draw('Image', {
  3660. Size = newUDim2(1,0,1,0);
  3661. Data = library.images.gradientp45;
  3662. Transparency = .25;
  3663. ZIndex = z+4;
  3664. Parent = objs.background;
  3665. })
  3666.  
  3667. objs.border1 = utility:Draw('Square', {
  3668. Size = newUDim2(1,2,1,2);
  3669. Position = newUDim2(0,-1,0,-1);
  3670. ThemeColor = 'Option Border 1';
  3671. ZIndex = z+2;
  3672. Parent = objs.background;
  3673. })
  3674.  
  3675. objs.border2 = utility:Draw('Square', {
  3676. Size = newUDim2(1,2,1,2);
  3677. Position = newUDim2(0,-1,0,-1);
  3678. ThemeColor = 'Option Border 2';
  3679. ZIndex = z+1;
  3680. Parent = objs.border1;
  3681. })
  3682.  
  3683. objs.text = utility:Draw('Text', {
  3684. Position = newUDim2(0,2,0,2);
  3685. ThemeColor = color.risky and 'Risky Text Enabled' or 'Option Text 3';
  3686. Size = 13;
  3687. Font = 2;
  3688. ZIndex = z+1;
  3689. Outline = true;
  3690. Parent = objs.holder;
  3691. })
  3692.  
  3693. utility:Connection(objs.holder.MouseEnter, function()
  3694. objs.border1.ThemeColor = 'Accent';
  3695. end)
  3696.  
  3697. utility:Connection(objs.holder.MouseLeave, function()
  3698. objs.border1.ThemeColor = color.state and 'Accent' or 'Option Border 1';
  3699. end)
  3700.  
  3701. utility:Connection(objs.holder.MouseButton1Down, function()
  3702. color:SetOpen(not color.open);
  3703. end)
  3704.  
  3705. end
  3706. ----------------------
  3707.  
  3708. function color:SetText(str)
  3709. if typeof(str) == 'string' then
  3710. self.text = str;
  3711. self.objects.text.Text = str;
  3712. end
  3713. end
  3714.  
  3715. function color:SetColor(c3, nocallback)
  3716. if typeof(c3) == 'Color3' then
  3717. local h,s,v = c3:ToHSV(); c3 = fromhsv(h, clamp(s,.005,.995), clamp(v,.005,.995));
  3718. self.color = c3;
  3719. self.objects.background.Color = c3;
  3720. if not nocallback then
  3721. self.callback(c3, self.trans);
  3722. end
  3723. if self.open then
  3724. window.colorpicker:Visualize(self.color, self.trans);
  3725. end
  3726. if self.flag then
  3727. library.flags[self.flag] = c3;
  3728. end
  3729. end
  3730. end
  3731.  
  3732. function color:SetTrans(trans, nocallback)
  3733. if typeof(trans) == 'number' then
  3734. self.trans = trans;
  3735. if not nocallback then
  3736. self.callback(self.color, trans);
  3737. end
  3738. if self.open then
  3739. window.colorpicker:Visualize(self.color, self.trans);
  3740. end
  3741. end
  3742. end
  3743.  
  3744. function color:SetOpen(bool)
  3745. if typeof(bool) == 'boolean' then
  3746. self.open = bool
  3747. if bool then
  3748. if window.colorpicker.selected then
  3749. window.colorpicker.selected.open = false;
  3750. end
  3751. window.colorpicker.selected = color
  3752. window.colorpicker.objects.background.Parent = self.objects.background;
  3753. window.colorpicker.objects.background.Visible = true;
  3754. window.colorpicker:Visualize(color.color, color.trans)
  3755. elseif window.colorpicker.selected == color then
  3756. window.colorpicker.selected = nil;
  3757. window.colorpicker.objects.background.Parent = window.objects.background;
  3758. window.colorpicker.objects.background.Visible = false;
  3759. end
  3760. end
  3761. end
  3762.  
  3763. tooltip(color);
  3764. color:SetText(color.text);
  3765. color:SetColor(color.color, true);
  3766. color:SetTrans(color.trans, true);
  3767. self:UpdateOptions();
  3768. return color
  3769. end
  3770.  
  3771. -- // Text Box
  3772. function section:AddBox(data)
  3773. local box = {
  3774. class = 'box';
  3775. flag = data.flag;
  3776. text = '';
  3777. input = '';
  3778. order = #self.options+1;
  3779. callback = function() end;
  3780. enabled = true;
  3781. focused = false;
  3782. risky = false;
  3783. objects = {};
  3784. };
  3785.  
  3786. local blacklist = {'objects', 'dragging'};
  3787. for i,v in next, data do
  3788. if not table.find(blacklist, i) and box[i] ~= nil then
  3789. box[i] = v;
  3790. end
  3791. end
  3792.  
  3793. table.insert(self.options, box)
  3794.  
  3795. if box.flag then
  3796. library.flags[box.flag] = box.input;
  3797. library.options[box.flag] = box;
  3798. end
  3799.  
  3800. --- Create Objects ---
  3801. do
  3802. local objs = box.objects;
  3803. local z = library.zindexOrder.window+25;
  3804.  
  3805. objs.holder = utility:Draw('Square', {
  3806. Size = newUDim2(1,0,0,37);
  3807. Transparency = 0;
  3808. ZIndex = z+4;
  3809. Parent = section.objects.optionholder;
  3810. })
  3811.  
  3812. objs.background = utility:Draw('Square', {
  3813. Size = newUDim2(1,-4,0,15);
  3814. Position = newUDim2(0,2,1,-17);
  3815. ThemeColor = 'Option Background';
  3816. ZIndex = z+2;
  3817. Parent = objs.holder;
  3818. })
  3819.  
  3820. objs.border1 = utility:Draw('Square', {
  3821. Size = newUDim2(1,2,1,2);
  3822. Position = newUDim2(0,-1,0,-1);
  3823. ThemeColor = 'Option Border 1';
  3824. ZIndex = z+1;
  3825. Parent = objs.background;
  3826. })
  3827.  
  3828. objs.border2 = utility:Draw('Square', {
  3829. Size = newUDim2(1,2,1,2);
  3830. Position = newUDim2(0,-1,0,-1);
  3831. ThemeColor = 'Option Border 2';
  3832. ZIndex = z;
  3833. Parent = objs.border1;
  3834. })
  3835.  
  3836. objs.gradient = utility:Draw('Image', {
  3837. Size = newUDim2(1,0,1,0);
  3838. Data = library.images.gradientp90;
  3839. Transparency = .65;
  3840. ZIndex = z+4;
  3841. Parent = objs.background;
  3842. })
  3843.  
  3844. objs.text = utility:Draw('Text', {
  3845. Position = newUDim2(0,2,0,2);
  3846. ThemeColor = box.risky and 'Risky Text Enabled' or 'Option Text 2';
  3847. Size = 13;
  3848. Font = 2;
  3849. ZIndex = z+1;
  3850. Outline = true;
  3851. Parent = objs.holder;
  3852. })
  3853.  
  3854. objs.inputText = utility:Draw('Text', {
  3855. Position = newUDim2(0,2,0,0);
  3856. ThemeColor = 'Option Text 2';
  3857. Size = 13;
  3858. Font = 2;
  3859. ZIndex = z+5;
  3860. Outline = true;
  3861. Parent = objs.background;
  3862. })
  3863.  
  3864. utility:Connection(objs.holder.MouseEnter, function()
  3865. objs.border1.ThemeColor = 'Accent';
  3866. end)
  3867.  
  3868. utility:Connection(objs.holder.MouseLeave, function()
  3869. objs.border1.ThemeColor = 'Option Border 1';
  3870. end)
  3871.  
  3872. utility:Connection(objs.holder.MouseButton1Down, function()
  3873. if box.focused then
  3874. box:ReleaseFocus();
  3875. actionservice:UnbindAction('FreezeMovement');
  3876. else
  3877. actionservice:BindAction(
  3878. 'FreezeMovement',
  3879. function()
  3880. return Enum.ContextActionResult.Sink
  3881. end,
  3882. false,
  3883. unpack(Enum.PlayerActions:GetEnumItems())
  3884. )
  3885. box:CaptureFocus(inputservice:IsKeyDown(Enum.KeyCode.LeftControl));
  3886. if inputservice:IsKeyDown(Enum.KeyCode.LeftControl) then
  3887. objs.inputText.Text = '';
  3888. end
  3889. end
  3890. end)
  3891.  
  3892. end
  3893. ----------------------
  3894.  
  3895. function box:SetText(str)
  3896. if typeof(str) == 'string' then
  3897. self.text = str;
  3898. self.objects.text.Text = str;
  3899. end
  3900. end
  3901.  
  3902. function box:SetInput(str, nocallback)
  3903. if typeof(str) == 'string' then
  3904. self.input = str;
  3905. self.objects.inputText.Text = str;
  3906. if not nocallback then
  3907. self.callback(str);
  3908. end
  3909. if self.flag then
  3910. library.flags[self.flag] = str;
  3911. end
  3912. end
  3913. end
  3914.  
  3915. local c
  3916. local input = box.input;
  3917. function box:CaptureFocus(clear)
  3918. box.focused = true
  3919.  
  3920. if clear then
  3921. input = '';
  3922. end
  3923.  
  3924. self.objects.inputText.ThemeColor = 'Option Text 1';
  3925. c = utility:Connection(inputservice.InputBegan, function(inp)
  3926. if inp.KeyCode == Enum.KeyCode.Return or inp.UserInputType == Enum.UserInputType.MouseButton1 then
  3927. box:ReleaseFocus(true);
  3928. elseif inp.KeyCode == Enum.KeyCode.Escape then
  3929. input = self.input
  3930. self.objects.inputText.Text = input;
  3931. box:ReleaseFocus();
  3932. elseif inp.KeyCode == Enum.KeyCode.Backspace then
  3933. input = input:sub(1,-2);
  3934. self.objects.inputText.Text = input;
  3935. elseif #inp.KeyCode.Name == 1 or table.find(whitelistedBoxKeys, inp.KeyCode) or inp.KeyCode.Name == 'Space' or inp.KeyCode.Name == 'Minus' or inp.KeyCode.Name == 'Equals' or inp.KeyCode.Name == 'Backquote' then
  3936. local wlIdx = table.find(whitelistedBoxKeys, inp.KeyCode)
  3937. local keyString = inp.KeyCode.Name == 'Space' and ' ' or inp.KeyCode.Name == 'Minus' and '_' or inp.KeyCode.Name == 'Equals' and '+' or inp.KeyCode.Name == 'Backquote' and '~' or wlIdx ~= nil and tostring(wlIdx-1) or inp.KeyCode.Name
  3938. if not (inputservice:IsKeyDown(Enum.KeyCode.LeftShift) and not inputservice:IsKeyDown(Enum.KeyCode.RightShift)) then
  3939. keyString = keyString:lower();
  3940. if inp.KeyCode.Name == 'Minus' then
  3941. keyString = '-'
  3942. elseif inp.KeyCode.Name == 'Equals' then
  3943. keyString = '='
  3944. elseif inp.KeyCode.Name == 'Backquote' then
  3945. keyString = '`'
  3946. end
  3947. else
  3948. if keyString == '1' then
  3949. keyString = '!'
  3950. elseif keyString == '2' then
  3951. keyString = '@'
  3952. elseif keyString == '3' then
  3953. keyString = '#'
  3954. elseif keyString == '4' then
  3955. keyString = '$'
  3956. elseif keyString == '5' then
  3957. keyString = '%'
  3958. elseif keyString == '6' then
  3959. keyString = '^'
  3960. elseif keyString == '7' then
  3961. keyString = '&'
  3962. elseif keyString == '8' then
  3963. keyString = '*'
  3964. elseif keyString == '9' then
  3965. keyString = '('
  3966. elseif keyString == '0' then
  3967. keyString = ')'
  3968. end
  3969. end
  3970. input = input..keyString;
  3971. self.objects.inputText.Text = input;
  3972. end
  3973. end)
  3974.  
  3975. end
  3976.  
  3977. function box:ReleaseFocus(apply)
  3978. box.focused = false;
  3979. self.objects.inputText.ThemeColor = 'Option Text 2';
  3980. if apply then
  3981. box:SetInput(input);
  3982. end
  3983. c:Disconnect();
  3984. end
  3985.  
  3986. tooltip(box);
  3987. box:SetText(box.text);
  3988. box:SetInput(box.input, true);
  3989. self:UpdateOptions();
  3990. return box
  3991. end
  3992.  
  3993. -- // Keybind
  3994. function section:AddBind(data)
  3995. local bind = {
  3996. class = 'bind';
  3997. flag = data.flag;
  3998. text = '';
  3999. tooltip = '';
  4000. bind = 'none';
  4001. mode = 'toggle';
  4002. order = #self.options+1;
  4003. callback = function() end;
  4004. keycallback = function() end;
  4005. indicatorValue = library.keyIndicator:AddValue({value = 'value', key = 'key', enabled = false});
  4006. noindicator = false;
  4007. state = false;
  4008. nomouse = false;
  4009. enabled = true;
  4010. binding = false;
  4011. risky = false;
  4012. objects = {};
  4013. };
  4014.  
  4015. local blacklist = {'objects'};
  4016. for i,v in next, data do
  4017. if not table.find(blacklist, i) and bind[i] ~= nil then
  4018. bind[i] = v
  4019. end
  4020. end
  4021.  
  4022. table.insert(self.options, bind)
  4023.  
  4024. if bind.flag then
  4025. library.options[bind.flag] = bind;
  4026. end
  4027.  
  4028. --- Create Objects ---
  4029. do
  4030. local objs = bind.objects;
  4031. local z = library.zindexOrder.window+25;
  4032.  
  4033. objs.holder = utility:Draw('Square', {
  4034. Size = newUDim2(1,0,0,19);
  4035. Transparency = 0;
  4036. ZIndex = z+5;
  4037. Parent = section.objects.optionholder;
  4038. })
  4039.  
  4040. objs.text = utility:Draw('Text', {
  4041. Position = newUDim2(0,2,0,2);
  4042. ThemeColor = bind.risky and 'Risky Text' or 'Option Text 2';
  4043. Size = 13;
  4044. Font = 2;
  4045. ZIndex = z+1;
  4046. Outline = true;
  4047. Parent = objs.holder;
  4048. })
  4049.  
  4050. objs.keyText = utility:Draw('Text', {
  4051. ThemeColor = 'Option Text 3';
  4052. Size = 13;
  4053. Font = 2;
  4054. ZIndex = z+1;
  4055. Parent = objs.holder;
  4056. })
  4057.  
  4058. utility:Connection(objs.holder.MouseEnter, function()
  4059. objs.keyText.ThemeColor = 'Accent';
  4060. end)
  4061.  
  4062. utility:Connection(objs.holder.MouseLeave, function()
  4063. objs.keyText.ThemeColor = bind.binding and 'Accent' or 'Option Text 3';
  4064. end)
  4065.  
  4066. utility:Connection(objs.holder.MouseButton1Down, function()
  4067. if not bind.binding then
  4068. bind:SetKeyText('...');
  4069. bind.binding = true;
  4070. end
  4071. end)
  4072.  
  4073. end
  4074. ----------------------
  4075.  
  4076. local c
  4077.  
  4078. function bind:SetText(str)
  4079. if typeof(str) == 'string' then
  4080. self.text = str;
  4081. self.objects.text.Text = str;
  4082. self.indicatorValue:SetKey(str);
  4083. end
  4084. end
  4085.  
  4086. function bind:SetBind(keybind)
  4087. if c then
  4088. c:Disconnect();
  4089. if bind.flag then
  4090. library.flags[bind.flag] = false;
  4091. end
  4092. bind.callback(false);
  4093. end
  4094. local keyName = 'NONE'
  4095. self.bind = (keybind and keybind) or keybind or self.bind
  4096. if self.bind == Enum.KeyCode.Backspace then
  4097. self.bind = 'none';
  4098. else
  4099. keyName = keyNames[keybind] or keybind.Name or keybind
  4100. end
  4101. self.keycallback(self.bind);
  4102. self:SetKeyText(keyName:upper());
  4103. self.indicatorValue:SetKey((self.text == nil or self.text == '') and (self.flag == nil and 'unknown' or self.flag) or self.text); -- this is so dumb
  4104. self.indicatorValue:SetValue('['..keyName:upper()..']');
  4105. self.objects.keyText.ThemeColor = self.objects.holder.Hover and 'Accent' or 'Option Text 3';
  4106. end
  4107.  
  4108. function bind:SetKeyText(str)
  4109. str = tostring(str);
  4110. self.objects.keyText.Text = '['..str..']';
  4111. self.objects.keyText.Position = newUDim2(1,-self.objects.keyText.TextBounds.X, 0, 2);
  4112. end
  4113.  
  4114. utility:Connection(inputservice.InputBegan, function(inp)
  4115. if inputservice:GetFocusedTextBox() then
  4116. return
  4117. elseif bind.binding then
  4118. local key = (table.find({Enum.UserInputType.MouseButton1, Enum.UserInputType.MouseButton2, Enum.UserInputType.MouseButton3}, inp.UserInputType) and not bind.nomouse) and inp.UserInputType
  4119. bind:SetBind(key or (not table.find(blacklistedKeys, inp.KeyCode)) and inp.KeyCode)
  4120. bind.binding = false
  4121. elseif not bind.binding and self.bind == 'none' then
  4122. bind.state = true
  4123. library.flags[bind.flag] = bind.state
  4124. elseif (inp.KeyCode == bind.bind or inp.UserInputType == bind.bind) and not bind.binding then
  4125. if bind.mode == 'toggle' then
  4126. bind.state = not bind.state
  4127. if bind.flag then
  4128. library.flags[bind.flag] = bind.state;
  4129. end
  4130. bind.callback(bind.state)
  4131. bind.indicatorValue:SetEnabled(bind.state and not bind.noindicator);
  4132. elseif bind.mode == 'hold' then
  4133. if bind.flag then
  4134. library.flags[bind.flag] = true;
  4135. end
  4136. bind.indicatorValue:SetEnabled(true and not bind.noindicator);
  4137. c = utility:Connection(runservice.RenderStepped, function()
  4138. bind.callback(true);
  4139. end)
  4140. end
  4141. end
  4142. end)
  4143.  
  4144. utility:Connection(inputservice.InputEnded, function(inp)
  4145. if bind.bind ~= 'none' then
  4146. if inp.KeyCode == bind.bind or inp.UserInputType == bind.key then
  4147. if c then
  4148. c:Disconnect();
  4149. if bind.flag then
  4150. library.flags[bind.flag] = false;
  4151. end
  4152. bind.callback(false);
  4153. bind.indicatorValue:SetEnabled(false);
  4154. end
  4155. end
  4156. end
  4157. end)
  4158.  
  4159. tooltip(bind);
  4160. bind:SetBind(bind.bind);
  4161. bind:SetText(bind.text);
  4162. self:UpdateOptions();
  4163. return bind
  4164. end
  4165.  
  4166. -- // Dropdown
  4167. function section:AddList(data)
  4168. local list = {
  4169. class = 'list';
  4170. flag = data.flag;
  4171. text = '';
  4172. selected = '';
  4173. tooltip = '';
  4174. order = #self.options+1;
  4175. callback = function() end;
  4176. enabled = true;
  4177. multi = false;
  4178. open = false;
  4179. risky = false;
  4180. values = {};
  4181. objects = {};
  4182. }
  4183.  
  4184. table.insert(self.options, list);
  4185.  
  4186. local blacklist = {'objects'};
  4187. for i,v in next, data do
  4188. if not table.find(blacklist, i) ~= list[i] ~= nil then
  4189. list[i] = v
  4190. end
  4191. end
  4192.  
  4193. if list.flag then
  4194. library.flags[list.flag] = list.selected;
  4195. library.options[list.flag] = list;
  4196. end
  4197.  
  4198. -- Create Objects --
  4199. do
  4200. local objs = list.objects;
  4201. local z = library.zindexOrder.window+25;
  4202.  
  4203. objs.holder = utility:Draw('Square', {
  4204. Size = newUDim2(1,0,0,40);
  4205. Transparency = 0;
  4206. ZIndex = z+4;
  4207. Parent = section.objects.optionholder;
  4208. })
  4209.  
  4210. objs.background = utility:Draw('Square', {
  4211. Size = newUDim2(1,-4,0,15);
  4212. Position = newUDim2(0,2,1,-19);
  4213. ThemeColor = 'Option Background';
  4214. ZIndex = z+2;
  4215. Parent = objs.holder;
  4216. })
  4217.  
  4218. objs.border1 = utility:Draw('Square', {
  4219. Size = newUDim2(1,2,1,2);
  4220. Position = newUDim2(0,-1,0,-1);
  4221. ThemeColor = 'Option Border 1';
  4222. ZIndex = z+1;
  4223. Parent = objs.background;
  4224. })
  4225.  
  4226. objs.border2 = utility:Draw('Square', {
  4227. Size = newUDim2(1,2,1,2);
  4228. Position = newUDim2(0,-1,0,-1);
  4229. ThemeColor = 'Option Border 2';
  4230. ZIndex = z;
  4231. Parent = objs.border1;
  4232. })
  4233.  
  4234. objs.gradient = utility:Draw('Image', {
  4235. Size = newUDim2(1,0,1,0);
  4236. Data = library.images.gradientp90;
  4237. Transparency = .65;
  4238. ZIndex = z+4;
  4239. Parent = objs.background;
  4240. })
  4241.  
  4242. objs.text = utility:Draw('Text', {
  4243. Position = newUDim2(0,2,0,2);
  4244. ThemeColor = list.risky and 'Risky Text Enabled' or 'Option Text 2';
  4245. Size = 13;
  4246. Font = 2;
  4247. ZIndex = z+1;
  4248. Outline = true;
  4249. Parent = objs.holder;
  4250. })
  4251.  
  4252. objs.inputText = utility:Draw('Text', {
  4253. Position = newUDim2(0,4,0,0);
  4254. ThemeColor = 'Option Text 2';
  4255. Text = 'none',
  4256. Size = 13;
  4257. Font = 2;
  4258. ZIndex = z+5;
  4259. Outline = true;
  4260. Parent = objs.background;
  4261. })
  4262.  
  4263. objs.openText = utility:Draw('Text', {
  4264. Position = newUDim2(1,-10,0,0);
  4265. ThemeColor = 'Option Text 3';
  4266. Text = '+';
  4267. Size = 13;
  4268. Font = 2;
  4269. ZIndex = z+5;
  4270. Outline = true;
  4271. Parent = objs.background;
  4272. })
  4273.  
  4274. utility:Connection(objs.holder.MouseEnter, function()
  4275. objs.border1.ThemeColor = 'Accent';
  4276. end)
  4277.  
  4278. utility:Connection(objs.holder.MouseLeave, function()
  4279. objs.border1.ThemeColor = 'Option Border 1';
  4280. end)
  4281.  
  4282. utility:Connection(objs.holder.MouseButton1Down, function()
  4283. if list.open then
  4284. list.open = false;
  4285. objs.openText.Text = '+';
  4286. if window.dropdown.selected == list then
  4287. window.dropdown.selected = nil;
  4288. window.dropdown.objects.background.Visible = false;
  4289. end
  4290. else
  4291. if window.dropdown.selected ~= nil then
  4292. window.dropdown.selected.open = false
  4293. end
  4294. list.open = true;
  4295. objs.openText.Text = '-';
  4296. window.dropdown.selected = list;
  4297. window.dropdown.objects.background.Visible = true;
  4298. window.dropdown.objects.background.Parent = objs.holder;
  4299. window.dropdown:Refresh();
  4300. end
  4301. end)
  4302.  
  4303.  
  4304. end
  4305. --------------------
  4306.  
  4307. function list:SetText(str)
  4308. if typeof(str) == 'string' then
  4309. self.text = str;
  4310. self.objects.text.Text = str;
  4311. end
  4312. end
  4313.  
  4314. function list:Select(option, nocallback)
  4315. option = typeof(option) == 'table' and (self.multi == true and option or (#option == 0 and nil or option[1])) or self.multi == true and {option} or option;
  4316. if option ~= nil then
  4317. self.selected = option;
  4318. local text = typeof(option) == 'table' and (#option == 0 and "none" or table.concat(option, ', ')) or tostring(option);
  4319. local label = self.objects.inputText
  4320. label.Text = text;
  4321. if label.TextBounds.X > self.objects.background.Object.Size.X - 10 then
  4322. local split = text:split('');
  4323. for i = 1,#split do
  4324. label.Text = table.concat(split, '', 1, i)
  4325. if label.TextBounds.X > self.objects.background.Object.Size.X - 10 then
  4326. label.Text = label.Text:sub(1,-6)..'...';
  4327. break
  4328. end
  4329. end
  4330. end
  4331. if self.flag then
  4332. library.flags[self.flag] = self.selected
  4333. end
  4334. if not nocallback then
  4335. self.callback(self.selected);
  4336. end
  4337. end
  4338. end
  4339.  
  4340. function list:AddValue(value)
  4341. table.insert(list.values, tostring(value));
  4342. if window.dropdown.selected == list then
  4343. window.dropdown:Refresh()
  4344. end
  4345. end
  4346.  
  4347. function list:RemoveValue(value)
  4348. if table.find(list.values, value) then
  4349. table.remove(list.values, table.find(list.values, value));
  4350. if window.dropdown.selected == list then
  4351. window.dropdown:Refresh()
  4352. end
  4353. end
  4354. end
  4355.  
  4356. function list:ClearValues()
  4357. table.clear(list.values);
  4358. if window.dropdown.selected == list then
  4359. window.dropdown:Refresh()
  4360. end
  4361. end
  4362.  
  4363. tooltip(list);
  4364. list:Select((data.value or data.selected) or (list.multi and 'none' or list.values[1]), true);
  4365. list:SetText(list.text);
  4366. self:UpdateOptions();
  4367. return list
  4368. end
  4369.  
  4370. -- Text
  4371. function section:AddText(data)
  4372. local text = {
  4373. class = 'text';
  4374. flag = data.flag;
  4375. text = '';
  4376. tooltip = '';
  4377. order = #self.options+1;
  4378. enabled = true;
  4379. risky = false;
  4380. objects = {};
  4381. };
  4382.  
  4383. local blacklist = {'objects'};
  4384. for i,v in next, data do
  4385. if not table.find(blacklist, i) and text[i] ~= nil then
  4386. text[i] = v
  4387. end
  4388. end
  4389.  
  4390. if data.flag then
  4391. library.options[data.flag] = text;
  4392. end
  4393.  
  4394. table.insert(self.options, text)
  4395.  
  4396. --- Create Objects ---
  4397. do
  4398. local objs = text.objects;
  4399. local z = library.zindexOrder.window+25;
  4400.  
  4401. objs.holder = utility:Draw('Square', {
  4402. Transparency = 0;
  4403. ZIndex = z+5;
  4404. Parent = section.objects.optionholder;
  4405. })
  4406.  
  4407. objs.text = utility:Draw('Text', {
  4408. Position = newUDim2(0,2,0,2);
  4409. ThemeColor = text.risky and 'Risky Text Enabled' or 'Option Text 2';
  4410. Size = 13;
  4411. Font = 2;
  4412. ZIndex = z+1;
  4413. Outline = true;
  4414. Parent = objs.holder;
  4415. })
  4416. end
  4417. ----------------------
  4418.  
  4419. function text:SetText(str)
  4420. if typeof(str) == 'string' then
  4421. self.text = str;
  4422. self.objects.text.Text = str;
  4423. self.objects.holder.Size = newUDim2(1,0,0,self.objects.text.TextBounds.Y + 6);
  4424. section:UpdateOptions();
  4425. end
  4426. end
  4427.  
  4428. text:SetText(text.text);
  4429. self:UpdateOptions();
  4430. return text
  4431. end
  4432.  
  4433. -----------------------
  4434.  
  4435. section:UpdateOptions();
  4436. section:SetText(section.text);
  4437. self:UpdateSections();
  4438. return section;
  4439. end
  4440.  
  4441. function tab:UpdateSections()
  4442. table.sort(self.sections, function(a,b)
  4443. return a.order < b.order
  4444. end)
  4445.  
  4446. local last1,last2;
  4447. local padding = 15;
  4448. for _,section in next, self.sections do
  4449.  
  4450. if section.objects.background.Visible ~= (section.enabled and tab.selected) then
  4451. section.objects.background.Visible = section.enabled and tab.selected
  4452. section:UpdateOptions();
  4453. end
  4454.  
  4455. if section.enabled then
  4456. if section.side == 1 then
  4457. if last1 then
  4458. section.objects.background.Position = last1.objects.background.Position + newUDim2(0,0,0,last1.objects.background.Object.Size.Y + padding);
  4459. end
  4460. last1 = section;
  4461. elseif section.side == 2 then
  4462. if last2 then
  4463. section.objects.background.Position = last2.objects.background.Position + newUDim2(0,0,0,last2.objects.background.Object.Size.Y + padding);
  4464. end
  4465. last2 = section;
  4466. end
  4467. end
  4468.  
  4469. section:SetText(section.text)
  4470.  
  4471. end
  4472. end
  4473.  
  4474. function tab:SetText(str)
  4475. if typeof(str) == 'string' then
  4476. self.text = str;
  4477. self.objects.text.Text = str;
  4478. window:UpdateTabs();
  4479. end
  4480. end
  4481.  
  4482. function tab:Select()
  4483. window.selectedTab = tab;
  4484. window:UpdateTabs();
  4485. for i,v in next, window.tabs do
  4486. if v.callback then
  4487. v.callback(v == tab)
  4488. end
  4489. end
  4490. end
  4491.  
  4492. if window.selectedTab == nil then
  4493. tab:Select();
  4494. end
  4495.  
  4496. tab:SetText(tab.text);
  4497. window:UpdateTabs();
  4498. return tab;
  4499. end
  4500.  
  4501. function window:UpdateTabs()
  4502. table.sort(self.tabs, function(a,b)
  4503. return a.order < b.order
  4504. end)
  4505. local pos = 0;
  4506. for i,v in next, self.tabs do
  4507. local objs = v.objects;
  4508. v.selected = v == self.selectedTab;
  4509. objs.background.ThemeColor = v.selected and 'Selected Tab Background' or 'Unselected Tab Background';
  4510. objs.background.Size = newUDim2(0, objs.text.TextBounds.X + 14, 1, v.selected and 1 or 0);
  4511. objs.background.Position = newUDim2(0, pos, 0, 0)
  4512.  
  4513. objs.text.ThemeColor = v.selected and 'Selected Tab Text' or 'Unselected Tab Text';
  4514. objs.text.Position = newUDim2(.5, 0, 0, 3);
  4515.  
  4516. objs.topBorder.ThemeColor = v.selected and 'Accent' or 'Unselected Tab Background';
  4517.  
  4518. pos += objs.background.Size.X.Offset + 1
  4519.  
  4520. v:UpdateSections();
  4521.  
  4522. end
  4523. end
  4524.  
  4525. window:SetOpen(true);
  4526. return window;
  4527. end
  4528.  
  4529. -- Tooltip
  4530. do
  4531. local z = library.zindexOrder.window + 2000;
  4532. tooltipObjects.background = utility:Draw('Square', {
  4533. ThemeColor = 'Group Background';
  4534. ZIndex = z;
  4535. Visible = false;
  4536. })
  4537.  
  4538. tooltipObjects.border1 = utility:Draw('Square', {
  4539. Size = UDim2.new(1,2,1,2);
  4540. Position = UDim2.new(0,-1,0,-1);
  4541. ThemeColor = 'Border 1';
  4542. ZIndex = z-1;
  4543. Parent = tooltipObjects.background;
  4544. })
  4545.  
  4546. tooltipObjects.border2 = utility:Draw('Square', {
  4547. Size = UDim2.new(1,4,1,4);
  4548. Position = UDim2.new(0,-2,0,-2);
  4549. ThemeColor = 'Border 3';
  4550. ZIndex = z-2;
  4551. Parent = tooltipObjects.background;
  4552. })
  4553.  
  4554. tooltipObjects.text = utility:Draw('Text', {
  4555. Position = UDim2.new(0,3,0,0);
  4556. ThemeColor = 'Primary Text';
  4557. Size = 13;
  4558. Font = 2;
  4559. ZIndex = z+1;
  4560. Outline = true;
  4561. Parent = tooltipObjects.background;
  4562. })
  4563.  
  4564. tooltipObjects.riskytext = utility:Draw('Text', {
  4565. Position = UDim2.new(0,3,0,0);
  4566. ThemeColor = 'Risky Text Enabled';
  4567. Text = '[RISKY]';
  4568. Size = 13;
  4569. Font = 2;
  4570. ZIndex = z+1;
  4571. Outline = true;
  4572. Parent = tooltipObjects.background;
  4573. })
  4574.  
  4575. end
  4576.  
  4577. -- Watermark
  4578. do
  4579. if not IonHub_User then
  4580. getgenv().IonHub_User = {
  4581. UID = 0,
  4582. User = "floppa.hook"
  4583. }
  4584. end
  4585. self.watermark = {
  4586. objects = {};
  4587. text = {
  4588. {self.cheatname, true},
  4589. {("%s (uid %s)"):format(IonHub_User.User, tostring(IonHub_User.UID)), true},
  4590. {self.gamename, true},
  4591. {'0 fps', true},
  4592. {'0ms', true},
  4593. {'00:00:00', true},
  4594. {'M, D, Y', true},
  4595. };
  4596. lock = 'custom';
  4597. position = newUDim2(0,0,0,0);
  4598. refreshrate = 25;
  4599. }
  4600.  
  4601. function self.watermark:Update()
  4602. self.objects.background.Visible = library.flags.watermark_enabled
  4603. if library.flags.watermark_enabled then
  4604. local date = {os.date('%b',os.time()), os.date('%d',os.time()), os.date('%Y',os.time())}
  4605. local daySuffix = math.floor(date[2]%10)
  4606. date[2] = date[2]..(daySuffix == 1 and 'st' or daySuffix == 2 and 'nd' or daySuffix == 3 and 'rd' or 'th')
  4607.  
  4608. self.text[4][1] = library.stats.fps..' fps'
  4609. self.text[5][1] = floor(library.stats.ping)..'ms'
  4610. self.text[6][1] = os.date('%X', os.time())
  4611. self.text[7][1] = table.concat(date, ', ')
  4612.  
  4613. local text = {};
  4614. for _,v in next, self.text do
  4615. if v[2] then
  4616. table.insert(text, v[1]);
  4617. end
  4618. end
  4619.  
  4620. self.objects.text.Text = table.concat(text,' | ')
  4621. self.objects.background.Size = newUDim2(0, self.objects.text.TextBounds.X + 10, 0, 17)
  4622.  
  4623. local size = self.objects.background.Object.Size;
  4624. local screensize = workspace.CurrentCamera.ViewportSize;
  4625.  
  4626. self.position = (
  4627. self.lock == 'Top Right' and newUDim2(0, screensize.X - size.X - 15, 0, 15) or
  4628. self.lock == 'Top Left' and newUDim2(0, 15, 0, 15) or
  4629. self.lock == 'Bottom Right' and newUDim2(0, screensize.X - size.X - 15, 0, screensize.Y - size.Y - 15) or
  4630. self.lock == 'Bottom Left' and newUDim2(0, 15, 0, screensize.Y - size.Y - 15) or
  4631. self.lock == 'Top' and newUDim2(0, screensize.X / 2 - size.X / 2, 0, 15) or
  4632. newUDim2(library.flags.watermark_x / 100, 0, library.flags.watermark_y / 100, 0)
  4633. )
  4634.  
  4635. self.objects.background.Position = self.position
  4636. end
  4637. end
  4638.  
  4639. do
  4640. local objs = self.watermark.objects;
  4641. local z = self.zindexOrder.watermark;
  4642.  
  4643. objs.background = utility:Draw('Square', {
  4644. Visible = false;
  4645. Size = newUDim2(0, 200, 0, 17);
  4646. Position = newUDim2(0,800,0,100);
  4647. ThemeColor = 'Background';
  4648. ZIndex = z;
  4649. })
  4650.  
  4651. objs.border1 = utility:Draw('Square', {
  4652. Size = newUDim2(1,2,1,2);
  4653. Position = newUDim2(0,-1,0,-1);
  4654. ThemeColor = 'Border 2';
  4655. Parent = objs.background;
  4656. ZIndex = z-1;
  4657. })
  4658.  
  4659. objs.border2 = utility:Draw('Square', {
  4660. Size = newUDim2(1,2,1,2);
  4661. Position = newUDim2(0,-1,0,-1);
  4662. ThemeColor = 'Border 3';
  4663. Parent = objs.border1;
  4664. ZIndex = z-2;
  4665. })
  4666.  
  4667. objs.topbar = utility:Draw('Square', {
  4668. Size = newUDim2(1,0,0,1);
  4669. ThemeColor = 'Accent';
  4670. ZIndex = z+1;
  4671. Parent = objs.background;
  4672. })
  4673.  
  4674. objs.text = utility:Draw('Text', {
  4675. Position = newUDim2(.5,0,0,2);
  4676. ThemeColor = 'Primary Text';
  4677. Text = 'Watermark Text';
  4678. Size = 13;
  4679. Font = 2;
  4680. ZIndex = z+1;
  4681. Outline = true;
  4682. Center = true;
  4683. Parent = objs.background;
  4684. })
  4685.  
  4686. end
  4687. end
  4688.  
  4689. local lasttick = tick();
  4690. utility:Connection(runservice.RenderStepped, function(step)
  4691. library.stats.fps = floor(1/step)
  4692. library.stats.ping = stats.Network.ServerStatsItem["Data Ping"]:GetValue()
  4693. library.stats.sendkbps = stats.DataSendKbps
  4694. library.stats.receivekbps = stats.DataReceiveKbps
  4695.  
  4696. if (tick()-lasttick)*1000 > library.watermark.refreshrate then
  4697. lasttick = tick()
  4698. library.watermark:Update()
  4699. end
  4700. end)
  4701.  
  4702. self.keyIndicator = self.NewIndicator({title = 'Keybinds', pos = newUDim2(0,15,0,325), enabled = false});
  4703.  
  4704. self.targetIndicator = self.NewIndicator({title = 'Target Info', pos = newUDim2(0,15,0,350), enabled = false});
  4705. self.targetName = self.targetIndicator:AddValue({key = 'Name :', value = 'nil'})
  4706. self.targetDisplay = self.targetIndicator:AddValue({key = 'DName :', value = 'nil'})
  4707. self.targetHealth = self.targetIndicator:AddValue({key = 'Health :', value = '0'})
  4708. self.targetDistance = self.targetIndicator:AddValue({key = 'Distance :', value = '0m'})
  4709. self.targetTool = self.targetIndicator:AddValue({key = 'Weapon :', value = 'nil'})
  4710.  
  4711. self:SetTheme(library.theme);
  4712. self:SetOpen(true);
  4713. self.hasInit = true
  4714.  
  4715. end
  4716.  
  4717. function library:CreateSettingsTab(menu)
  4718. local settingsTab = menu:AddTab('Settings', 999);
  4719. local configSection = settingsTab:AddSection('Config', 2);
  4720. local mainSection = settingsTab:AddSection('Main', 1);
  4721.  
  4722. configSection:AddBox({text = 'Config Name', flag = 'configinput'})
  4723. configSection:AddList({text = 'Config', flag = 'selectedconfig'})
  4724.  
  4725. local function refreshConfigs()
  4726. library.options.selectedconfig:ClearValues();
  4727. for _,v in next, listfiles(self.cheatname..'/'..self.gamename..'/configs') do
  4728. local ext = '.'..v:split('.')[#v:split('.')];
  4729. if ext == self.fileext then
  4730. library.options.selectedconfig:AddValue(v:split('\\')[#v:split('\\')]:sub(1,-#ext-1))
  4731. end
  4732. end
  4733. end
  4734.  
  4735. configSection:AddButton({text = 'Load', confirm = true, callback = function()
  4736. library:LoadConfig(library.flags.selectedconfig);
  4737. end}):AddButton({text = 'Save', confirm = true, callback = function()
  4738. library:SaveConfig(library.flags.selectedconfig);
  4739. end})
  4740.  
  4741. configSection:AddButton({text = 'Create', confirm = true, callback = function()
  4742. if library:GetConfig(library.flags.configinput) then
  4743. library:SendNotification('Config \''..library.flags.configinput..'\' already exists.', 5, c3new(1,0,0));
  4744. return
  4745. end
  4746. writefile(self.cheatname..'/'..self.gamename..'/configs/'..library.flags.configinput.. self.fileext, http:JSONEncode({}));
  4747. refreshConfigs()
  4748. end}):AddButton({text = 'Delete', confirm = true, callback = function()
  4749. if library:GetConfig(library.flags.selectedconfig) then
  4750. delfile(self.cheatname..'/'..self.gamename..'/configs/'..library.flags.selectedconfig.. self.fileext);
  4751. refreshConfigs()
  4752. end
  4753. end})
  4754.  
  4755. refreshConfigs()
  4756.  
  4757. mainSection:AddBind({text = 'Open / Close', flag = 'togglebind', nomouse = true, noindicator = true, bind = Enum.KeyCode.End, callback = function()
  4758. library:SetOpen(not library.open)
  4759. end});
  4760.  
  4761. mainSection:AddToggle({text = 'Disable Movement If Open', flag = 'disablemenumovement', callback = function(bool)
  4762. if bool and library.open then
  4763. actionservice:BindAction(
  4764. 'FreezeMovement',
  4765. function()
  4766. return Enum.ContextActionResult.Sink
  4767. end,
  4768. false,
  4769. unpack(Enum.PlayerActions:GetEnumItems())
  4770. )
  4771. else
  4772. actionservice:UnbindAction('FreezeMovement');
  4773. end
  4774. end})
  4775.  
  4776. mainSection:AddButton({text = 'Join Discord', flag = 'joindiscord', confirm = true, callback = function()
  4777. local res = syn.request({
  4778. Url = 'http://127.0.0.1:6463/rpc?v=1',
  4779. Method = 'POST',
  4780. Headers = {
  4781. ['Content-Type'] = 'application/json',
  4782. Origin = 'https://discord.com'
  4783. },
  4784. Body = game:GetService('HttpService'):JSONEncode({
  4785. cmd = 'INVITE_BROWSER',
  4786. nonce = game:GetService('HttpService'):GenerateGUID(false),
  4787. args = {code = 'seU6gab'}
  4788. })
  4789. })
  4790. if res.Success then
  4791. library:SendNotification(library.cheatname..' | joined discord', 3);
  4792. end
  4793. end})
  4794.  
  4795. mainSection:AddButton({text = 'Copy Discord', flag = 'copydiscord', callback = function()
  4796. setclipboard('discord.gg/seU6gab')
  4797. end})
  4798.  
  4799. mainSection:AddButton({text = 'Rejoin Server', confirm = true, callback = function()
  4800. game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, game.JobId);
  4801. end})
  4802.  
  4803. mainSection:AddButton({text = 'Rejoin Game', confirm = true, callback = function()
  4804. game:GetService("TeleportService"):Teleport(game.PlaceId);
  4805. end})
  4806.  
  4807. mainSection:AddButton({text = 'Copy Join Script', callback = function()
  4808. setclipboard(([[game:GetService("TeleportService"):TeleportToPlaceInstance(%s, "%s")]]):format(game.PlaceId, game.JobId))
  4809. end})
  4810.  
  4811. mainSection:AddButton({text = 'Copy Game Invite', callback = function()
  4812. setclipboard(([[Roblox.GameLauncher.joinGameInstance(%s, "%s"))]]):format(game.PlaceId, game.JobId))
  4813. end})
  4814.  
  4815. mainSection:AddButton({text = 'Unload', confirm = true, callback = function()
  4816. library:Unload();
  4817. end})
  4818.  
  4819. mainSection:AddSeparator({text = 'Keybinds'});
  4820. mainSection:AddToggle({text = 'Keybind Indicator', flag = 'keybind_indicator', callback = function(bool)
  4821. library.keyIndicator:SetEnabled(bool);
  4822. end})
  4823. mainSection:AddSlider({text = 'Position X', flag = 'keybind_indicator_x', min = 0, max = 100, increment = .1, value = .5, callback = function()
  4824. library.keyIndicator:SetPosition(newUDim2(library.flags.keybind_indicator_x / 100, 0, library.flags.keybind_indicator_y / 100, 0));
  4825. end});
  4826. mainSection:AddSlider({text = 'Position Y', flag = 'keybind_indicator_y', min = 0, max = 100, increment = .1, value = 35, callback = function()
  4827. library.keyIndicator:SetPosition(newUDim2(library.flags.keybind_indicator_x / 100, 0, library.flags.keybind_indicator_y / 100, 0));
  4828. end});
  4829.  
  4830. mainSection:AddSeparator({text = 'Watermark'})
  4831. mainSection:AddToggle({text = 'Enabled', flag = 'watermark_enabled'});
  4832. mainSection:AddList({text = 'Position', flag = 'watermark_pos', selected = 'Custom', values = {'Top', 'Top Left', 'Top Right', 'Bottom Left', 'Bottom Right', 'Custom'}, callback = function(val)
  4833. library.watermark.lock = val;
  4834. end})
  4835. mainSection:AddSlider({text = 'Custom X', flag = 'watermark_x', suffix = '%', min = 0, max = 100, increment = .1});
  4836. mainSection:AddSlider({text = 'Custom Y', flag = 'watermark_y', suffix = '%', min = 0, max = 100, increment = .1});
  4837.  
  4838. local themeStrings = {"Custom"};
  4839. for _,v in next, library.themes do
  4840. table.insert(themeStrings, v.name)
  4841. end
  4842. local themeTab = menu:AddTab('Theme', 990);
  4843. local themeSection = themeTab:AddSection('Theme', 1);
  4844. local setByPreset = false
  4845.  
  4846. themeSection:AddList({text = 'Presets', flag = 'preset_theme', values = themeStrings, callback = function(newTheme)
  4847. if newTheme == "Custom" then return end
  4848. setByPreset = true
  4849. for _,v in next, library.themes do
  4850. if v.name == newTheme then
  4851. for x, d in pairs(library.options) do
  4852. if v.theme[tostring(x)] ~= nil then
  4853. d:SetColor(v.theme[tostring(x)])
  4854. end
  4855. end
  4856. library:SetTheme(v.theme)
  4857. break
  4858. end
  4859. end
  4860. setByPreset = false
  4861. end}):Select('Default');
  4862.  
  4863. for i, v in pairs(library.theme) do
  4864. themeSection:AddColor({text = i, flag = i, color = library.theme[i], callback = function(c3)
  4865. library.theme[i] = c3
  4866. library:SetTheme(library.theme)
  4867. if not setByPreset and not setByConfig then
  4868. library.options.preset_theme:Select('Custom')
  4869. end
  4870. end});
  4871. end
  4872.  
  4873. return settingsTab;
  4874. end
  4875.  
  4876. getgenv().library = library
  4877. return library
Add Comment
Please, Sign In to add comment