Advertisement
matekaOSF2

Untitled

Nov 28th, 2020 (edited)
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 54.40 KB | None | 0 0
  1. local vers = "0.45" -- https://api.roblox.com/assets/4133667265/versions
  2. local __instructions = [[
  3. Web/Original:https://pastebin.com/raw/q4cGSQZf
  4. class Window [
  5. Table flags -> default location for values
  6.  
  7. Method Section(name)
  8. @name -> text for the Section
  9.  
  10. Method Label(name)
  11. @name -> text for the label
  12.  
  13. return -> [
  14. Method Set(string) -> sets the label text
  15. label object (Instance)
  16. ]
  17.  
  18. Method Toggle(name, options, callback)
  19. @name -> text for toggle
  20. @options -> array
  21. location (table) -> alternate table to put value in (default = window.flags)
  22. flag (string) -> index for value (e.g location.farming)
  23. autoupdate (boolean) -> will set itself depending on flag (default = false)
  24. updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  25. @callback -> function to call when toggle is changed
  26.  
  27. return -> [
  28. Method Set(number) -> sets toggle value
  29. ]
  30.  
  31. Method Slider(name, options, callback)
  32. @name -> text for slider
  33. @options -> array
  34. location (table) -> alternate table to put value in (default = window.flags)
  35. flag (string) -> index for value (e.g location.farming)
  36. autoupdate (boolean) -> will set itself depending on flag (default = false)
  37. updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  38. precise (boolean) -> wether to show full number or not -- e.g 0, 1 vs 0, 0.1, 0.2, ...
  39. default (number) -> default slider value
  40. min, max (number) -> self explanatory
  41. @callback(value) -> function to call when slider is changed
  42.  
  43. return -> [
  44. Method Set(number) -> sets slider value
  45. ]
  46.  
  47. Method Dropdown(name, options, callback)
  48. @name -> text for dropdown
  49. @options -> array
  50. location (table) -> alternate table to put value in (default = window.flags)
  51. flag (string) -> index for value (e.g location.farming)
  52. autoupdate (boolean) -> will set itself depending on flag (default = false)
  53. updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  54. list -> list of objects to display
  55. @callback(new) -> function to call when dropdown is changed
  56.  
  57. return -> [
  58. Method Refresh(array) -> resets dropdown.list and sets value to first value in array
  59. ]
  60.  
  61. Method Button(name, callback)
  62. @name -> text for button
  63. @callback -> function to call when button is clicked
  64.  
  65. return -> [
  66. Method Fire(<void>) -> calls callback
  67. ]
  68.  
  69. Method Bind(name, options, callback)
  70. @name -> text for keybind
  71. @options -> array
  72. location (table) -> alternate table to put value in (default = window.flags)
  73. flag (string) -> index for value (e.g location.farming)
  74. autoupdate (boolean) -> will set itself depending on flag (default = false)
  75. updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  76. kbonly (bool) -> keyboard keys only (no mouse)
  77. default (EnumItem) -> default key for bind;
  78.  
  79. @callback(key) -> function to call when bind is changed
  80.  
  81. Method Box(name, options, callback)
  82. @name -> text for box
  83. @options -> array
  84. location (table) -> alternate table to put value in (default = window.flags)
  85. flag (string) -> index for value (e.g location.farming)
  86. autoupdate (boolean) -> will set itself depending on flag (default = false)
  87. updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  88. type (string) -> if type is "number", box will only accept numbers
  89. min, max (number) -> used to define constraints when type is numbers only
  90.  
  91. @callback(box, new, old, enter) -> function to call when box is changed
  92. box -> box object;
  93. new -> new value;
  94. old -> old value;
  95. enter -> wether enter was pressed
  96.  
  97. returns -> box object (Instance)
  98.  
  99. Method SearchBox(name, options, callback)
  100. @name -> text for searchbox
  101. @options -> array
  102. location (table) -> alternate table to put value in (default = window.flags)
  103. flag (string) -> index for value (e.g location.farming)
  104. autoupdate (boolean) -> will set itself depending on flag (default = false)
  105. updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  106. list -> list of objects to search for
  107. @callback(new) -> function to call when dropdown is changed
  108.  
  109. return -> [
  110. Function (array) -> resets dropdown.list and sets value to first value in array
  111. ]
  112. ]
  113. ]]
  114.  
  115. local utf8 = utf8
  116. if not utf8 or not utf8.char or utf8.char(10003) == utf8.char(8238) then -- bad exploit
  117. local utf8 = {
  118. char = function(id)
  119. return ({
  120. [8238] = "\226\128\174", -- Checkmark
  121. [9492] = "\226\148\148", -- Pipe (Right)
  122. [10003] = "\226\156\147" -- Right to left (unused)
  123. })[id] or ""
  124. end
  125. }
  126. end
  127.  
  128. local library = {
  129. count = 0,
  130. version = vers,
  131. queue = {},
  132. callbacks = {},
  133. rainbowtable = {},
  134. toggled = true,
  135. binds = {},
  136. connections = {},
  137. default_auto_update = false,
  138. default_update_delay = 4
  139. }
  140. local randomcolor = Color3.fromRGB(tick() % 256, math.random(100000) % 256, (math.random() * 1280) % 256)
  141. local default = {
  142. topcolor = Color3.fromRGB(30, 30, 30),
  143. titlecolor = Color3.fromRGB(255, 255, 255),
  144. underlinecolor = randomcolor or Color3.fromRGB(0, 255, 140),
  145. bgcolor = Color3.fromRGB(35, 35, 35),
  146. boxcolor = Color3.fromRGB(35, 35, 35),
  147. btncolor = Color3.fromRGB(25, 25, 25),
  148. dropcolor = Color3.fromRGB(25, 25, 25),
  149. sectncolor = Color3.fromRGB(25, 25, 25),
  150. bordercolor = Color3.fromRGB(60, 60, 60),
  151. font = Enum.Font.SourceSans,
  152. titlefont = Enum.Font.Code,
  153. fontsize = 17,
  154. titlesize = 18,
  155. textstroke = 1,
  156. titlestroke = 1,
  157. strokecolor = Color3.fromRGB(0, 0, 0),
  158. textcolor = Color3.fromRGB(255, 255, 255),
  159. titletextcolor = Color3.fromRGB(255, 255, 255),
  160. placeholdercolor = Color3.fromRGB(255, 255, 255),
  161. titlestrokecolor = Color3.fromRGB(0, 0, 0)
  162. }
  163. local dragger = {}
  164. local mouse = game:GetService("Players").LocalPlayer:GetMouse()
  165. local inputService = game:GetService("UserInputService")
  166. local heartbeat = game:GetService("RunService").Heartbeat
  167. function dragger.new(frame)
  168. local s, event = pcall(function()
  169. return frame.MouseEnter
  170. end)
  171. if s then
  172. frame.Active = true
  173. table.insert(library.connections, event:Connect(function()
  174. local input = frame.InputBegan:Connect(function(key)
  175. if key.UserInputType == Enum.UserInputType.MouseButton1 then
  176. local objectPosition = Vector2.new(mouse.X - frame.AbsolutePosition.X, mouse.Y - frame.AbsolutePosition.Y)
  177. while heartbeat:wait() and inputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  178. pcall(function()
  179. 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)
  180. end)
  181. end
  182. end
  183. end)
  184. table.insert(library.connections, input)
  185. local leave
  186. leave = frame.MouseLeave:Connect(function()
  187. input:Disconnect()
  188. leave:Disconnect()
  189. end)
  190. table.insert(library.connections, leave)
  191. end))
  192. end
  193. end
  194. library.connections.hide = game:GetService("UserInputService").InputBegan:Connect(function(key, gpe)
  195. if (not gpe) then
  196. if key.KeyCode == Enum.KeyCode.RightControl then
  197. library.toggled = not library.toggled
  198. for i, data in next, library.queue do
  199. pcall(function()
  200. local pos = (library.toggled and data.p or UDim2.new(-1, 0, -0.5, 0))
  201. data.w:TweenPosition(pos, (library.toggled and "Out" or "In"), "Quad", 0.15, true)
  202. end)
  203. wait()
  204. end
  205. end
  206. end
  207. end)
  208. local types = {}
  209. types.__index = types
  210. function types.window(name, options)
  211. options = options or {}
  212. library.count = library.count + 1
  213. local newWindow = library:Create("Frame", {
  214. Name = name,
  215. Size = UDim2.new(0, 190, 0, 30),
  216. BackgroundColor3 = options.topcolor,
  217. BorderSizePixel = 0,
  218. Parent = library.container,
  219. Position = UDim2.new(0, (15 + (200 * library.count) - 200), 0, 0),
  220. ZIndex = 3,
  221. library:Create("TextLabel", {
  222. Text = name,
  223. Size = UDim2.new(1, -10, 1, 0),
  224. Position = UDim2.new(0, 5, 0, 0),
  225. BackgroundTransparency = 1,
  226. Font = Enum.Font.Code,
  227. TextSize = options.titlesize,
  228. Font = options.titlefont,
  229. TextColor3 = options.titletextcolor,
  230. TextStrokeTransparency = library.options.titlestroke,
  231. TextStrokeColor3 = library.options.titlestrokecolor,
  232. ZIndex = 3
  233. }),
  234. library:Create("TextButton", {
  235. Size = UDim2.new(0, 30, 0, 30),
  236. Position = UDim2.new(1, -35, 0, 0),
  237. BackgroundTransparency = 1,
  238. Text = "-",
  239. TextSize = options.titlesize,
  240. Font = options.titlefont,
  241. Name = 'window_toggle',
  242. TextColor3 = options.titletextcolor,
  243. TextStrokeTransparency = library.options.titlestroke,
  244. TextStrokeColor3 = library.options.titlestrokecolor,
  245. ZIndex = 3
  246. }),
  247. library:Create("Frame", {
  248. Name = "Underline",
  249. Size = UDim2.new(1, 0, 0, 2),
  250. Position = UDim2.new(0, 0, 1, -2),
  251. BackgroundColor3 = (options.underlinecolor ~= "rainbow" and options.underlinecolor) or Color3.new(),
  252. BorderSizePixel = 0,
  253. ZIndex = 3
  254. }),
  255. library:Create("Frame", {
  256. Name = 'container',
  257. Position = UDim2.new(0, 0, 1, 0),
  258. Size = UDim2.new(1, 0, 0, 0),
  259. BorderSizePixel = 0,
  260. BackgroundColor3 = options.bgcolor,
  261. ClipsDescendants = false,
  262. library:Create("UIListLayout", {
  263. Name = 'List',
  264. SortOrder = Enum.SortOrder.LayoutOrder
  265. })
  266. })
  267. })
  268. if options.underlinecolor == "rainbow" then
  269. table.insert(library.rainbowtable, newWindow:FindFirstChild("Underline"))
  270. end
  271. local window = setmetatable({
  272. count = 0,
  273. object = newWindow,
  274. container = newWindow.container,
  275. toggled = true,
  276. flags = {}
  277. }, types)
  278. table.insert(library.queue, {
  279. w = window.object,
  280. p = window.object.Position
  281. })
  282. table.insert(library.connections, newWindow:FindFirstChild("window_toggle").MouseButton1Click:Connect(function()
  283. window.toggled = not window.toggled
  284. newWindow:FindFirstChild("window_toggle").Text = (window.toggled and "-" or "+")
  285. if (not window.toggled) then
  286. window.container.ClipsDescendants = true
  287. end
  288. wait()
  289. local y = 0
  290. for i, v in next, window.container:GetChildren() do
  291. if (not v:IsA("UIListLayout")) then
  292. y = y + v.AbsoluteSize.Y
  293. end
  294. end
  295. local targetSize = window.toggled and UDim2.new(1, 0, 0, y + 5) or UDim2.new(1, 0, 0, 0)
  296. local targetDirection = window.toggled and "In" or "Out"
  297. window.container:TweenSize(targetSize, targetDirection, "Quad", 0.15, true)
  298. wait(.15)
  299. if window.toggled then
  300. window.container.ClipsDescendants = false
  301. end
  302. end))
  303. return window
  304. end
  305. function types:Resize()
  306. local y = 0
  307. for i, v in next, self.container:GetChildren() do
  308. if (not v:IsA("UIListLayout")) then
  309. y = y + v.AbsoluteSize.Y
  310. end
  311. end
  312. self.container.Size = UDim2.new(1, 0, 0, y + 5)
  313. end
  314. function types:GetOrder()
  315. local c = 0
  316. for i, v in next, self.container:GetChildren() do
  317. if (not v:IsA("UIListLayout")) then
  318. c = c + 1
  319. end
  320. end
  321. return c
  322. end
  323. function types:Label(name)
  324. local order = self:GetOrder()
  325. local determinedSize = UDim2.new(1, 0, 0, 25)
  326. local determinedPos = UDim2.new(0, 0, 0, 4)
  327. local secondarySize = UDim2.new(1, 0, 0, 20)
  328. if order == 0 then
  329. determinedSize = UDim2.new(1, 0, 0, 21)
  330. determinedPos = UDim2.new(0, 0, 0, -1)
  331. secondarySize = nil
  332. end
  333. local check = library:Create("Frame", {
  334. Name = 'Label',
  335. BackgroundTransparency = 1,
  336. Size = determinedSize,
  337. BackgroundColor3 = library.options.sectncolor,
  338. BorderSizePixel = 0,
  339. LayoutOrder = order,
  340. library:Create("TextLabel", {
  341. Name = "label_lbl",
  342. Text = name,
  343. BackgroundTransparency = 0,
  344. BorderSizePixel = 0,
  345. BackgroundColor3 = library.options.sectncolor,
  346. TextColor3 = library.options.textcolor,
  347. Position = determinedPos,
  348. Size = (secondarySize or UDim2.new(1, 0, 1, 0)),
  349. Font = library.options.font,
  350. TextSize = library.options.fontsize,
  351. TextStrokeTransparency = library.options.textstroke,
  352. TextStrokeColor3 = library.options.strokecolor
  353. }),
  354. Parent = self.container
  355. })
  356. self:Resize()
  357. local label = check:FindFirstChild("label_lbl")
  358. return {
  359. Set = function(str)
  360. label.Text = str
  361. return label
  362. end,
  363. label
  364. }
  365. end
  366. function types:Toggle(name, options, callback)
  367. local _default = options.default or false
  368. local location = options.location or self.flags
  369. local flag = options.flag or tostring(name)
  370. local callback = callback or function()
  371. end
  372. location[flag] = location[flag] or _default
  373. local check = library:Create("Frame", {
  374. BackgroundTransparency = 1,
  375. Size = UDim2.new(1, 0, 0, 25),
  376. LayoutOrder = self:GetOrder(),
  377. library:Create("TextLabel", {
  378. Name = name,
  379. Text = "\r" .. name,
  380. BackgroundTransparency = 1,
  381. TextColor3 = library.options.textcolor,
  382. Position = UDim2.new(0, 5, 0, 0),
  383. Size = UDim2.new(1, -5, 1, 0),
  384. TextXAlignment = Enum.TextXAlignment.Left,
  385. Font = library.options.font,
  386. TextSize = library.options.fontsize,
  387. TextStrokeTransparency = library.options.textstroke,
  388. TextStrokeColor3 = library.options.strokecolor,
  389. library:Create("TextButton", {
  390. Text = (location[flag] and utf8.char(10003) or ""),
  391. Font = library.options.font,
  392. TextSize = library.options.fontsize,
  393. Name = 'Checkmark',
  394. Size = UDim2.new(0, 20, 0, 20),
  395. Position = UDim2.new(1, -25, 0, 4),
  396. TextColor3 = library.options.textcolor,
  397. BackgroundColor3 = library.options.bgcolor,
  398. BorderColor3 = library.options.bordercolor,
  399. TextStrokeTransparency = library.options.textstroke,
  400. TextStrokeColor3 = library.options.strokecolor
  401. })
  402. }),
  403. Parent = self.container
  404. })
  405. local function click(t)
  406. if type(location[flag]) ~= "boolean" then
  407. location[flag] = (type(location[flag]) ~= "nil")
  408. end
  409. location[flag] = check:FindFirstChild(name).Checkmark.Text ~= utf8.char(10003)
  410. check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or ""
  411. callback(location[flag])
  412. end
  413. table.insert(library.connections, check:FindFirstChild(name).Checkmark.MouseButton1Click:Connect(click))
  414. library.callbacks[flag] = click
  415. if location[flag] == true then
  416. callback(true)
  417. end
  418. self:Resize()
  419. return {
  420. Set = function(self, b)
  421. location[flag] = b
  422. callback(location[flag])
  423. check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or ""
  424. end,
  425. spawn(function()
  426. if nil == options.autoupdate then
  427. options.autoupdate = library.default_auto_update
  428. end
  429. if nil == options.updatedelay then
  430. options.updatedelay = library.default_update_delay
  431. end
  432. if type(options.autoupdate) == "number" then
  433. options.autoupdate, options.updatedelay = true, options.autoupdate
  434. end
  435. local last = location[flag]
  436. while (options.autoupdate and not library.toggled and wait()) or wait(0.2) do
  437. if options.autoupdate and library.toggled then
  438. if last ~= location[flag] then
  439. callback(location[flag])
  440. end
  441. if not xpcall(function()
  442. check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or ""
  443. end, warn) then
  444. return
  445. end
  446. last = location[flag]
  447. wait(tonumber(tonumber(options.updatedelay or 1) or 1))
  448. end
  449. end
  450. end)
  451. }
  452. end
  453. function types:Button(name, callback)
  454. callback = callback or function()
  455. end
  456. local check = library:Create("Frame", {
  457. BackgroundTransparency = 1,
  458. Size = UDim2.new(1, 0, 0, 25),
  459. LayoutOrder = self:GetOrder(),
  460. library:Create("TextButton", {
  461. Name = name,
  462. Text = name,
  463. BackgroundColor3 = library.options.btncolor,
  464. BorderColor3 = library.options.bordercolor,
  465. TextStrokeTransparency = library.options.textstroke,
  466. TextStrokeColor3 = library.options.strokecolor,
  467. TextColor3 = library.options.textcolor,
  468. Position = UDim2.new(0, 5, 0, 5),
  469. Size = UDim2.new(1, -10, 0, 20),
  470. Font = library.options.font,
  471. TextSize = library.options.fontsize
  472. }),
  473. Parent = self.container
  474. })
  475. table.insert(library.connections, check:FindFirstChild(name).MouseButton1Click:Connect(callback))
  476. self:Resize()
  477. return {
  478. Fire = function()
  479. callback()
  480. end
  481. }
  482. end
  483. function types:Box(name, options, callback, altreturn)
  484. local types = options.type or ""
  485. local _default = options.default or ""
  486. local data = options.data
  487. local location = options.location or self.flags
  488. local flag = options.flag or ""
  489. altreturn = altreturn or callback == true
  490. local callback = (callback and type(callback) == "function" and callback) or function()
  491. end
  492. local min = options.min or 0
  493. local max = options.max or 9e9
  494. if (types == 'number' and not tonumber(_default)) or not options.type then
  495. location[flag] = _default
  496. elseif not options.autoupdate then
  497. location[flag] = ""
  498. _default = ""
  499. end
  500. _default = tostring(options.default or "") or ""
  501. if tostring(_default) == "TextBox" then
  502. _default = ""
  503. end
  504. local check = library:Create("Frame", {
  505. BackgroundTransparency = 1,
  506. Size = UDim2.new(1, 0, 0, 25),
  507. LayoutOrder = self:GetOrder(),
  508. library:Create("TextLabel", {
  509. Name = name,
  510. Text = "\r" .. name,
  511. BackgroundTransparency = 1,
  512. TextColor3 = library.options.textcolor,
  513. TextStrokeTransparency = library.options.textstroke,
  514. TextStrokeColor3 = library.options.strokecolor,
  515. Position = UDim2.new(0, 5, 0, 0),
  516. Size = UDim2.new(1, -5, 1, 0),
  517. TextXAlignment = Enum.TextXAlignment.Left,
  518. Font = library.options.font,
  519. TextSize = library.options.fontsize,
  520. library:Create("TextBox", {
  521. TextStrokeTransparency = library.options.textstroke,
  522. TextStrokeColor3 = library.options.strokecolor,
  523. Text = tostring(_default),
  524. Font = library.options.font,
  525. TextSize = library.options.fontsize,
  526. Name = 'Box',
  527. Size = UDim2.new(0, 60, 0, 20),
  528. Position = UDim2.new(1, -65, 0, 3),
  529. TextColor3 = library.options.textcolor,
  530. BackgroundColor3 = library.options.boxcolor,
  531. BorderColor3 = library.options.bordercolor,
  532. PlaceholderColor3 = library.options.placeholdercolor
  533. })
  534. }),
  535. Parent = self.container
  536. })
  537. local box = check:FindFirstChild(name):FindFirstChild("Box")
  538. table.insert(library.connections, box.FocusLost:Connect(function(e)
  539. local old = location[flag]
  540. if types == "number" then
  541. local num = tonumber(box.Text)
  542. if not num then
  543. box.Text = tonumber(location[flag])
  544. else
  545. location[flag] = (min and max and math.clamp(num, min, max)) or num
  546. box.Text = tostring(tonumber(location[flag]) or "nan")
  547. end
  548. else
  549. location[flag] = tostring(box.Text)
  550. end
  551. callback(box, location[flag], old, e)
  552. end))
  553. if types == 'number' then
  554. table.insert(library.connections, box:GetPropertyChangedSignal("Text"):Connect(function()
  555. box.Text = string.gsub(box.Text, "[%a+]", "")
  556. end))
  557. end
  558. spawn(function()
  559. if nil == options.autoupdate then
  560. options.autoupdate = library.default_auto_update
  561. end
  562. if nil == options.updatedelay then
  563. options.updatedelay = library.default_update_delay
  564. end
  565. if type(options.autoupdate) == "number" then
  566. options.autoupdate, options.updatedelay = true, options.autoupdate
  567. end
  568. local last = location[flag]
  569. while (options.autoupdate and not library.toggled and wait()) or wait(0.2) do
  570. if options.autoupdate and library.toggled then
  571. if last ~= location[flag] then
  572. callback(box, location[flag], last)
  573. end
  574. if not pcall(function()
  575. box.Text = tostring(location[flag])
  576. end, warn) then
  577. return
  578. end
  579. last = location[flag]
  580. wait(tonumber(tonumber(options.updatedelay or 1) or 1))
  581. end
  582. end
  583. end)
  584. self:Resize()
  585. if altreturn then
  586. return {
  587. Box = box,
  588. Set = function(box, txt)
  589. local last = location[flag]
  590. if types == "number" then
  591. local num = tonumber(txt)
  592. if num then
  593. location[flag] = (min and max and math.clamp(num, min, max)) or num
  594. else
  595. return warn("number expected. got", typeof(txt))
  596. end
  597. else
  598. location[flag] = tostring(txt)
  599. end
  600. box.Text = tostring(location[flag])
  601. callback(box, location[flag], last)
  602. end
  603. }
  604. end
  605. return box
  606. end
  607. function types:Bind(name, options, callback)
  608. local location = options.location or self.flags
  609. local keyboardOnly = options.kbonly or false
  610. local flag = options.flag or ""
  611. local callback = callback or function()
  612. end
  613. local _default = options.default
  614. if keyboardOnly and (not tostring(_default):find("MouseButton")) then
  615. location[flag] = _default
  616. end
  617. local banned = {
  618. Return = true,
  619. Space = true,
  620. Tab = true,
  621. Unknown = true
  622. }
  623. local shortNames = {
  624. RightControl = 'RightCtrl',
  625. LeftControl = 'LeftCtrl',
  626. LeftShift = 'LShift',
  627. RightShift = 'RShift',
  628. MouseButton1 = "Mouse1",
  629. MouseButton2 = "Mouse2"
  630. }
  631. local allowed = {
  632. MouseButton1 = true,
  633. MouseButton2 = true
  634. }
  635. local nm = (_default and (shortNames[_default.Name] or _default.Name) or "None")
  636. local check = library:Create("Frame", {
  637. BackgroundTransparency = 1,
  638. Size = UDim2.new(1, 0, 0, 30),
  639. LayoutOrder = self:GetOrder(),
  640. library:Create("TextLabel", {
  641. Name = name,
  642. Text = "\r" .. name,
  643. BackgroundTransparency = 1,
  644. TextColor3 = library.options.textcolor,
  645. Position = UDim2.new(0, 5, 0, 0),
  646. Size = UDim2.new(1, -5, 1, 0),
  647. TextXAlignment = Enum.TextXAlignment.Left,
  648. Font = library.options.font,
  649. TextSize = library.options.fontsize,
  650. TextStrokeTransparency = library.options.textstroke,
  651. TextStrokeColor3 = library.options.strokecolor,
  652. BorderColor3 = library.options.bordercolor,
  653. BorderSizePixel = 0,
  654. library:Create("TextButton", {
  655. Name = 'Keybind',
  656. Text = nm,
  657. TextStrokeTransparency = library.options.textstroke,
  658. TextStrokeColor3 = library.options.strokecolor,
  659. Font = library.options.font,
  660. TextSize = library.options.fontsize,
  661. Size = UDim2.new(0, 60, 0, 20),
  662. Position = UDim2.new(1, -65, 0, 5),
  663. TextColor3 = library.options.textcolor,
  664. BackgroundColor3 = library.options.bgcolor,
  665. BorderColor3 = library.options.bordercolor,
  666. BorderSizePixel = 0
  667. })
  668. }),
  669. Parent = self.container
  670. })
  671. local button = check:FindFirstChild(name).Keybind
  672. table.insert(library.connections, button.MouseButton1Click:Connect(function()
  673. library.binding = true
  674. button.Text = "..."
  675. local a, b = game:GetService("UserInputService").InputBegan:Wait()
  676. local name = tostring(a.KeyCode.Name)
  677. local typeName = tostring(a.UserInputType.Name)
  678. if (a.UserInputType ~= Enum.UserInputType.Keyboard and (allowed[a.UserInputType.Name]) and (not keyboardOnly)) or (a.KeyCode and (not banned[a.KeyCode.Name])) then
  679. local name = (a.UserInputType ~= Enum.UserInputType.Keyboard and a.UserInputType.Name or a.KeyCode.Name)
  680. location[flag] = a
  681. button.Text = shortNames[name] or name
  682. callback(a)
  683. else
  684. if (location[flag]) then
  685. if (not pcall(function()
  686. return location[flag].UserInputType
  687. end)) then
  688. local name = tostring(location[flag])
  689. button.Text = shortNames[name] or name
  690. else
  691. local name = (location[flag].UserInputType ~= Enum.UserInputType.Keyboard and location[flag].UserInputType.Name or location[flag].KeyCode.Name)
  692. button.Text = shortNames[name] or name
  693. end
  694. end
  695. end
  696. wait(0.1)
  697. library.binding = false
  698. end))
  699. if location[flag] then
  700. button.Text = shortNames[tostring(location[flag].Name)] or tostring(location[flag].Name)
  701. end
  702. library.binds[flag] = {
  703. location = location,
  704. callback = callback
  705. }
  706. spawn(function()
  707. if nil == options.autoupdate then
  708. options.autoupdate = library.default_auto_update
  709. end
  710. if nil == options.updatedelay then
  711. options.updatedelay = library.default_update_delay
  712. end
  713. if type(options.autoupdate) == "number" then
  714. options.autoupdate, options.updatedelay = true, options.autoupdate
  715. end
  716. local last = location[flag]
  717. while (options.autoupdate and not library.toggled and wait()) or wait(0.2) do
  718. if options.autoupdate and library.toggled then
  719. if last ~= location[flag] then
  720. callback(location[flag])
  721. end
  722. if not pcall(function()
  723. button.Text = shortNames[tostring(location[flag].Name)] or tostring(location[flag].Name)
  724. end, warn) then
  725. return
  726. end
  727. last = location[flag]
  728. wait(tonumber(tonumber(options.updatedelay or 1) or 1))
  729. end
  730. end
  731. end)
  732. self:Resize()
  733. end
  734. function types:Section(name)
  735. local order = self:GetOrder()
  736. local determinedSize = UDim2.new(1, 0, 0, 25)
  737. local determinedPos = UDim2.new(0, 0, 0, 4)
  738. local secondarySize = UDim2.new(1, 0, 0, 20)
  739. if order == 0 then
  740. determinedSize = UDim2.new(1, 0, 0, 21)
  741. determinedPos = UDim2.new(0, 0, 0, -1)
  742. secondarySize = nil
  743. end
  744. local check = library:Create("Frame", {
  745. Name = 'Section',
  746. BackgroundTransparency = 1,
  747. Size = determinedSize,
  748. BackgroundColor3 = library.options.sectncolor,
  749. BorderSizePixel = 0,
  750. LayoutOrder = order,
  751. library:Create("TextLabel", {
  752. Name = 'section_lbl',
  753. Text = name,
  754. BackgroundTransparency = 0,
  755. BorderSizePixel = 0,
  756. BackgroundColor3 = library.options.sectncolor,
  757. TextColor3 = library.options.textcolor,
  758. Position = determinedPos,
  759. Size = (secondarySize or UDim2.new(1, 0, 1, 0)),
  760. Font = library.options.font,
  761. TextSize = library.options.fontsize,
  762. TextStrokeTransparency = library.options.textstroke,
  763. TextStrokeColor3 = library.options.strokecolor
  764. }),
  765. Parent = self.container
  766. })
  767. self:Resize()
  768. end
  769. function types:Slider(name, options, callback)
  770. local _default = options.default or options.min
  771. local min = options.min or 0
  772. local max = options.max or 1
  773. local location = options.location or self.flags
  774. local precise = options.precise or false
  775. local flag = options.flag or ""
  776. local callback = callback or function()
  777. end
  778. location[flag] = _default
  779. local check = library:Create("Frame", {
  780. BackgroundTransparency = 1,
  781. Size = UDim2.new(1, 0, 0, 25),
  782. LayoutOrder = self:GetOrder(),
  783. library:Create("TextLabel", {
  784. Name = name,
  785. TextStrokeTransparency = library.options.textstroke,
  786. TextStrokeColor3 = library.options.strokecolor,
  787. Text = "\r" .. name,
  788. BackgroundTransparency = 1,
  789. TextColor3 = library.options.textcolor,
  790. Position = UDim2.new(0, 5, 0, 2),
  791. Size = UDim2.new(1, -5, 1, 0),
  792. TextXAlignment = Enum.TextXAlignment.Left,
  793. Font = library.options.font,
  794. TextSize = library.options.fontsize,
  795. library:Create("Frame", {
  796. Name = 'Container',
  797. Size = UDim2.new(0, 60, 0, 20),
  798. Position = UDim2.new(1, -65, 0, 3),
  799. BackgroundTransparency = 1,
  800. BorderSizePixel = 0,
  801. library:Create("TextLabel", {
  802. Name = 'ValueLabel',
  803. Text = _default,
  804. BackgroundTransparency = 1,
  805. TextColor3 = library.options.textcolor,
  806. Position = UDim2.new(0, -10, 0, 0),
  807. Size = UDim2.new(0, 1, 1, 0),
  808. TextXAlignment = Enum.TextXAlignment.Right,
  809. Font = library.options.font,
  810. TextSize = library.options.fontsize,
  811. TextStrokeTransparency = library.options.textstroke,
  812. TextStrokeColor3 = library.options.strokecolor
  813. }),
  814. library:Create("TextButton", {
  815. Name = 'Button',
  816. Size = UDim2.new(0, 5, 1, -2),
  817. Position = UDim2.new(0, 0, 0, 1),
  818. AutoButtonColor = false,
  819. Text = "",
  820. BackgroundColor3 = Color3.fromRGB(20, 20, 20),
  821. BorderSizePixel = 0,
  822. ZIndex = 2,
  823. TextStrokeTransparency = library.options.textstroke,
  824. TextStrokeColor3 = library.options.strokecolor
  825. }),
  826. library:Create("Frame", {
  827. Name = 'Line',
  828. BackgroundTransparency = 0,
  829. Position = UDim2.new(0, 0, 0.5, 0),
  830. Size = UDim2.new(1, 0, 0, 1),
  831. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  832. BorderSizePixel = 0
  833. })
  834. })
  835. }),
  836. Parent = self.container
  837. })
  838. local overlay = check:FindFirstChild(name)
  839. local renderSteppedConnection
  840. local inputBeganConnection
  841. local inputEndedConnection
  842. local mouseLeaveConnection
  843. local mouseDownConnection
  844. local mouseUpConnection
  845. table.insert(library.connections, check:FindFirstChild(name).Container.MouseEnter:Connect(function()
  846. local function update()
  847. if renderSteppedConnection then
  848. renderSteppedConnection:Disconnect()
  849. end
  850. renderSteppedConnection = game:GetService("RunService").RenderStepped:Connect(function()
  851. local mouse = game:GetService("UserInputService"):GetMouseLocation()
  852. local percent = (mouse.X - overlay.Container.AbsolutePosition.X) / (overlay.Container.AbsoluteSize.X)
  853. percent = math.clamp(percent, 0, 1)
  854. percent = tonumber(string.format("%.2f", percent))
  855. overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  856. local num = min + (max - min) * percent
  857. local value = (precise and num or math.floor(num))
  858. overlay.Container.ValueLabel.Text = value
  859. callback(tonumber(value))
  860. location[flag] = tonumber(value)
  861. end)
  862. table.insert(library.connections, renderSteppedConnection)
  863. end
  864. local function disconnect()
  865. if renderSteppedConnection then
  866. renderSteppedConnection:Disconnect()
  867. end
  868. if inputBeganConnection then
  869. inputBeganConnection:Disconnect()
  870. end
  871. if inputEndedConnection then
  872. inputEndedConnection:Disconnect()
  873. end
  874. if mouseLeaveConnection then
  875. mouseLeaveConnection:Disconnect()
  876. end
  877. if mouseUpConnection then
  878. mouseUpConnection:Disconnect()
  879. end
  880. end
  881. inputBeganConnection = check:FindFirstChild(name).Container.InputBegan:Connect(function(input)
  882. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  883. update()
  884. end
  885. end)
  886. table.insert(library.connections, inputBeganConnection)
  887. inputEndedConnection = check:FindFirstChild(name).Container.InputEnded:Connect(function(input)
  888. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  889. disconnect()
  890. end
  891. end)
  892. table.insert(library.connections, inputEndedConnection)
  893. mouseDownConnection = check:FindFirstChild(name).Container.Button.MouseButton1Down:Connect(update)
  894. table.insert(library.connections, mouseDownConnection)
  895. mouseUpConnection = game:GetService("UserInputService").InputEnded:Connect(function(a, b)
  896. if a.UserInputType == Enum.UserInputType.MouseButton1 and (mouseDownConnection.Connected) then
  897. disconnect()
  898. end
  899. end)
  900. table.insert(library.connections, mouseUpConnection)
  901. end))
  902. if _default ~= min then
  903. local percent = 1 - ((max - _default) / (max - min))
  904. local number = _default
  905. number = tonumber(string.format("%.2f", number))
  906. if (not precise) then
  907. number = math.floor(number)
  908. end
  909. overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  910. overlay.Container.ValueLabel.Text = number
  911. end
  912. self:Resize()
  913. return {
  914. Set = function(self, value)
  915. local percent = 1 - ((max - value) / (max - min))
  916. local number = value
  917. number = tonumber(string.format("%.2f", number))
  918. if (not precise) then
  919. number = math.floor(number)
  920. end
  921. overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  922. overlay.Container.ValueLabel.Text = number
  923. location[flag] = number
  924. callback(number)
  925. end,
  926. spawn(function()
  927. if nil == options.autoupdate then
  928. options.autoupdate = library.default_auto_update
  929. end
  930. if nil == options.updatedelay then
  931. options.updatedelay = library.default_update_delay
  932. end
  933. if type(options.autoupdate) == "number" then
  934. options.autoupdate, options.updatedelay = true, options.autoupdate
  935. end
  936. local last = location[flag]
  937. while (options.autoupdate and not library.toggled and wait()) or wait(0.2) do
  938. if options.autoupdate and library.toggled then
  939. if last ~= location[flag] then
  940. callback(location[flag])
  941. end
  942. if not xpcall(function()
  943. local percent = 1 - ((max - location[flag]) / (max - min))
  944. local number = location[flag]
  945. number = tonumber(string.format("%.2f", number))
  946. if (not precise) then
  947. number = math.floor(number)
  948. end
  949. overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  950. overlay.Container.ValueLabel.Text = number
  951. end, warn) then
  952. return
  953. end
  954. last = location[flag]
  955. wait(tonumber(tonumber(options.updatedelay or 1) or 1))
  956. end
  957. end
  958. end)
  959. }
  960. end
  961. function types:SearchBox(text, options, callback)
  962. local list = options.list or {};
  963. local flag = options.flag or "";
  964. local location = options.location or self.flags;
  965. local callback = callback or function() end;
  966.  
  967. local busy = false;
  968. local box = library:Create('Frame', {
  969. BackgroundTransparency = 1;
  970. Size = UDim2.new(1, 0, 0, 25);
  971. LayoutOrder = self:GetOrder();
  972. library:Create('TextBox', {
  973. Text = "";
  974. PlaceholderText = text;
  975. PlaceholderColor3 = Color3.fromRGB(60, 60, 60);
  976. Font = library.options.font;
  977. TextSize = library.options.fontsize;
  978. Name = 'Box';
  979. Size = UDim2.new(1, -10, 0, 20);
  980. Position = UDim2.new(0, 5, 0, 4);
  981. TextColor3 = library.options.textcolor;
  982. BackgroundColor3 = library.options.dropcolor;
  983. BorderColor3 = library.options.bordercolor;
  984. TextStrokeTransparency = library.options.textstroke;
  985. TextStrokeColor3 = library.options.strokecolor;
  986. library:Create('ScrollingFrame', {
  987. Position = UDim2.new(0, 0, 1, 1);
  988. Name = 'Container';
  989. BackgroundColor3 = library.options.btncolor;
  990. ScrollBarThickness = 0;
  991. BorderSizePixel = 0;
  992. BorderColor3 = library.options.bordercolor;
  993. Size = UDim2.new(1, 0, 0, 0);
  994. library:Create('UIListLayout', {
  995. Name = 'ListLayout';
  996. SortOrder = Enum.SortOrder.LayoutOrder;
  997. });
  998. ZIndex = 2;
  999. });
  1000. });
  1001. Parent = self.container;
  1002. })
  1003.  
  1004. local function rebuild(text)
  1005. box:FindFirstChild('Box').Container.ScrollBarThickness = 0
  1006. for i, child in next, box:FindFirstChild('Box').Container:GetChildren() do
  1007. if (not child:IsA('UIListLayout')) then
  1008. child:Destroy();
  1009. end
  1010. end
  1011.  
  1012. if #text > 0 then
  1013. for i, v in next, list do
  1014. if string.sub(string.lower(v), 1, string.len(text)) == string.lower(text) then
  1015. local button = library:Create('TextButton', {
  1016. Text = v;
  1017. Font = library.options.font;
  1018. TextSize = library.options.fontsize;
  1019. TextColor3 = library.options.textcolor;
  1020. BorderColor3 = library.options.bordercolor;
  1021. TextStrokeTransparency = library.options.textstroke;
  1022. TextStrokeColor3 = library.options.strokecolor;
  1023. Parent = box:FindFirstChild('Box').Container;
  1024. Size = UDim2.new(1, 0, 0, 20);
  1025. LayoutOrder = i;
  1026. BackgroundColor3 = library.options.btncolor;
  1027. ZIndex = 2;
  1028. })
  1029.  
  1030. button.MouseButton1Click:connect(function()
  1031. busy = true;
  1032. box:FindFirstChild('Box').Text = button.Text;
  1033. wait();
  1034. busy = false;
  1035.  
  1036. location[flag] = button.Text;
  1037. callback(location[flag])
  1038.  
  1039. box:FindFirstChild('Box').Container.ScrollBarThickness = 0
  1040. for i, child in next, box:FindFirstChild('Box').Container:GetChildren() do
  1041. if (not child:IsA('UIListLayout')) then
  1042. child:Destroy();
  1043. end
  1044. end
  1045. box:FindFirstChild('Box').Container:TweenSize(UDim2.new(1, 0, 0, 0), 'Out', 'Quad', 0.25, true)
  1046. end)
  1047. end
  1048. end
  1049. end
  1050.  
  1051. local c = box:FindFirstChild('Box').Container:GetChildren()
  1052. local ry = (20 * (#c)) - 20
  1053.  
  1054. local y = math.clamp((20 * (#c)) - 20, 0, 100)
  1055. if ry > 100 then
  1056. box:FindFirstChild('Box').Container.ScrollBarThickness = 5;
  1057. end
  1058.  
  1059. box:FindFirstChild('Box').Container:TweenSize(UDim2.new(1, 0, 0, y), 'Out', 'Quad', 0.25, true)
  1060. box:FindFirstChild('Box').Container.CanvasSize = UDim2.new(1, 0, 0, (20 * (#c)) - 20)
  1061. end
  1062.  
  1063. box:FindFirstChild('Box'):GetPropertyChangedSignal('Text'):connect(function()
  1064. if (not busy) then
  1065. rebuild(box:FindFirstChild('Box').Text)
  1066. end
  1067. end);
  1068.  
  1069. local function reload(new_list)
  1070. list = new_list;
  1071. rebuild("")
  1072. end
  1073. self:Resize();
  1074. return reload, box:FindFirstChild('Box');
  1075. end
  1076. function types:Dropdown(name, options, callback)
  1077. local location = options.location or self.flags
  1078. local flag = options.flag or ""
  1079. local callback = callback or function()
  1080. end
  1081. local list = options.list or {}
  1082. location[flag] = list[1]
  1083. local check = library:Create("Frame", {
  1084. BackgroundTransparency = 1,
  1085. Size = UDim2.new(1, 0, 0, 25),
  1086. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1087. BorderSizePixel = 0,
  1088. LayoutOrder = self:GetOrder(),
  1089. library:Create("Frame", {
  1090. Name = 'dropdown_lbl',
  1091. BackgroundTransparency = 0,
  1092. BackgroundColor3 = library.options.dropcolor,
  1093. Position = UDim2.new(0, 5, 0, 4),
  1094. BorderColor3 = library.options.bordercolor,
  1095. Size = UDim2.new(1, -10, 0, 20),
  1096. library:Create("TextLabel", {
  1097. Name = 'Selection',
  1098. Size = UDim2.new(1, 0, 1, 0),
  1099. Text = list[1],
  1100. TextColor3 = library.options.textcolor,
  1101. BackgroundTransparency = 1,
  1102. Font = library.options.font,
  1103. TextSize = library.options.fontsize,
  1104. TextStrokeTransparency = library.options.textstroke,
  1105. TextStrokeColor3 = library.options.strokecolor
  1106. }),
  1107. library:Create("TextButton", {
  1108. Name = 'drop',
  1109. BackgroundTransparency = 1,
  1110. Size = UDim2.new(0, 20, 1, 0),
  1111. Position = UDim2.new(1, -25, 0, 0),
  1112. Text = 'v',
  1113. TextColor3 = library.options.textcolor,
  1114. Font = library.options.font,
  1115. TextSize = library.options.fontsize,
  1116. TextStrokeTransparency = library.options.textstroke,
  1117. TextStrokeColor3 = library.options.strokecolor
  1118. })
  1119. }),
  1120. Parent = self.container
  1121. })
  1122. local button = check:FindFirstChild("dropdown_lbl").drop
  1123. local input, container
  1124. table.insert(library.connections, button.MouseButton1Click:Connect(function()
  1125. if (input and input.Connected) then
  1126. return
  1127. end
  1128. check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").TextColor3 = Color3.fromRGB(60, 60, 60)
  1129. check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").Text = name
  1130. local c = 0
  1131. for i, v in next, list do
  1132. c = c + 20
  1133. end
  1134. local size = UDim2.new(1, 0, 0, c)
  1135. local clampedSize
  1136. local scrollSize = 0
  1137. if size.Y.Offset > 100 then
  1138. clampedSize = UDim2.new(1, 0, 0, 100)
  1139. scrollSize = 5
  1140. end
  1141. local goSize = (clampedSize ~= nil and clampedSize) or size
  1142. local container = library:Create("ScrollingFrame", {
  1143. TopImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png',
  1144. BottomImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png',
  1145. Name = 'DropContainer',
  1146. Parent = check:FindFirstChild("dropdown_lbl"),
  1147. Size = UDim2.new(1, 0, 0, 0),
  1148. BackgroundColor3 = library.options.bgcolor,
  1149. BorderColor3 = library.options.bordercolor,
  1150. Position = UDim2.new(0, 0, 1, 0),
  1151. ScrollBarThickness = scrollSize,
  1152. CanvasSize = UDim2.new(0, 0, 0, size.Y.Offset),
  1153. ZIndex = 5,
  1154. ClipsDescendants = true,
  1155. library:Create("UIListLayout", {
  1156. Name = 'List',
  1157. SortOrder = Enum.SortOrder.LayoutOrder
  1158. })
  1159. })
  1160. for i, v in next, list do
  1161. local btn = library:Create("TextButton", {
  1162. Size = UDim2.new(1, 0, 0, 20),
  1163. BackgroundColor3 = library.options.btncolor,
  1164. BorderColor3 = library.options.bordercolor,
  1165. Text = v,
  1166. Font = library.options.font,
  1167. TextSize = library.options.fontsize,
  1168. LayoutOrder = i,
  1169. Parent = container,
  1170. ZIndex = 5,
  1171. TextColor3 = library.options.textcolor,
  1172. TextStrokeTransparency = library.options.textstroke,
  1173. TextStrokeColor3 = library.options.strokecolor
  1174. })
  1175. table.insert(library.connections, btn.MouseButton1Click:Connect(function()
  1176. check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").TextColor3 = library.options.textcolor
  1177. check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").Text = btn.Text
  1178. location[flag] = tostring(btn.Text)
  1179. callback(location[flag])
  1180. game:GetService("Debris"):AddItem(container, 0)
  1181. input:Disconnect()
  1182. end))
  1183. end
  1184. container:TweenSize(goSize, "Out", "Quad", 0.15, true)
  1185. local function isInGui(frame)
  1186. local mloc = game:GetService("UserInputService"):GetMouseLocation()
  1187. local mouse = Vector2.new(mloc.X, mloc.Y - 36)
  1188. local x1, x2 = frame.AbsolutePosition.X, frame.AbsolutePosition.X + frame.AbsoluteSize.X
  1189. local y1, y2 = frame.AbsolutePosition.Y, frame.AbsolutePosition.Y + frame.AbsoluteSize.Y
  1190. return (mouse.X >= x1 and mouse.X <= x2) and (mouse.Y >= y1 and mouse.Y <= y2)
  1191. end
  1192. input = game:GetService("UserInputService").InputBegan:Connect(function(a)
  1193. if a.UserInputType == Enum.UserInputType.MouseButton1 and (not isInGui(container)) then
  1194. check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").TextColor3 = library.options.textcolor
  1195. check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").Text = tostring(location[flag] or "")
  1196. container:TweenSize(UDim2.new(1, 0, 0, 0), "In", "Quad", 0.15, true)
  1197. wait(0.15)
  1198. game:GetService("Debris"):AddItem(container, 0)
  1199. input:Disconnect()
  1200. end
  1201. end)
  1202. table.insert(library.connections, input)
  1203. end))
  1204. self:Resize()
  1205. local function reload(self, array)
  1206. options = array
  1207. location[flag] = array[1]
  1208. pcall(function()
  1209. input:Disconnect()
  1210. end)
  1211. check:WaitForChild("dropdown_lbl").Selection.Text = tostring(location[flag] or "")
  1212. check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").TextColor3 = library.options.textcolor
  1213. game:GetService("Debris"):AddItem(container, 0)
  1214. options = array
  1215. end
  1216. return {
  1217. Refresh = reload,
  1218. Gui = check,
  1219. spawn(function()
  1220. options = type(options) == "table" and options or {}
  1221. if nil == options.autoupdate then
  1222. options.autoupdate = library.default_auto_update
  1223. end
  1224. if nil == options.updatedelay then
  1225. options.updatedelay = library.default_update_delay
  1226. end
  1227. if type(options.autoupdate) == "number" then
  1228. options.autoupdate, options.updatedelay = true, options.autoupdate
  1229. end
  1230. local last = location[flag]
  1231. wait(4)
  1232. options = type(options) == "table" and options or {}
  1233. while (options.autoupdate and not library.toggled and wait()) or wait(0.2) do
  1234. if options.autoupdate and library.toggled then
  1235. if last ~= location[flag] then
  1236. callback(location[flag])
  1237. end
  1238. if not pcall(function()
  1239. check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or ""
  1240. end, warn) then
  1241. return
  1242. end
  1243. last = location[flag]
  1244. wait(tonumber(tonumber(options.updatedelay or 1) or 1))
  1245. end
  1246. end
  1247. end)
  1248. }
  1249. end
  1250. function library:Create(class, data)
  1251. local obj = Instance.new(class)
  1252. for i, v in next, data do
  1253. if i ~= 'Parent' then
  1254. if typeof(v) == "Instance" then
  1255. v.Parent = obj
  1256. else
  1257. obj[i] = v
  1258. end
  1259. end
  1260. end
  1261. obj.Parent = data.Parent
  1262. return obj
  1263. end
  1264. function library:CreateWindow(name, options)
  1265. local autodel = options and type(options) == "table" and options.autodelete
  1266. if options then
  1267. pcall(function()
  1268. options.autodelete = nil
  1269. end)
  1270. end
  1271. if not library.container then
  1272. library.container = self:Create("ScreenGui", {
  1273. self:Create("Frame", {
  1274. Name = "Container",
  1275. Size = UDim2.new(1, -30, 1, 0),
  1276. Position = UDim2.new(0, 20, 0, 20),
  1277. BackgroundTransparency = 1,
  1278. Active = false
  1279. })
  1280. })
  1281. if type(syn) == "table" and type(syn.protect_gui) == "function" then
  1282. pcall(syn.protect_gui, library.container)
  1283. end
  1284. if type(get_hidden_gui) == "function" then
  1285. library.container.Parent = get_hidden_gui()
  1286. elseif type(gethui) == "function" then
  1287. library.container.Parent = gethui()
  1288. else
  1289. local x, s = pcall(function()
  1290. library.container.Parent = game:GetService("CoreGui")
  1291. return true
  1292. end)
  1293. if not x or not s then
  1294. warn("Please consider buying Synapse")
  1295. library.container.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui", 20)
  1296. end
  1297. end
  1298. library.mastergui = library.container
  1299. if autodel then
  1300. local con = library.mastergui or library.container
  1301. if con then
  1302. delay(autodel, function()
  1303. if con then
  1304. con:Destroy()
  1305. end
  1306. if type(library.connections) == "table" then
  1307. for _, c in pairs(library.connections) do
  1308. if typeof(c) == "RBXScriptConnection" then
  1309. c:Disconnect()
  1310. c = nil
  1311. end
  1312. end
  1313. end
  1314. end)
  1315. end
  1316. end
  1317. library.container = library.container:FindFirstChild("Container")
  1318. end
  1319. if not library.options then
  1320. library.options = setmetatable(options or {}, {
  1321. __index = default
  1322. })
  1323. end
  1324. options = (options and type(options) == "table" and options) or {}
  1325. local master = {}
  1326. for k, v in pairs(default) do
  1327. if nil ~= options[k] then
  1328. master[k] = options[k]
  1329. else
  1330. master[k] = default[k]
  1331. end
  1332. end
  1333. local window = types.window(name, master or library.options or default)
  1334. dragger.new(window.object)
  1335. return window
  1336. end
  1337. library.options = setmetatable({}, {
  1338. __index = default
  1339. })
  1340. spawn(function()
  1341. while true do
  1342. for i = 0, 1, 1 / 300 do
  1343. for _, obj in next, library.rainbowtable do
  1344. obj.BackgroundColor3 = Color3.fromHSV(i, 1, 1)
  1345. end
  1346. wait()
  1347. end
  1348. end
  1349. end)
  1350. local function isreallypressed(bind, inp)
  1351. local key = bind
  1352. if typeof(key) == "Instance" then
  1353. if key.UserInputType == Enum.UserInputType.Keyboard and inp.KeyCode == key.KeyCode then
  1354. return true
  1355. elseif tostring(key.UserInputType):find("MouseButton") and inp.UserInputType == key.UserInputType then
  1356. return true
  1357. end
  1358. end
  1359. if tostring(key):find 'MouseButton1' then
  1360. return key == inp.UserInputType
  1361. else
  1362. return key == inp.KeyCode
  1363. end
  1364. end
  1365. library.connections.bindstuff = game:GetService("UserInputService").InputBegan:Connect(function(input)
  1366. if not library.binding then
  1367. for idx, binds in next, library.binds do
  1368. local real_binding = binds.location[idx]
  1369. if real_binding and isreallypressed(real_binding, input) then
  1370. binds.callback()
  1371. end
  1372. end
  1373. end
  1374. end)
  1375. game:GetService("TestService"):Message("UI-Lib Loaded! Version:" .. tostring(vers))
  1376. do
  1377. return library, __instructions
  1378. end
  1379.  
  1380.  
  1381. -- Example usage
  1382. local library = loadstring(rawget(game:GetObjects("rbxassetid://4133667265"), 1).Source)("Wallys Forked UI")
  1383. local gui = {}
  1384. local mods = {
  1385. ["toggle_1"] = true
  1386. }
  1387.  
  1388. gui.main = library:CreateWindow("Main", {underlinecolor = Color3.fromRGB(0, 255, 140)})
  1389.  
  1390. gui.main:Toggle("Toggle 1", {
  1391. location = mods, -- The table holding the data
  1392. flag = "toggle_1", -- The index at which to store the data
  1393. default = true -- Set start value to enabled
  1394. }, function(bool)
  1395. if bool == true then
  1396. print("Checked!")
  1397. end
  1398. if bool == false then
  1399. print("Unchecked!")
  1400. end
  1401. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement