Advertisement
Vortexture

another wally UI lib reupload

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