IvesAwadi

Custom Wally UI v2

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