Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
2,184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.23 KB | None | 0 0
  1. local library = {count = 0, queue = {}, callbacks = {}, rainbowtable = {true}, toggled = true, binds = {}};
  2. local defaults; do
  3. local dragger = {}; do
  4. local mouse = game:GetService("Players").LocalPlayer:GetMouse();
  5. local inputService = game:GetService('UserInputService');
  6. local heartbeat = game:GetService("RunService").Heartbeat;
  7. -- // credits to Ririchi / Inori for this cute drag function :)
  8. function dragger.new(frame)
  9. local s, event = pcall(function()
  10. return frame.MouseEnter
  11. end)
  12.  
  13. if s then
  14. frame.Active = true;
  15.  
  16. event:connect(function()
  17. local input = frame.InputBegan:connect(function(key)
  18. if key.UserInputType == Enum.UserInputType.MouseButton1 then
  19. local objectPosition = Vector2.new(mouse.X - frame.AbsolutePosition.X, mouse.Y - frame.AbsolutePosition.Y);
  20. while heartbeat:wait() and inputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  21. pcall(function()
  22. frame:TweenPosition(UDim2.new(0, mouse.X - objectPosition.X, 0, mouse.Y - objectPosition.Y), 'Out', 'Linear', 0.1, true);
  23. end)
  24. end
  25. end
  26. end)
  27.  
  28. local leave;
  29. leave = frame.MouseLeave:connect(function()
  30. input:disconnect();
  31. leave:disconnect();
  32. end)
  33. end)
  34. end
  35. end
  36.  
  37.  
  38. game:GetService('UserInputService').InputBegan:connect(function(key, gpe)
  39. if (not gpe) then
  40. if key.KeyCode == Enum.KeyCode.RightControl then
  41. library.toggled = not library.toggled;
  42. for i, data in next, library.queue do
  43. local pos = (library.toggled and data.p or UDim2.new(-1, 0, -0.5,0))
  44. data.w:TweenPosition(pos, (library.toggled and 'Out' or 'In'), 'Quad', 0.15, true)
  45. wait();
  46. end
  47. end
  48. end
  49. end)
  50. end
  51.  
  52. local types = {}; do
  53. types.__index = types;
  54. function types.window(name, options)
  55. library.count = library.count + 1
  56. local newWindow = library:Create('Frame', {
  57. Name = name;
  58. Size = UDim2.new(0, 190, 0, 30);
  59. BackgroundColor3 = options.topcolor;
  60. BorderSizePixel = 0;
  61. Parent = library.container;
  62. Position = UDim2.new(0, (15 + (200 * library.count) - 200), 0, 0);
  63. ZIndex = 3;
  64. library:Create('TextLabel', {
  65. Text = name;
  66. Size = UDim2.new(1, -10, 1, 0);
  67. Position = UDim2.new(0, 5, 0, 0);
  68. BackgroundTransparency = 1;
  69. Font = Enum.Font.Code;
  70. TextSize = options.titlesize;
  71. Font = options.titlefont;
  72. TextColor3 = options.titletextcolor;
  73. TextStrokeTransparency = library.options.titlestroke;
  74. TextStrokeColor3 = library.options.titlestrokecolor;
  75. ZIndex = 3;
  76. });
  77. library:Create("TextButton", {
  78. Size = UDim2.new(0, 30, 0, 30);
  79. Position = UDim2.new(1, -35, 0, 0);
  80. BackgroundTransparency = 1;
  81. Text = "-";
  82. TextSize = options.titlesize;
  83. Font = options.titlefont;--Enum.Font.Code;
  84. Name = 'window_toggle';
  85. TextColor3 = options.titletextcolor;
  86. TextStrokeTransparency = library.options.titlestroke;
  87. TextStrokeColor3 = library.options.titlestrokecolor;
  88. ZIndex = 3;
  89. });
  90. library:Create("Frame", {
  91. Name = 'Underline';
  92. Size = UDim2.new(1, 0, 0, 2);
  93. Position = UDim2.new(0, 0, 1, -2);
  94. BackgroundColor3 = (options.underlinecolor ~= "rainbow" and options.underlinecolor or Color3.new());
  95. BorderSizePixel = 0;
  96. ZIndex = 3;
  97. });
  98. library:Create('Frame', {
  99. Name = 'container';
  100. Position = UDim2.new(0, 0, 1, 0);
  101. Size = UDim2.new(1, 0, 0, 0);
  102. BorderSizePixel = 0;
  103. BackgroundColor3 = options.bgcolor;
  104. ClipsDescendants = false;
  105. library:Create('UIListLayout', {
  106. Name = 'List';
  107. SortOrder = Enum.SortOrder.LayoutOrder;
  108. })
  109. });
  110. })
  111.  
  112. if options.underlinecolor == "rainbow" then
  113. table.insert(library.rainbowtable, newWindow:FindFirstChild('Underline'))
  114. end
  115.  
  116. local window = setmetatable({
  117. count = 0;
  118. object = newWindow;
  119. container = newWindow.container;
  120. toggled = true;
  121. flags = {};
  122.  
  123. }, types)
  124.  
  125. table.insert(library.queue, {
  126. w = window.object;
  127. p = window.object.Position;
  128. })
  129.  
  130. newWindow:FindFirstChild("window_toggle").MouseButton1Click:connect(function()
  131. window.toggled = not window.toggled;
  132. newWindow:FindFirstChild("window_toggle").Text = (window.toggled and "+" or "-")
  133. if (not window.toggled) then
  134. window.container.ClipsDescendants = true;
  135. end
  136. wait();
  137. local y = 0;
  138. for i, v in next, window.container:GetChildren() do
  139. if (not v:IsA('UIListLayout')) then
  140. y = y + v.AbsoluteSize.Y;
  141. end
  142. end
  143.  
  144. local targetSize = window.toggled and UDim2.new(1, 0, 0, y+5) or UDim2.new(1, 0, 0, 0);
  145. local targetDirection = window.toggled and "In" or "Out"
  146.  
  147. window.container:TweenSize(targetSize, targetDirection, "Quint", .3, true)
  148. wait(.3)
  149. if window.toggled then
  150. window.container.ClipsDescendants = false;
  151. end
  152. end)
  153.  
  154. return window;
  155. end
  156.  
  157. function types:Resize()
  158. local y = 0;
  159. for i, v in next, self.container:GetChildren() do
  160. if (not v:IsA('UIListLayout')) then
  161. y = y + v.AbsoluteSize.Y;
  162. end
  163. end
  164. self.container.Size = UDim2.new(1, 0, 0, y+5)
  165. end
  166.  
  167. function types:GetOrder()
  168. local c = 0;
  169. for i, v in next, self.container:GetChildren() do
  170. if (not v:IsA('UIListLayout')) then
  171. c = c + 1
  172. end
  173. end
  174. return c
  175. end
  176.  
  177. function types:Toggle(name, options, callback)
  178. local default = options.default or false;
  179. local location = options.location or self.flags;
  180. local flag = options.flag or "";
  181. local callback = callback or function() end;
  182.  
  183. location[flag] = default;
  184.  
  185. local check = library:Create('Frame', {
  186. BackgroundTransparency = 1;
  187. Size = UDim2.new(1, 0, 0, 25);
  188. LayoutOrder = self:GetOrder();
  189. library:Create('TextLabel', {
  190. Name = name;
  191. Text = "\r" .. name;
  192. BackgroundTransparency = 1;
  193. TextColor3 = library.options.textcolor;
  194. Position = UDim2.new(0, 5, 0, 0);
  195. Size = UDim2.new(1, -5, 1, 0);
  196. TextXAlignment = Enum.TextXAlignment.Left;
  197. Font = library.options.font;
  198. TextSize = library.options.fontsize;
  199. TextStrokeTransparency = library.options.textstroke;
  200. TextStrokeColor3 = library.options.strokecolor;
  201. library:Create('TextButton', {
  202. Text = (location[flag] and utf8.char(10003) or "");
  203. Font = library.options.font;
  204. TextSize = library.options.fontsize;
  205. Name = 'Checkmark';
  206. Size = UDim2.new(0, 20, 0, 20);
  207. Position = UDim2.new(1, -25, 0, 4);
  208. TextColor3 = library.options.textcolor;
  209. BackgroundColor3 = library.options.bgcolor;
  210. BorderColor3 = library.options.bordercolor;
  211. TextStrokeTransparency = library.options.textstroke;
  212. TextStrokeColor3 = library.options.strokecolor;
  213. })
  214. });
  215. Parent = self.container;
  216. });
  217.  
  218. local function click(t)
  219. location[flag] = not location[flag];
  220. callback(location[flag])
  221. check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or "";
  222. end
  223.  
  224. check:FindFirstChild(name).Checkmark.MouseButton1Click:connect(click)
  225. library.callbacks[flag] = click;
  226.  
  227. if location[flag] == true then
  228. callback(location[flag])
  229. end
  230.  
  231. self:Resize();
  232. return {
  233. Set = function(self, b)
  234. location[flag] = b;
  235. callback(location[flag])
  236. check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or "";
  237. end
  238. }
  239. end
  240.  
  241. function types:Button(name, callback)
  242. callback = callback or function() end;
  243.  
  244. local check = library:Create('Frame', {
  245. BackgroundTransparency = 1;
  246. Size = UDim2.new(1, 0, 0, 25);
  247. LayoutOrder = self:GetOrder();
  248. library:Create('TextButton', {
  249. Name = name;
  250. Text = name;
  251. BackgroundColor3 = library.options.btncolor;
  252. BorderColor3 = library.options.bordercolor;
  253. TextStrokeTransparency = library.options.textstroke;
  254. TextStrokeColor3 = library.options.strokecolor;
  255. TextColor3 = library.options.textcolor;
  256. Position = UDim2.new(0, 5, 0, 5);
  257. Size = UDim2.new(1, -10, 0, 20);
  258. Font = library.options.font;
  259. TextSize = library.options.fontsize;
  260. });
  261. Parent = self.container;
  262. });
  263.  
  264. check:FindFirstChild(name).MouseButton1Click:connect(callback)
  265. self:Resize();
  266.  
  267. return {
  268. Fire = function()
  269. callback();
  270. end
  271. }
  272. end
  273.  
  274. function types:Box(name, options, callback) --type, default, data, location, flag)
  275. local type = options.type or "";
  276. local default = options.default or "";
  277. local data = options.data
  278. local location = options.location or self.flags;
  279. local flag = options.flag or "";
  280. local callback = callback or function() end;
  281. local min = options.min or 0;
  282. local max = options.max or 9e9;
  283.  
  284. if type == 'number' and (not tonumber(default)) then
  285. location[flag] = default;
  286. else
  287. location[flag] = "";
  288. default = "";
  289. end
  290.  
  291. local check = library:Create('Frame', {
  292. BackgroundTransparency = 1;
  293. Size = UDim2.new(1, 0, 0, 25);
  294. LayoutOrder = self:GetOrder();
  295. library:Create('TextLabel', {
  296. Name = name;
  297. Text = "\r" .. name;
  298. BackgroundTransparency = 1;
  299. TextColor3 = library.options.textcolor;
  300. TextStrokeTransparency = library.options.textstroke;
  301. TextStrokeColor3 = library.options.strokecolor;
  302. Position = UDim2.new(0, 5, 0, 0);
  303. Size = UDim2.new(1, -5, 1, 0);
  304. TextXAlignment = Enum.TextXAlignment.Left;
  305. Font = library.options.font;
  306. TextSize = library.options.fontsize;
  307. library:Create('TextBox', {
  308. TextStrokeTransparency = library.options.textstroke;
  309. TextStrokeColor3 = library.options.strokecolor;
  310. Text = tostring(default);
  311. Font = library.options.font;
  312. TextSize = library.options.fontsize;
  313. Name = 'Box';
  314. Size = UDim2.new(0, 60, 0, 20);
  315. Position = UDim2.new(1, -65, 0, 3);
  316. TextColor3 = library.options.textcolor;
  317. BackgroundColor3 = library.options.boxcolor;
  318. BorderColor3 = library.options.bordercolor;
  319. PlaceholderColor3 = library.options.placeholdercolor;
  320. })
  321. });
  322. Parent = self.container;
  323. });
  324.  
  325. local box = check:FindFirstChild(name):FindFirstChild('Box');
  326. box.FocusLost:connect(function(e)
  327. local old = location[flag];
  328. if type == "number" then
  329. local num = tonumber(box.Text)
  330. if (not num) then
  331. box.Text = tonumber(location[flag])
  332. else
  333. location[flag] = math.clamp(num, min, max)
  334. box.Text = tonumber(location[flag])
  335. end
  336. else
  337. location[flag] = tostring(box.Text)
  338. end
  339.  
  340. callback(location[flag], old, e)
  341. end)
  342.  
  343. if type == 'number' then
  344. box:GetPropertyChangedSignal('Text'):connect(function()
  345. box.Text = string.gsub(box.Text, "[%a+]", "");
  346. end)
  347. end
  348.  
  349. self:Resize();
  350. return box
  351. end
  352.  
  353. function types:Bind(name, options, callback)
  354. local location = options.location or self.flags;
  355. local keyboardOnly = options.kbonly or false
  356. local flag = options.flag or "";
  357. local callback = callback or function() end;
  358. local default = options.default;
  359.  
  360. if keyboardOnly and (not tostring(default):find('MouseButton')) then
  361. location[flag] = default
  362. end
  363.  
  364. local banned = {
  365. Return = true;
  366. Space = true;
  367. Tab = true;
  368. Unknown = true;
  369. }
  370.  
  371. local shortNames = {
  372. RightControl = 'RightCtrl';
  373. LeftControl = 'LeftCtrl';
  374. LeftShift = 'LShift';
  375. RightShift = 'RShift';
  376. MouseButton1 = "Mouse1";
  377. MouseButton2 = "Mouse2";
  378. }
  379.  
  380. local allowed = {
  381. MouseButton1 = true;
  382. MouseButton2 = true;
  383. }
  384.  
  385. local nm = (default and (shortNames[default.Name] or default.Name) or "None");
  386. local check = library:Create('Frame', {
  387. BackgroundTransparency = 1;
  388. Size = UDim2.new(1, 0, 0, 30);
  389. LayoutOrder = self:GetOrder();
  390. library:Create('TextLabel', {
  391. Name = name;
  392. Text = "\r" .. name;
  393. BackgroundTransparency = 1;
  394. TextColor3 = library.options.textcolor;
  395. Position = UDim2.new(0, 5, 0, 0);
  396. Size = UDim2.new(1, -5, 1, 0);
  397. TextXAlignment = Enum.TextXAlignment.Left;
  398. Font = library.options.font;
  399. TextSize = library.options.fontsize;
  400. TextStrokeTransparency = library.options.textstroke;
  401. TextStrokeColor3 = library.options.strokecolor;
  402. BorderColor3 = library.options.bordercolor;
  403. BorderSizePixel = 1;
  404. library:Create('TextButton', {
  405. Name = 'Keybind';
  406. Text = nm;
  407. TextStrokeTransparency = library.options.textstroke;
  408. TextStrokeColor3 = library.options.strokecolor;
  409. Font = library.options.font;
  410. TextSize = library.options.fontsize;
  411. Size = UDim2.new(0, 60, 0, 20);
  412. Position = UDim2.new(1, -65, 0, 5);
  413. TextColor3 = library.options.textcolor;
  414. BackgroundColor3 = library.options.bgcolor;
  415. BorderColor3 = library.options.bordercolor;
  416. BorderSizePixel = 1;
  417. })
  418. });
  419. Parent = self.container;
  420. });
  421.  
  422. local button = check:FindFirstChild(name).Keybind;
  423. button.MouseButton1Click:connect(function()
  424. library.binding = true
  425.  
  426. button.Text = "..."
  427. local a, b = game:GetService('UserInputService').InputBegan:wait();
  428. local name = tostring(a.KeyCode.Name);
  429. local typeName = tostring(a.UserInputType.Name);
  430.  
  431. if (a.UserInputType ~= Enum.UserInputType.Keyboard and (allowed[a.UserInputType.Name]) and (not keyboardOnly)) or (a.KeyCode and (not banned[a.KeyCode.Name])) then
  432. local name = (a.UserInputType ~= Enum.UserInputType.Keyboard and a.UserInputType.Name or a.KeyCode.Name);
  433. location[flag] = (a);
  434. button.Text = shortNames[name] or name;
  435.  
  436. else
  437. if (location[flag]) then
  438. if (not pcall(function()
  439. return location[flag].UserInputType
  440. end)) then
  441. local name = tostring(location[flag])
  442. button.Text = shortNames[name] or name
  443. else
  444. local name = (location[flag].UserInputType ~= Enum.UserInputType.Keyboard and location[flag].UserInputType.Name or location[flag].KeyCode.Name);
  445. button.Text = shortNames[name] or name;
  446. end
  447. end
  448. end
  449.  
  450. wait(0.1)
  451. library.binding = false;
  452. end)
  453.  
  454. if location[flag] then
  455. button.Text = shortNames[tostring(location[flag].Name)] or tostring(location[flag].Name)
  456. end
  457.  
  458. library.binds[flag] = {
  459. location = location;
  460. callback = callback;
  461. };
  462.  
  463. self:Resize();
  464. end
  465.  
  466. function types:Section(name)
  467. local order = self:GetOrder();
  468. local determinedSize = UDim2.new(1, 0, 0, 25)
  469. local determinedPos = UDim2.new(0, 0, 0, 4);
  470. local secondarySize = UDim2.new(1, 0, 0, 20);
  471.  
  472. if order == 0 then
  473. determinedSize = UDim2.new(1, 0, 0, 21)
  474. determinedPos = UDim2.new(0, 0, 0, -1);
  475. secondarySize = nil
  476. end
  477.  
  478. local check = library:Create('Frame', {
  479. Name = 'Section';
  480. BackgroundTransparency = 1;
  481. Size = determinedSize;
  482. BackgroundColor3 = library.options.sectncolor;
  483. BorderSizePixel = 0;
  484. LayoutOrder = order;
  485. library:Create('TextLabel', {
  486. Name = 'section_lbl';
  487. Text = name;
  488. BackgroundTransparency = 0;
  489. BorderSizePixel = 0;
  490. BackgroundColor3 = library.options.sectncolor;
  491. TextColor3 = library.options.textcolor;
  492. Position = determinedPos;
  493. Size = (secondarySize or UDim2.new(1, 0, 1, 0));
  494. Font = library.options.font;
  495. TextSize = library.options.fontsize;
  496. TextStrokeTransparency = library.options.textstroke;
  497. TextStrokeColor3 = library.options.strokecolor;
  498. });
  499. Parent = self.container;
  500. });
  501.  
  502. self:Resize();
  503. end
  504.  
  505. function types:Slider(name, options, callback)
  506. local default = options.default or options.min;
  507. local min = options.min or 0;
  508. local max = options.max or 1;
  509. local location = options.location or self.flags;
  510. local precise = options.precise or false -- e.g 0, 1 vs 0, 0.1, 0.2, ...
  511. local flag = options.flag or "";
  512. local callback = callback or function() end
  513.  
  514. location[flag] = default;
  515.  
  516. local check = library:Create('Frame', {
  517. BackgroundTransparency = 1;
  518. Size = UDim2.new(1, 0, 0, 25);
  519. LayoutOrder = self:GetOrder();
  520. library:Create('TextLabel', {
  521. Name = name;
  522. TextStrokeTransparency = library.options.textstroke;
  523. TextStrokeColor3 = library.options.strokecolor;
  524. Text = "\r" .. name;
  525. BackgroundTransparency = 1;
  526. TextColor3 = library.options.textcolor;
  527. Position = UDim2.new(0, 5, 0, 2);
  528. Size = UDim2.new(1, -5, 1, 0);
  529. TextXAlignment = Enum.TextXAlignment.Left;
  530. Font = library.options.font;
  531. TextSize = library.options.fontsize;
  532. library:Create('Frame', {
  533. Name = 'Container';
  534. Size = UDim2.new(0, 60, 0, 20);
  535. Position = UDim2.new(1, -65, 0, 3);
  536. BackgroundTransparency = 1;
  537. --BorderColor3 = library.options.bordercolor;
  538. BorderSizePixel = 0;
  539. library:Create('TextLabel', {
  540. Name = 'ValueLabel';
  541. Text = default;
  542. BackgroundTransparency = 1;
  543. TextColor3 = library.options.textcolor;
  544. Position = UDim2.new(0, -10, 0, 0);
  545. Size = UDim2.new(0, 1, 1, 0);
  546. TextXAlignment = Enum.TextXAlignment.Right;
  547. Font = library.options.font;
  548. TextSize = library.options.fontsize;
  549. TextStrokeTransparency = library.options.textstroke;
  550. TextStrokeColor3 = library.options.strokecolor;
  551. });
  552. library:Create('TextButton', {
  553. Name = 'Button';
  554. Size = UDim2.new(0, 5, 1, -2);
  555. Position = UDim2.new(0, 0, 0, 1);
  556. AutoButtonColor = false;
  557. Text = "";
  558. BackgroundColor3 = Color3.fromRGB(20, 20, 20);
  559. BorderSizePixel = 0;
  560. ZIndex = 2;
  561. TextStrokeTransparency = library.options.textstroke;
  562. TextStrokeColor3 = library.options.strokecolor;
  563. });
  564. library:Create('Frame', {
  565. Name = 'Line';
  566. BackgroundTransparency = 0;
  567. Position = UDim2.new(0, 0, 0.5, 0);
  568. Size = UDim2.new(1, 0, 0, 1);
  569. BackgroundColor3 = library.options.textcolor;
  570. BorderSizePixel = 0;
  571. });
  572. })
  573. });
  574. Parent = self.container;
  575. });
  576.  
  577. local overlay = check:FindFirstChild(name);
  578.  
  579. local renderSteppedConnection;
  580. local inputBeganConnection;
  581. local inputEndedConnection;
  582. local mouseLeaveConnection;
  583. local mouseDownConnection;
  584. local mouseUpConnection;
  585.  
  586. check:FindFirstChild(name).Container.MouseEnter:connect(function()
  587. local function update()
  588. if renderSteppedConnection then renderSteppedConnection:disconnect() end
  589.  
  590.  
  591. renderSteppedConnection = game:GetService('RunService').RenderStepped:connect(function()
  592. local mouse = game:GetService("UserInputService"):GetMouseLocation()
  593. local percent = (mouse.X - overlay.Container.AbsolutePosition.X) / (overlay.Container.AbsoluteSize.X)
  594. percent = math.clamp(percent, 0, 1)
  595. percent = tonumber(string.format("%.2f", percent))
  596.  
  597. overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  598.  
  599. local num = min + (max - min) * percent
  600. local value = (precise and num or math.floor(num))
  601.  
  602. overlay.Container.ValueLabel.Text = value;
  603. callback(tonumber(value))
  604. location[flag] = tonumber(value)
  605. end)
  606. end
  607.  
  608. local function disconnect()
  609. if renderSteppedConnection then renderSteppedConnection:disconnect() end
  610. if inputBeganConnection then inputBeganConnection:disconnect() end
  611. if inputEndedConnection then inputEndedConnection:disconnect() end
  612. if mouseLeaveConnection then mouseLeaveConnection:disconnect() end
  613. if mouseUpConnection then mouseUpConnection:disconnect() end
  614. end
  615.  
  616. inputBeganConnection = check:FindFirstChild(name).Container.InputBegan:connect(function(input)
  617. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  618. update()
  619. end
  620. end)
  621.  
  622. inputEndedConnection = check:FindFirstChild(name).Container.InputEnded:connect(function(input)
  623. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  624. disconnect()
  625. end
  626. end)
  627.  
  628. mouseDownConnection = check:FindFirstChild(name).Container.Button.MouseButton1Down:connect(update)
  629. mouseUpConnection = game:GetService("UserInputService").InputEnded:connect(function(a, b)
  630. if a.UserInputType == Enum.UserInputType.MouseButton1 and (mouseDownConnection.Connected) then
  631. disconnect()
  632. end
  633. end)
  634. end)
  635.  
  636. if default ~= min then
  637. local percent = 1 - ((max - default) / (max - min))
  638. local number = default
  639.  
  640. number = tonumber(string.format("%.2f", number))
  641. if (not precise) then
  642. number = math.floor(number)
  643. end
  644.  
  645. overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  646. overlay.Container.ValueLabel.Text = number
  647. end
  648.  
  649. self:Resize();
  650. return {
  651. Set = function(self, value)
  652. local percent = 1 - ((max - value) / (max - min))
  653. local number = value
  654.  
  655. number = tonumber(string.format("%.2f", number))
  656. if (not precise) then
  657. number = math.floor(number)
  658. end
  659.  
  660. overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  661. overlay.Container.ValueLabel.Text = number
  662. location[flag] = number
  663. callback(number)
  664. end
  665. }
  666. end
  667.  
  668. function types:SearchBox(text, options, callback)
  669. local list = options.list or {};
  670. local flag = options.flag or "";
  671. local location = options.location or self.flags;
  672. local callback = callback or function() end;
  673.  
  674. local busy = false;
  675. local box = library:Create('Frame', {
  676. BackgroundTransparency = 1;
  677. Size = UDim2.new(1, 0, 0, 25);
  678. LayoutOrder = self:GetOrder();
  679. library:Create('TextBox', {
  680. Text = "";
  681. PlaceholderText = text;
  682. PlaceholderColor3 = Color3.fromRGB(60, 60, 60);
  683. Font = library.options.font;
  684. TextSize = library.options.fontsize;
  685. Name = 'Box';
  686. Size = UDim2.new(1, -10, 0, 20);
  687. Position = UDim2.new(0, 5, 0, 4);
  688. TextColor3 = library.options.textcolor;
  689. BackgroundColor3 = library.options.dropcolor;
  690. BorderColor3 = library.options.bordercolor;
  691. TextStrokeTransparency = library.options.textstroke;
  692. TextStrokeColor3 = library.options.strokecolor;
  693. library:Create('ScrollingFrame', {
  694. Position = UDim2.new(0, 0, 1, 1);
  695. Name = 'Container';
  696. BackgroundColor3 = library.options.btncolor;
  697. ScrollBarThickness = 0;
  698. BorderSizePixel = 0;
  699. BorderColor3 = library.options.bordercolor;
  700. Size = UDim2.new(1, 0, 0, 0);
  701. library:Create('UIListLayout', {
  702. Name = 'ListLayout';
  703. SortOrder = Enum.SortOrder.LayoutOrder;
  704. });
  705. ZIndex = 2;
  706. });
  707. });
  708. Parent = self.container;
  709. })
  710.  
  711. local function rebuild(text)
  712. box:FindFirstChild('Box').Container.ScrollBarThickness = 0
  713. for i, child in next, box:FindFirstChild('Box').Container:GetChildren() do
  714. if (not child:IsA('UIListLayout')) then
  715. child:Destroy();
  716. end
  717. end
  718.  
  719. if #text > 0 then
  720. for i, v in next, list do
  721. if string.sub(string.lower(v), 1, string.len(text)) == string.lower(text) then
  722. local button = library:Create('TextButton', {
  723. Text = v;
  724. Font = library.options.font;
  725. TextSize = library.options.fontsize;
  726. TextColor3 = library.options.textcolor;
  727. BorderColor3 = library.options.bordercolor;
  728. TextStrokeTransparency = library.options.textstroke;
  729. TextStrokeColor3 = library.options.strokecolor;
  730. Parent = box:FindFirstChild('Box').Container;
  731. Size = UDim2.new(1, 0, 0, 20);
  732. LayoutOrder = i;
  733. BackgroundColor3 = library.options.btncolor;
  734. ZIndex = 2;
  735. })
  736.  
  737. button.MouseButton1Click:connect(function()
  738. busy = true;
  739. box:FindFirstChild('Box').Text = button.Text;
  740. wait();
  741. busy = false;
  742.  
  743. location[flag] = button.Text;
  744. callback(location[flag])
  745.  
  746. box:FindFirstChild('Box').Container.ScrollBarThickness = 0
  747. for i, child in next, box:FindFirstChild('Box').Container:GetChildren() do
  748. if (not child:IsA('UIListLayout')) then
  749. child:Destroy();
  750. end
  751. end
  752. box:FindFirstChild('Box').Container:TweenSize(UDim2.new(1, 0, 0, 0), 'Out', 'Quint', .3, true)
  753. end)
  754. end
  755. end
  756. end
  757.  
  758. local c = box:FindFirstChild('Box').Container:GetChildren()
  759. local ry = (20 * (#c)) - 20
  760.  
  761. local y = math.clamp((20 * (#c)) - 20, 0, 100)
  762. if ry > 100 then
  763. box:FindFirstChild('Box').Container.ScrollBarThickness = 5;
  764. end
  765.  
  766. box:FindFirstChild('Box').Container:TweenSize(UDim2.new(1, 0, 0, y), 'Out', 'Quint', .3, true)
  767. box:FindFirstChild('Box').Container.CanvasSize = UDim2.new(1, 0, 0, (20 * (#c)) - 20)
  768. end
  769.  
  770. box:FindFirstChild('Box'):GetPropertyChangedSignal('Text'):connect(function()
  771. if (not busy) then
  772. rebuild(box:FindFirstChild('Box').Text)
  773. end
  774. end);
  775.  
  776. local function reload(new_list)
  777. list = new_list;
  778. rebuild("")
  779. end
  780. self:Resize();
  781. return reload, box:FindFirstChild('Box');
  782. end
  783.  
  784. function types:Dropdown(name, options, callback)
  785. local location = options.location or self.flags;
  786. local flag = options.flag or "";
  787. local callback = callback or function() end;
  788. local list = options.list or {};
  789.  
  790. location[flag] = list[1]
  791. local check = library:Create('Frame', {
  792. BackgroundTransparency = 1;
  793. Size = UDim2.new(1, 0, 0, 25);
  794. BackgroundColor3 = Color3.fromRGB(25, 25, 25);
  795. BorderSizePixel = 0;
  796. LayoutOrder = self:GetOrder();
  797. library:Create('Frame', {
  798. Name = 'dropdown_lbl';
  799. BackgroundTransparency = 0;
  800. BackgroundColor3 = library.options.dropcolor;
  801. Position = UDim2.new(0, 5, 0, 4);
  802. BorderColor3 = library.options.bordercolor;
  803. Size = UDim2.new(1, -10, 0, 20);
  804. library:Create('TextLabel', {
  805. Name = 'Selection';
  806. Size = UDim2.new(1, 0, 1, 0);
  807. Text = list[1];
  808. TextColor3 = library.options.textcolor;
  809. BackgroundTransparency = 1;
  810. Font = library.options.font;
  811. TextSize = library.options.fontsize;
  812. TextStrokeTransparency = library.options.textstroke;
  813. TextStrokeColor3 = library.options.strokecolor;
  814. });
  815. library:Create("TextButton", {
  816. Name = 'drop';
  817. BackgroundTransparency = 1;
  818. Size = UDim2.new(0, 20, 1, 0);
  819. Position = UDim2.new(1, -25, 0, 0);
  820. Text = 'v';
  821. TextColor3 = library.options.textcolor;
  822. Font = library.options.font;
  823. TextSize = library.options.fontsize;
  824. TextStrokeTransparency = library.options.textstroke;
  825. TextStrokeColor3 = library.options.strokecolor;
  826. })
  827. });
  828. Parent = self.container;
  829. });
  830.  
  831. local button = check:FindFirstChild('dropdown_lbl').drop;
  832. local input;
  833.  
  834. button.MouseButton1Click:connect(function()
  835. if (input and input.Connected) then
  836. return
  837. end
  838.  
  839. check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = Color3.fromRGB(60, 60, 60);
  840. check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text = name;
  841. local c = 0;
  842. for i, v in next, list do
  843. c = c + 20;
  844. end
  845.  
  846. local size = UDim2.new(1, 0, 0, c)
  847.  
  848. local clampedSize;
  849. local scrollSize = 0;
  850. if size.Y.Offset > 100 then
  851. clampedSize = UDim2.new(1, 0, 0, 100)
  852. scrollSize = 5;
  853. end
  854.  
  855. local goSize = (clampedSize ~= nil and clampedSize) or size;
  856. local container = library:Create('ScrollingFrame', {
  857. TopImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png';
  858. BottomImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png';
  859. Name = 'DropContainer';
  860. Parent = check:FindFirstChild('dropdown_lbl');
  861. Size = UDim2.new(1, 0, 0, 0);
  862. BackgroundColor3 = library.options.bgcolor;
  863. BorderColor3 = library.options.bordercolor;
  864. Position = UDim2.new(0, 0, 1, 0);
  865. ScrollBarThickness = scrollSize;
  866. CanvasSize = UDim2.new(0, 0, 0, size.Y.Offset);
  867. ZIndex = 5;
  868. ClipsDescendants = true;
  869. library:Create('UIListLayout', {
  870. Name = 'List';
  871. SortOrder = Enum.SortOrder.LayoutOrder
  872. })
  873. })
  874.  
  875. for i, v in next, list do
  876. local btn = library:Create('TextButton', {
  877. Size = UDim2.new(1, 0, 0, 20);
  878. BackgroundColor3 = library.options.btncolor;
  879. BorderColor3 = library.options.bordercolor;
  880. Text = v;
  881. Font = library.options.font;
  882. TextSize = library.options.fontsize;
  883. LayoutOrder = i;
  884. Parent = container;
  885. ZIndex = 5;
  886. TextColor3 = library.options.textcolor;
  887. TextStrokeTransparency = library.options.textstroke;
  888. TextStrokeColor3 = library.options.strokecolor;
  889. })
  890.  
  891. btn.MouseButton1Click:connect(function()
  892. check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = library.options.textcolor
  893. check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text = btn.Text;
  894.  
  895. location[flag] = tostring(btn.Text);
  896. callback(location[flag])
  897.  
  898. game:GetService('Debris'):AddItem(container, 0)
  899. input:disconnect();
  900. end)
  901. end
  902.  
  903. container:TweenSize(goSize, 'Out', 'Quint', .3, true)
  904.  
  905. local function isInGui(frame)
  906. local mloc = game:GetService('UserInputService'):GetMouseLocation();
  907. local mouse = Vector2.new(mloc.X, mloc.Y - 36);
  908.  
  909. local x1, x2 = frame.AbsolutePosition.X, frame.AbsolutePosition.X + frame.AbsoluteSize.X;
  910. local y1, y2 = frame.AbsolutePosition.Y, frame.AbsolutePosition.Y + frame.AbsoluteSize.Y;
  911.  
  912. return (mouse.X >= x1 and mouse.X <= x2) and (mouse.Y >= y1 and mouse.Y <= y2)
  913. end
  914.  
  915. input = game:GetService('UserInputService').InputBegan:connect(function(a)
  916. if a.UserInputType == Enum.UserInputType.MouseButton1 and (not isInGui(container)) then
  917. check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = library.options.textcolor
  918. check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text = location[flag];
  919.  
  920. container:TweenSize(UDim2.new(1, 0, 0, 0), 'In', 'Quint', .3, true)
  921. wait(0.15)
  922.  
  923. game:GetService('Debris'):AddItem(container, 0)
  924. input:disconnect();
  925. end
  926. end)
  927. end)
  928.  
  929. self:Resize();
  930. local function reload(self, array)
  931. options = array;
  932. location[flag] = array[1];
  933. pcall(function()
  934. input:disconnect()
  935. end)
  936. check:WaitForChild('dropdown_lbl').Selection.Text = location[flag]
  937. check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = library.options.textcolor
  938. game:GetService('Debris'):AddItem(container, 0)
  939. end
  940.  
  941. return {
  942. Refresh = reload;
  943. }
  944. end
  945. end
  946.  
  947. function library:Create(class, data)
  948. local obj = Instance.new(class);
  949. for i, v in next, data do
  950. if i ~= 'Parent' then
  951.  
  952. if typeof(v) == "Instance" then
  953. v.Parent = obj;
  954. else
  955. obj[i] = v
  956. end
  957. end
  958. end
  959.  
  960. obj.Parent = data.Parent;
  961. return obj
  962. end
  963.  
  964. default = {
  965. topcolor = Color3.fromRGB(30, 30, 30);
  966. titlecolor = Color3.fromRGB(255, 255, 255);
  967.  
  968. underlinecolor = Color3.fromRGB(0, 255, 140);
  969. bgcolor = Color3.fromRGB(35, 35, 35);
  970. boxcolor = Color3.fromRGB(35, 35, 35);
  971. btncolor = Color3.fromRGB(25, 25, 25);
  972. dropcolor = Color3.fromRGB(25, 25, 25);
  973. sectncolor = Color3.fromRGB(25, 25, 25);
  974. bordercolor = Color3.fromRGB(60, 60, 60);
  975.  
  976. font = Enum.Font.SourceSans;
  977. titlefont = Enum.Font.Code;
  978.  
  979. fontsize = 17;
  980. titlesize = 18;
  981.  
  982. textstroke = 1;
  983. titlestroke = 1;
  984.  
  985. strokecolor = Color3.fromRGB(0, 0, 0);
  986.  
  987. textcolor = Color3.fromRGB(255, 255, 255);
  988. titletextcolor = Color3.fromRGB(255, 255, 255);
  989.  
  990. placeholdercolor = Color3.fromRGB(255, 255, 255);
  991. titlestrokecolor = Color3.fromRGB(0, 0, 0);
  992. }
  993.  
  994. function library:CreateWindow(name, options)
  995.  
  996. if (not library.container) then
  997. library.container = self:Create("ScreenGui", {
  998. self:Create('Frame', {
  999. Name = 'Container';
  1000. Size = UDim2.new(1, -30, 1, 0);
  1001. Position = UDim2.new(0, 20, 0, 20);
  1002. BackgroundTransparency = 1;
  1003. Active = false;
  1004. });
  1005. Parent = game:GetService("CoreGui");
  1006. }):FindFirstChild('Container');
  1007. end
  1008. if (not library.options) then
  1009. library.options = setmetatable(options or {}, {__index = defaults})
  1010. end
  1011. if (options) then
  1012. library.options = setmetatable(options, {__index = default})
  1013. end
  1014.  
  1015. local window = types.window(name, library.options);
  1016. dragger.new(window.object);
  1017. return window
  1018. end
  1019.  
  1020. library.options = setmetatable({}, {__index = default})
  1021.  
  1022. spawn(function()
  1023. while true do
  1024. for i=0, 1, 1 / 300 do
  1025. for _, obj in next, library.rainbowtable do
  1026. obj.BackgroundColor3 = Color3.fromHSV(i, 1, 1);
  1027. end
  1028. wait()
  1029. end;
  1030. end
  1031. end)
  1032.  
  1033. local function isreallypressed(bind, inp)
  1034. local key = bind
  1035. if typeof(key) == "Instance" then
  1036. if key.UserInputType == Enum.UserInputType.Keyboard and inp.KeyCode == key.KeyCode then
  1037. return true;
  1038. elseif tostring(key.UserInputType):find('MouseButton') and inp.UserInputType == key.UserInputType then
  1039. return true
  1040. end
  1041. end
  1042. if tostring(key):find'MouseButton1' then
  1043. return key == inp.UserInputType
  1044. else
  1045. return key == inp.KeyCode
  1046. end
  1047. end
  1048.  
  1049. game:GetService("UserInputService").InputBegan:connect(function(input)
  1050. if (not library.binding) then
  1051. for idx, binds in next, library.binds do
  1052. local real_binding = binds.location[idx];
  1053. if real_binding and isreallypressed(real_binding, input) then
  1054. binds.callback()
  1055. end
  1056. end
  1057. end
  1058. end)
  1059. end
  1060.  
  1061. return library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement