Advertisement
Systemconf

Untitled

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