StenHisDirt

Wally lib

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