Advertisement
matekaOSF2

Untitled

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