Advertisement
May0Reese

yes2

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