ninojesse

library

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