Advertisement
Best0080

Untitled

Feb 25th, 2024
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 305.23 KB | None | 0 0
  1. if game:GetService("CoreGui"):FindFirstChild(" ") then
  2. game:GetService("CoreGui"):FindFirstChild(" "):Destroy()
  3. end
  4.  
  5. if game:GetService("CoreGui").RobloxGui.Modules:FindFirstChild("Elite Toggle") then
  6. game:GetService("CoreGui").RobloxGui.Modules:FindFirstChild("Elite Toggle"):Destroy()
  7. end
  8.  
  9. local EliteToggle = Instance.new("ScreenGui")
  10. local Frame = Instance.new("Frame")
  11. local UICorner = Instance.new("UICorner")
  12. local autorenew = Instance.new("ImageButton")
  13. local Tween = game:GetService('TweenService')
  14. local Vlaue = false
  15.  
  16.  
  17. EliteToggle.Name = "Elite Toggle"
  18. EliteToggle.Parent = game:GetService("CoreGui").RobloxGui.Modules
  19. EliteToggle.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  20.  
  21. Frame.Parent = EliteToggle
  22. Frame.BackgroundColor3 = Color3.fromRGB(68, 68, 68)
  23. Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  24. Frame.BorderSizePixel = 0
  25. Frame.Position = UDim2.new(0.0825278834, 0, 0.142857149, 0)
  26. Frame.Size = UDim2.new(0, 45, 0, 45)
  27.  
  28. UICorner.CornerRadius = UDim.new(0, 15)
  29. UICorner.Parent = Frame
  30.  
  31. autorenew.Name = "autorenew"
  32. autorenew.Parent = Frame
  33. autorenew.BackgroundColor3 = Color3.fromRGB(255, 64, 0)
  34. autorenew.BackgroundTransparency = 1.000
  35. autorenew.Position = UDim2.new(0.211111113, 0, 0.211111113, 0)
  36. autorenew.Size = UDim2.new(0, 25, 0, 25)
  37. autorenew.ZIndex = 2
  38. autorenew.Image = "rbxassetid://3926307971"
  39. autorenew.ImageColor3 = Color3.fromRGB(255, 131, 131)
  40. autorenew.ImageRectOffset = Vector2.new(564, 444)
  41. autorenew.ImageRectSize = Vector2.new(36, 36)
  42.  
  43. autorenew.MouseButton1Click:Connect(function ()
  44. if game:GetService("CoreGui"):FindFirstChild(" ") then
  45. game:GetService("CoreGui"):FindFirstChild(" ").Enabled = Vlaue
  46. end
  47. if Vlaue then
  48. Vlaue = false
  49. repeat
  50. Tween:Create(autorenew, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out,0,false,0),{ImageColor3 = Color3.fromRGB(255, 131, 131)}):Play()
  51. wait()
  52. autorenew.Rotation = autorenew.Rotation + 15
  53. until autorenew.Rotation >= 180
  54.  
  55. else
  56. Vlaue = true
  57. repeat
  58. wait()
  59. Tween:Create(autorenew, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out,0,false,0),{ImageColor3 = Color3.fromRGB(130, 255, 138)}):Play()
  60. autorenew.Rotation = autorenew.Rotation - 15
  61. until autorenew.Rotation <= 0
  62. end
  63. end)
  64.  
  65. local EliteToggle = Instance.new("ScreenGui")
  66. local Frame = Instance.new("Frame")
  67. local UICorner = Instance.new("UICorner")
  68. local autorenew = Instance.new("ImageButton")
  69. local Tween = game:GetService('TweenService')
  70. local Vlaue = false
  71.  
  72.  
  73. EliteToggle.Name = "Elite Toggle"
  74. EliteToggle.Parent = game:GetService("CoreGui").RobloxGui.Modules
  75. EliteToggle.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  76.  
  77. Frame.Parent = EliteToggle
  78. Frame.BackgroundColor3 = Color3.fromRGB(68, 68, 68)
  79. Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  80. Frame.BorderSizePixel = 0
  81. Frame.Position = UDim2.new(0.0825278834, 0, 0.142857149, 0)
  82. Frame.Size = UDim2.new(0, 45, 0, 45)
  83.  
  84. UICorner.CornerRadius = UDim.new(0, 15)
  85. UICorner.Parent = Frame
  86.  
  87. autorenew.Name = "autorenew"
  88. autorenew.Parent = Frame
  89. autorenew.BackgroundColor3 = Color3.fromRGB(255, 64, 0)
  90. autorenew.BackgroundTransparency = 1.000
  91. autorenew.Position = UDim2.new(0.211111113, 0, 0.211111113, 0)
  92. autorenew.Size = UDim2.new(0, 25, 0, 25)
  93. autorenew.ZIndex = 2
  94. autorenew.Image = "rbxassetid://3926307971"
  95. autorenew.ImageColor3 = Color3.fromRGB(255, 131, 131)
  96. autorenew.ImageRectOffset = Vector2.new(564, 444)
  97. autorenew.ImageRectSize = Vector2.new(36, 36)
  98.  
  99. autorenew.MouseButton1Click:Connect(function ()
  100. if game:GetService("CoreGui"):FindFirstChild(" ") then
  101. game:GetService("CoreGui"):FindFirstChild(" ").Enabled = Vlaue
  102. end
  103. if Vlaue then
  104. Vlaue = false
  105. repeat
  106. Tween:Create(autorenew, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out,0,false,0),{ImageColor3 = Color3.fromRGB(255, 131, 131)}):Play()
  107. wait()
  108. autorenew.Rotation = autorenew.Rotation + 15
  109. until autorenew.Rotation >= 180
  110.  
  111. else
  112. Vlaue = true
  113. repeat
  114. wait()
  115. Tween:Create(autorenew, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out,0,false,0),{ImageColor3 = Color3.fromRGB(130, 255, 138)}):Play()
  116. autorenew.Rotation = autorenew.Rotation - 15
  117. until autorenew.Rotation <= 0
  118. end
  119. end)
  120.  
  121.  
  122. function LoadSettings()
  123. if readfile and writefile and isfile and isfolder then
  124. if not isfolder("Quarterly Hub Premium") then
  125. makefolder("Quarterly Hub Premium")
  126. end
  127. if not isfolder("Quarterly Hub Premium/Blox Fruits/") then
  128. makefolder("Quarterly Hub Premium/Blox Fruits/")
  129. end
  130. if not isfile("Quarterly Hub Premium/Blox Fruits/" .. game.Players.LocalPlayer.Name .. ".json") then
  131. writefile("Quarterly Hub Premium/Blox Fruits/" .. game.Players.LocalPlayer.Name .. ".json", game:GetService("HttpService"):JSONEncode(_G.Settings))
  132. else
  133. local Decode = game:GetService("HttpService"):JSONDecode(readfile("Quarterly Hub Premium/Blox Fruits/" .. game.Players.LocalPlayer.Name .. ".json"))
  134. for i,v in pairs(Decode) do
  135. _G.Settings[i] = v
  136. end
  137. end
  138. else
  139. return warn("Status : Undetected Executor")
  140. end
  141. end
  142.  
  143. function SaveSettings()
  144. if readfile and writefile and isfile and isfolder then
  145. if not isfile("Quarterly Hub Premium/Blox Fruits/" .. game.Players.LocalPlayer.Name .. ".json") then
  146. LoadSettings()
  147. else
  148. local Decode = game:GetService("HttpService"):JSONDecode(readfile("Quarterly Hub Premium/Blox Fruits/" .. game.Players.LocalPlayer.Name .. ".json"))
  149. local Array = {}
  150. for i,v in pairs(_G.Settings) do
  151. Array[i] = v
  152. end
  153. writefile("Quarterly Hub Premium/Blox Fruits/" .. game.Players.LocalPlayer.Name .. ".json", game:GetService("HttpService"):JSONEncode(Array))
  154. end
  155. else
  156. return warn("Status : Undetected Executor")
  157. end
  158. end
  159.  
  160. _G.Settings = {
  161. Auto_Farm_Level = false,
  162. Auto_Farm_Fast = true,
  163. Auto_New_World = false,
  164. Auto_Third_World = false,
  165. Auto_Farm_Chest = false,
  166. Auto_Farm_Chest_Hop = false,
  167. Auto_Elite_Hunter = false,
  168. Auto_Elite_Hunter_Hop = false,
  169. Auto_Spawn_Cake_Prince = false,
  170. Auto_Cake_Prince = false,
  171. Auto_Farm_Boss = false,
  172. Select_Boss = "",
  173. Auto_Quest_Boss = true,
  174. Auto_Farm_All_Boss = false,
  175. SelectWeapon = "Melee",
  176. Auto_Set_Spawn = true,
  177. Method = "Upper",
  178. Brimob = true,
  179. Select_Stats = {},
  180. Bypass = false,
  181. Rejoin = true,
  182. FastAttack = true,
  183. Auto_Saber = false,
  184. Auto_Saber_Hop = false,
  185. Auto_Pole_V1_Hop = false,
  186. Auto_Factory_Farm = false,
  187. Auto_Farm_Ectoplasm = false,
  188. Auto_Swan_Glasses = false,
  189. Auto_Swan_Glasses_Hop = false,
  190. Auto_Farm_Bone = false,
  191. Auto_Trade_Bone = false,
  192. Auto_Rainbow_Haki = false,
  193. Auto_Rainbow_Haki_Hop = false,
  194. Auto_Canvander = false,
  195. Auto_Twin_Hook_Hop = false,
  196. Auto_Twin_Hook = false,
  197. Auto_Serpent_Bow = false,
  198. Auto_Serpent_Bow_Hop = false,
  199. Auto_Evo_Race_V2 = false,
  200. Auto_Rengoku = false,
  201. Auto_Buy_Legendary_Sword = false,
  202. Auto_Buy_Enchancement = false,
  203. Auto_Yama = false,
  204. Auto_Holy_Torch = false,
  205. Auto_Musketeer_Hat = false,
  206. Auto_Superhuman = false,
  207. Auto_Fully_Superhuman = false,
  208. Auto_Death_Step = false,
  209. Auto_Fully_Death_Step = false,
  210. Auto_SharkMan_Karate = false,
  211. Auto_Fully_SharkMan_Karate = false,
  212. Auto_Electric_Claw = false,
  213. Auto_Dragon_Talon = false,
  214. Auto_God_Human = false,
  215. Select_Player = "",
  216. Spectate_Player = false,
  217. Teleport_to_Player = false,
  218. Auto_Kill_Player = false,
  219. EnabledPvP = false,
  220. Auto_Stats = false,
  221. Point = 1,
  222. No_clip = false,
  223. Infinit_Energy = false,
  224. Dodge_No_CoolDown = false,
  225. Infinit_Ability = false,
  226. Infinit_SkyJump = false,
  227. Infinit_Inf_Soru = false,
  228. Infinit_Range_Observation_Haki = false,
  229. Select_Island = "",
  230. Start_Tween_Island = false,
  231. Select_Dungeon = false,
  232. Auto_Buy_Chips_Dungeon = false,
  233. Auto_Start_Dungeon = false,
  234. Auto_Next_Island = false,
  235. Kill_Aura = false,
  236. Auto_Awake = false,
  237. Auto_Buy_Law_Chip = false,
  238. Auto_Start_Law_Dungeon = false,
  239. Auto_Kill_Law = false,
  240. Select_Devil_Fruit = "",
  241. Auto_Buy_Devil_Fruit = false,
  242. Auto_Random_Fruit = false,
  243. Auto_Bring_Fruit = false,
  244. Auto_Store_Fruit = false,
  245. LockMoon = false,
  246. Auto_Mirage_Island = false,
  247. SkillZ = true,
  248. SkillX = true,
  249. SkillC = true,
  250. SkillV = true,
  251. AutoMasterySkill = false,
  252. HealthMs = 85,
  253. Distance = 30,
  254. DistanceY = 5,
  255. ESP_Mirage_Island = false,
  256. Auto_Awakening_One_Quest = false,
  257. SuperFastAttack = false,
  258. ESP_Chest = false,
  259. Auto_Dack_Coat = false,
  260. Auto_Sea_King = false,
  261. Select_Mode = "Chest",
  262. Remove_UI_DamageCounter = false,
  263. Notifications_Remove = false,
  264. Auto_CFrame = false,
  265. Auto_Gear = false,
  266. }
  267.  
  268. if game.PlaceId == 2753915549 then
  269. W1 = true
  270. elseif game.PlaceId == 4442272183 then
  271. W2 = true
  272. elseif game.PlaceId == 7449423635 then
  273. W3 = true
  274. end
  275.  
  276.  
  277. local library = {
  278. Version = "0.36",
  279. WorkspaceName = "Elite Lib",
  280. flags = {},
  281. signals = {},
  282. objects = {},
  283. elements = {},
  284. globals = {},
  285. subs = {},
  286. colored = {},
  287. configuration = {
  288. hideKeybind = Enum.KeyCode.RightShift,
  289. smoothDragging = false,
  290. easingStyle = Enum.EasingStyle.Quart,
  291. easingDirection = Enum.EasingDirection.Out
  292. },
  293. colors = {
  294. main = Color3.fromRGB(255, 39, 39),
  295. background = Color3.fromRGB(40, 40, 40),
  296. outerBorder = Color3.fromRGB(15, 15, 15),
  297. innerBorder = Color3.fromRGB(73, 63, 73),
  298. topGradient = Color3.fromRGB(35, 35, 35),
  299. bottomGradient = Color3.fromRGB(29, 29, 29),
  300. sectionBackground = Color3.fromRGB(35, 34, 34),
  301. section = Color3.fromRGB(176, 175, 176),
  302. otherElementText = Color3.fromRGB(129, 127, 129),
  303. elementText = Color3.fromRGB(147, 145, 147),
  304. elementBorder = Color3.fromRGB(20, 20, 20),
  305. selectedOption = Color3.fromRGB(55, 55, 55),
  306. unselectedOption = Color3.fromRGB(40, 40, 40),
  307. hoveredOptionTop = Color3.fromRGB(65, 65, 65),
  308. unhoveredOptionTop = Color3.fromRGB(50, 50, 50),
  309. hoveredOptionBottom = Color3.fromRGB(45, 45, 45),
  310. unhoveredOptionBottom = Color3.fromRGB(35, 35, 35),
  311. tabText = Color3.fromRGB(185, 185, 185)
  312. },
  313. gui_parent = (function()
  314. local x, c = pcall(function()
  315. return game:GetService("CoreGui")
  316. end)
  317. if x and c then
  318. return c
  319. end
  320. x, c = pcall(function()
  321. return (game:IsLoaded() or (game.Loaded:Wait() or 1)) and game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
  322. end)
  323. if x and c then
  324. return c
  325. end
  326. x, c = pcall(function()
  327. return game:GetService("StarterGui")
  328. end)
  329. if x and c then
  330. return c
  331. end
  332. return error("Seriously bad engine. Can't find a place to store the GUI. Robust code can't help this much incompetence.")
  333. end)(),
  334. colorpicker = false,
  335. colorpickerconflicts = {},
  336. rainbowflags = {},
  337. rainbows = 0,
  338. rainbowsg = 0
  339. }
  340. library.Subs = library.subs
  341. local library_flags = library.flags
  342. library.Flags = library_flags
  343. local destroyrainbows, destroyrainbowsg = nil
  344. function darkenColor(clr, intensity)
  345. if not intensity or (intensity == 1) then
  346. return clr
  347. end
  348. if clr and ((typeof(clr) == "Color3") or (type(clr) == "table")) then
  349. return Color3.new(clr.R / intensity, clr.G / intensity, clr.B / intensity)
  350. end
  351. end
  352. library.subs.darkenColor = darkenColor
  353. local __runscript = true
  354. local function wait_check(...)
  355. if __runscript then
  356. return wait(...)
  357. else
  358. wait()
  359. return false
  360. end
  361. end
  362. library.subs.Wait, library.subs.wait, library.Wait = wait_check, wait_check, wait_check
  363. function library.IsGuiValid()
  364. return __runscript
  365. end
  366. local lasthidebing = 0
  367. local temp = game:FindService("MarketplaceService") or game:GetService("MarketplaceService")
  368. local Marketplace = (temp and (cloneref and cloneref(temp))) or temp
  369. local resolvevararg, temp = nil
  370. do
  371. local lwr = string.lower
  372. function library.defaultSort(a, b)
  373. return lwr(tostring(b)) > lwr(tostring(a))
  374. end
  375. end
  376. do
  377. local varargresolve = {
  378. Window = {"Name", "Theme"},
  379. Tab = {"Name", "Image"},
  380. Section = {"Name", "Side"},
  381. Label = {"Text", "Flag", "UnloadValue", "UnloadFunc"},
  382. Toggle = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Locked", "Keybind", "Condition", "AllowDuplicateCalls"},
  383. Textbox = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Placeholder", "Type", "Min", "Max", "Decimals", "Hex", "Binary", "Base", "RichTextBox", "MultiLine", "TextScaled", "TextFont", "PreFormat", "PostFormat", "CustomProperties", "AllowDuplicateCalls"},
  384. Slider = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Min", "Max", "Decimals", "Format", "IllegalInput", "Textbox", "AllowDuplicateCalls"},
  385. Button = {"Name", "Callback", "Locked", "Condition"},
  386. Keybind = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Pressed", "KeyNames", "AllowDuplicateCalls"},
  387. Dropdown = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "List", "Filter", "Method", "Nothing", "Sort", "MultiSelect", "ItemAdded", "ItemRemoved", "ItemChanged", "ItemsCleared", "ScrollUpButton", "ScrollDownButton", "ScrollButtonRate", "DisablePrecisionScrolling", "AllowDuplicateCalls"},
  388. SearchBox = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "List", "Filter", "Method", "Nothing", "Sort", "MultiSelect", "ItemAdded", "ItemRemoved", "ItemChanged", "ItemsCleared", "ScrollUpButton", "ScrollDownButton", "ScrollButtonRate", "DisablePrecisionScrolling", "RegEx", "AllowDuplicateCalls"},
  389. Colorpicker = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Rainbow", "Random", "AllowDuplicateCalls"},
  390. Persistence = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Workspace", "Persistive", "Suffix", "LoadCallback", "SaveCallback", "PostLoadCallback", "PostSaveCallback", "ScrollUpButton", "ScrollDownButton", "ScrollButtonRate", "DisablePrecisionScrolling", "AllowDuplicateCalls"},
  391. Designer = {"Backdrop", "Image", "Info", "Credit"}
  392. }
  393. function resolvevararg(objtype, ...)
  394. local data = varargresolve[objtype]
  395. local t = {}
  396. if data then
  397. for index, value in next, {...} do
  398. t[data[index]] = value
  399. end
  400. end
  401. return t
  402. end
  403. end
  404. local resolvercache = {}
  405. library.resolvercache = resolvercache
  406. local function resolveid(image, flag)
  407. if image then
  408. if type(image) == "string" then
  409. if (#image > 14 and string.sub(image, 1, 13) == "rbxassetid://") or (#image > 12 and string.sub(image, 1, 11) == "rbxasset://") or (#image > 12 and string.sub(image, 1, 11) ~= "rbxthumb://") then
  410. if flag then
  411. local thing = library.elements[flag] or library.designerelements[flag]
  412. if thing and thing.Set then
  413. task.spawn(thing.Set, thing, image)
  414. end
  415. end
  416. return image
  417. end
  418. end
  419. local orig = image
  420. if resolvercache[orig] then
  421. if flag then
  422. local thing = library.elements[flag] or library.designerelements[flag]
  423. if thing and thing.Set then
  424. task.spawn(thing.Set, thing, resolvercache[orig])
  425. end
  426. end
  427. return resolvercache[orig]
  428. end
  429. image = tonumber(image) or image
  430. local succezz = pcall(function()
  431. local typ = type(image)
  432. if typ == "string" then
  433. if getsynasset then
  434. if #image > 11 and (string.sub(image, 1, 11) == "synasset://") then
  435. return getsynasset(string.sub(image, 12))
  436. elseif (#image > 14) and (string.sub(image, 1, 14) == "synasseturl://") then
  437. local x, e = pcall(function()
  438. local codename, fixes = string.gsub(image, ".", function(c)
  439. if c:lower() == c:upper() and not tonumber(c) then
  440. return ""
  441. end
  442. end)
  443. codename = string.sub(codename, 1, 24) .. tostring(fixes)
  444. local fold = isfolder("./Elite Lib")
  445. if fold then
  446. else
  447. makefolder("./Elite Lib")
  448. end
  449. fold = isfolder("./Elite Lib/Themes")
  450. if fold then
  451. else
  452. makefolder("./Elite Lib/Themes")
  453. end
  454. fold = isfolder("./Elite Lib/Themes/SynapseAssetsCache")
  455. if fold then
  456. else
  457. makefolder("./Elite Lib Themes/SynapseAssetsCache")
  458. end
  459. if not fold or not isfile("./Elite Lib/Themes/SynapseAssetsCache/" .. codename .. ".dat") then
  460. local res = game:HttpGet(string.sub(image, 15))
  461. if res ~= nil then
  462. writefile("./Elite Lib/Themes/SynapseAssetsCache/" .. codename .. ".dat", res)
  463. end
  464. end
  465. return getsynasset(readfile("./Elite Lib/Themes/SynapseAssetsCache/" .. codename .. ".dat"))
  466. end)
  467. if x and e ~= nil then
  468. return e
  469. end
  470. end
  471. end
  472. if (#image < 11) or ((string.sub(image, 1, 13) ~= "rbxassetid://") and (string.sub(image, 1, 11) ~= "rbxasset://") and string.sub(image, 1, 11) ~= "rbxthumb://") then
  473. image = tonumber(image:gsub("%D", ""), 10) or image
  474. typ = type(image)
  475. end
  476. end
  477. if (typ == "number") and (image > 0) then
  478. pcall(function()
  479. local nfo = Marketplace and Marketplace:GetProductInfo(image)
  480. image = tostring(image)
  481. if nfo and nfo.AssetTypeId == 1 then
  482. image = "rbxassetid://" .. image
  483. elseif nfo.AssetTypeId == 13 then
  484. local decal = game:GetObjects("rbxassetid://" .. image)[1]
  485. image = "rbxassetid://" .. ((decal and decal.Texture) or "0"):match("%d+$")
  486. decal = (decal and decal:Destroy() and nil) or nil
  487. end
  488. end)
  489. else
  490. image = nil
  491. end
  492. end)
  493. if succezz and image then
  494. if orig then
  495. resolvercache[orig] = image
  496. end
  497. resolvercache[image] = image
  498. if flag then
  499. local thing = library.elements[flag] or library.designerelements[flag]
  500. if thing and thing.Set then
  501. task.spawn(thing.Set, thing, image)
  502. end
  503. end
  504. end
  505. end
  506. return image
  507. end
  508. library.subs.ResolveID = resolveid
  509. library.resolvercache = resolvercache
  510. local colored, colors = library.colored, library.colors
  511. local tweenService = game:GetService("TweenService")
  512. local updatecolors, MainScreenGui = nil
  513. do
  514. local MayGC = 0
  515. spawn(function()
  516. local IsDescendantOf = game.IsDescendantOf
  517. local RemoveTable = table.remove
  518. while wait_check() do
  519. while shared.NO_LIB_GC do
  520. wait(20)
  521. if wait_check() then
  522. else
  523. return
  524. end
  525. end
  526. wait(10)
  527. local Breathe = 30
  528. for DataIndex = #colored, 1, -1 do
  529. if MayGC > 0 then
  530. break
  531. end
  532. Breathe -= 1
  533. if Breathe <= 0 then
  534. Breathe = 30
  535. if wait_check() then
  536. if MayGC > 0 then
  537. break
  538. end
  539. else
  540. return
  541. end
  542. end
  543. if MayGC > 0 then
  544. break
  545. end
  546. local data = colored[DataIndex]
  547. data = data and data[1]
  548. if data and (typeof(data) == "Instance") and IsDescendantOf(data, MainScreenGui) then
  549. elseif MayGC <= 0 then
  550. RemoveTable(colored, DataIndex)
  551. else
  552. break
  553. end
  554. end
  555. local sigs = library.signals
  556. local len = sigs and #sigs
  557. if len then
  558. local Dyn = math.round(len / 10)
  559. Dyn = ((Dyn < 1) and 1) or Dyn
  560. for DataIndex = len, 1, -1 do
  561. Breathe -= 1
  562. if Breathe <= 0 then
  563. Breathe = Dyn
  564. if wait_check() then
  565. else
  566. return
  567. end
  568. end
  569. local data = sigs[DataIndex]
  570. if data and (typeof(data) == "RBXScriptConnection") and data.Connected then
  571. else
  572. RemoveTable(sigs, DataIndex)
  573. end
  574. end
  575. end
  576. end
  577. end)
  578. local function colortwee(data, tweenit)
  579. local cclr = colors[data[3]]
  580. local darkness = data[4]
  581. tweenService:Create(data[1], TweenInfo.new(tweenit, library.configuration.easingStyle, library.configuration.easingDirection), {
  582. [data[2]] = (darkness and darkness ~= 1 and darkenColor(cclr, darkness)) or cclr
  583. }):Play()
  584. end
  585. local function colordarktwee(data)
  586. local cclr = colors[data[3]]
  587. local darkness = data[4]
  588. data[1][data[2]] = (darkness and darkness ~= 1 and darkenColor(cclr, darkness)) or cclr
  589. end
  590. function updatecolors(tweenit)
  591. MayGC += 1
  592. if library.objects and (#library.objects > 0 or next(library.objects)) then
  593. for _, data in next, colored do
  594. local x, e
  595. if tweenit then
  596. x, e = pcall(colortwee, data, tweenit)
  597. end
  598. if x then
  599. else
  600. local x, e = pcall(colordarktwee, data)
  601. if e and not x then
  602. warn(debug.traceback(e))
  603. end
  604. end
  605. end
  606. pcall(function()
  607. if library.Backdrop then
  608. library.Backdrop.Visible = library_flags["__Designer.Background.UseBackgroundImage"] and true
  609. library.Backdrop.Image = resolveid(library_flags["__Designer.Background.ImageAssetID"], "__Designer.Background.ImageAssetID") or ""
  610. library.Backdrop.ImageColor3 = library_flags["__Designer.Background.ImageColor"] or Color3.new(1, 1, 1)
  611. library.Backdrop.ImageTransparency = (library_flags["__Designer.Background.ImageTransparency"] or 95) / 100
  612. end
  613. end)
  614. end
  615. MayGC -= 1
  616. end
  617. end
  618. local function updatecolorsnotween()
  619. updatecolors()
  620. end
  621. library.subs.updatecolors = updatecolors
  622. library.colors = setmetatable({}, {
  623. __index = colors,
  624. __newindex = function(_, k, v)
  625. if colors[k] ~= v then
  626. colors[k] = v
  627. spawn(updatecolorsnotween)
  628. end
  629. end
  630. })
  631. local elements = library.elements
  632. shared.libraries = shared.libraries or {}
  633. local colorpickerconflicts = library.colorpickerconflicts
  634. local keyHandler = {
  635. notAllowedKeys = {
  636. [Enum.KeyCode.Return] = true,
  637. [Enum.KeyCode.Space] = true,
  638. [Enum.KeyCode.Tab] = true,
  639. [Enum.KeyCode.Unknown] = true,
  640. [Enum.KeyCode.Backspace] = true
  641. },
  642. notAllowedMouseInputs = {
  643. [Enum.UserInputType.MouseMovement] = true,
  644. [Enum.UserInputType.MouseWheel] = true,
  645. [Enum.UserInputType.MouseButton1] = true,
  646. [Enum.UserInputType.MouseButton2] = true,
  647. [Enum.UserInputType.MouseButton3] = true
  648. },
  649. allowedKeys = {
  650. [Enum.KeyCode.LeftShift] = "LShift",
  651. [Enum.KeyCode.RightShift] = "RShift",
  652. [Enum.KeyCode.LeftControl] = "LCtrl",
  653. [Enum.KeyCode.RightControl] = "RCtrl",
  654. [Enum.KeyCode.LeftAlt] = "LAlt",
  655. [Enum.KeyCode.RightAlt] = "RAlt",
  656. [Enum.KeyCode.CapsLock] = "CAPS",
  657. [Enum.KeyCode.One] = "1",
  658. [Enum.KeyCode.Two] = "2",
  659. [Enum.KeyCode.Three] = "3",
  660. [Enum.KeyCode.Four] = "4",
  661. [Enum.KeyCode.Five] = "5",
  662. [Enum.KeyCode.Six] = "6",
  663. [Enum.KeyCode.Seven] = "7",
  664. [Enum.KeyCode.Eight] = "8",
  665. [Enum.KeyCode.Nine] = "9",
  666. [Enum.KeyCode.Zero] = "0",
  667. [Enum.KeyCode.KeypadOne] = "Num-1",
  668. [Enum.KeyCode.KeypadTwo] = "Num-2",
  669. [Enum.KeyCode.KeypadThree] = "Num-3",
  670. [Enum.KeyCode.KeypadFour] = "Num-4",
  671. [Enum.KeyCode.KeypadFive] = "Num-5",
  672. [Enum.KeyCode.KeypadSix] = "Num-6",
  673. [Enum.KeyCode.KeypadSeven] = "Num-7",
  674. [Enum.KeyCode.KeypadEight] = "Num-8",
  675. [Enum.KeyCode.KeypadNine] = "Num-9",
  676. [Enum.KeyCode.KeypadZero] = "Num-0",
  677. [Enum.KeyCode.Minus] = "-",
  678. [Enum.KeyCode.Equals] = "=",
  679. [Enum.KeyCode.Tilde] = "~",
  680. [Enum.KeyCode.LeftBracket] = "[",
  681. [Enum.KeyCode.RightBracket] = "]",
  682. [Enum.KeyCode.RightParenthesis] = ")",
  683. [Enum.KeyCode.LeftParenthesis] = "(",
  684. [Enum.KeyCode.Semicolon] = ";",
  685. [Enum.KeyCode.Quote] = "'",
  686. [Enum.KeyCode.BackSlash] = "\\",
  687. [Enum.KeyCode.Comma] = ",",
  688. [Enum.KeyCode.Period] = ".",
  689. [Enum.KeyCode.Slash] = "/",
  690. [Enum.KeyCode.Asterisk] = "*",
  691. [Enum.KeyCode.Plus] = "+",
  692. [Enum.KeyCode.Period] = ".",
  693. [Enum.KeyCode.Backquote] = "`"
  694. }
  695. }
  696. local SeverAllConnections = nil
  697. function SeverAllConnections(t, cache)
  698. cache = cache or {}
  699. for k, v in next, t do
  700. t[k] = nil
  701. if v ~= nil then
  702. if cache[v] then
  703. continue
  704. end
  705. local te = v and typeof(v)
  706. if te then
  707. if te == "RBXScriptConnection" then
  708. v:Disconnect()
  709. elseif te == "Instance" then
  710. v:Destroy()
  711. elseif te == "table" then
  712. cache[v] = true
  713. SeverAllConnections(v, cache)
  714. end
  715. end
  716. end
  717. end
  718. end
  719. library.Subs.SeverAllConnections = SeverAllConnections
  720. local function hardunload(library)
  721. if library.UnloadCallback and (type(library.UnloadCallback) == "function") then
  722. local x, e = pcall(library.UnloadCallback)
  723. if not x and e then
  724. task.spawn(error, e, 2)
  725. end
  726. end
  727. for cflag, data in next, elements do
  728. if data.Type ~= "Persistence" then
  729. if data.Set and data.Options.UnloadValue ~= nil then
  730. data.Set(data.Options.UnloadValue)
  731. end
  732. if data.Options.UnloadFunc then
  733. local y, u = pcall(data.Options.UnloadFunc)
  734. if not y and u then
  735. warn(debug.traceback("Error unloading '" .. tostring(cflag) .. "'\n" .. u))
  736. end
  737. end
  738. end
  739. end
  740. local hardcache = {}
  741. SeverAllConnections(library.signals, hardcache)
  742. SeverAllConnections(library.objects, hardcache)
  743. hardcache = (table.clear(hardcache) and nil) or nil
  744. library.signals = nil
  745. library.objects = nil
  746. end
  747. library.Subs.UnloadArg = hardunload
  748. local function unloadall()
  749. if shared.libraries then
  750. local b = 50
  751. while #shared.libraries > 0 do
  752. b = b - 1
  753. if b < 0 then
  754. b = 50
  755. wait(warn("Looped 50 times while unloading....?"))
  756. end
  757. local v = shared.libraries[1]
  758. if v and v.unload and (type(v.unload) == "function") then
  759. if not pcall(v.unload) then
  760. pcall(hardunload, v)
  761. for k in next, v do
  762. v[k] = nil
  763. end
  764. end
  765. if shared.libraries then
  766. pcall(function()
  767. table.remove(shared.libraries, 1)
  768. end)
  769. else
  770. return pcall(hardunload, library)
  771. end
  772. end
  773. end
  774. end
  775. shared.libraries = nil
  776. end
  777. shared.unloadall = unloadall
  778. library.unloadall = unloadall
  779. shared.libraries[1 + #shared.libraries] = library
  780. function library.unload()
  781. __runscript = nil
  782. hardunload(library)
  783. if shared.libraries then
  784. for k, v in next, shared.libraries or {} do
  785. if v == library then
  786. for k in next, table.remove(shared.libraries or {}, k) do
  787. v[k] = nil
  788. end
  789. break
  790. end
  791. end
  792. if shared.libraries and (#shared.libraries == 0) then
  793. shared.libraries = nil
  794. end
  795. end
  796. warn("Unloaded")
  797. end
  798. library.Unload = library.unload
  799. local Instance_new = (syn and syn.protect_gui and function(...)
  800. local x = {Instance.new(...)}
  801. if x[1] then
  802. library.objects[1 + #library.objects] = x[1]
  803. pcall(syn.protect_gui, x[1])
  804. end
  805. return unpack(x)
  806. end) or function(...)
  807. local x = {Instance.new(...)}
  808. if x[1] then
  809. library.objects[1 + #library.objects] = x[1]
  810. end
  811. return unpack(x)
  812. end
  813. library.subs.Instance_new = Instance_new
  814. local playersservice = game:GetService("Players")
  815. local function getresolver(listt, filter, method, _)
  816. local huo, args = type(filter), {}
  817. local hou = typeof(listt)
  818. return ((hou == "function") and function(...)
  819. return listt(...)
  820. end) or ((hou == "table") and function()
  821. return listt
  822. end) or function()
  823. local hardtype = nil
  824. local g = listt
  825. for _ = 1, 5 do
  826. hardtype = typeof(g)
  827. if hardtype == "function" then
  828. local x, e = pcall(listt)
  829. if x and e then
  830. g = e
  831. end
  832. hardtype = typeof(g)
  833. end
  834. if hardtype == "Instance" then
  835. local lastg = g
  836. if method == nil and listt == playersservice then
  837. g = listt:GetPlayers()
  838. end
  839. if method then
  840. local metype = type(method)
  841. if metype == "table" then
  842. method = method.Method or method[1]
  843. args = method.Args or method.Arguments or unpack(method, (method.Method ~= nil and 1) or 2)
  844. metype = type(method)
  845. end
  846. local y, u = nil, nil
  847. if metype == "function" then
  848. y, u = pcall(method, listt, unpack(args))
  849. elseif metype == "string" then
  850. local y, u = pcall(function()
  851. return listt[method](listt, unpack(args))
  852. end)
  853. else
  854. warn("Idk how to handle method type of", metype, debug.traceback(""))
  855. end
  856. if u then
  857. if y then
  858. g = u
  859. else
  860. warn("Error trying method", method, "on", listt, debug.traceback(u))
  861. end
  862. end
  863. end
  864. if g == lastg then
  865. g = listt:GetChildren()
  866. end
  867. end
  868. if hardtype == "Enum" then
  869. g = listt:GetEnumItems()
  870. end
  871. hardtype = typeof(g)
  872. if hardtype == "table" then
  873. break
  874. end
  875. end
  876. hardtype = typeof(g)
  877. if hardtype ~= "table" then
  878. warn("Could not resolve " .. hou .. " type to a list.")
  879. return {}
  880. end
  881. if filter then
  882. if huo == "function" then
  883. local accept = {}
  884. for _, v in next, g do
  885. local x, e = pcall(filter, v)
  886. if x and e then
  887. accept[1 + #accept] = (e == true and v) or e
  888. end
  889. end
  890. g = accept
  891. elseif huo == "string" then
  892. local accept = {}
  893. for _, v in next, g do
  894. if tostring(v):lower():find(huo) then
  895. accept[1 + #accept] = v
  896. end
  897. end
  898. g = accept
  899. elseif huo == "table" then
  900. local accept = {}
  901. if type(filter[1]) == "string" then
  902. for _, v in next, g do
  903. if tostring(v):lower():find(huo) then
  904. accept[1 + #accept] = v
  905. elseif filter[0] then
  906. accept[1 + #accept] = v
  907. end
  908. end
  909. else
  910. for _, v in next, g do
  911. if not table.find(filter, v) and not table.find(filter, tostring(v)) then
  912. accept[1 + #accept] = v
  913. elseif not filter[0] then
  914. accept[1 + #accept] = v
  915. end
  916. end
  917. end
  918. g = accept
  919. end
  920. end
  921. return g
  922. end
  923. end
  924. library.subs.GetResolver = getresolver
  925. local function resetall()
  926. destroyrainbowsg = true
  927. pcall(function()
  928. for k, v in next, elements do
  929. if v and k and v.Set and (v.Default ~= nil) and (library_flags[k] ~= v.Default) and (string.sub(k, 1, 11) ~= "__Designer.") then
  930. v:Set(v.Default)
  931. end
  932. end
  933. end)
  934. end
  935. library.ResetAll = resetall
  936. local textService = game:GetService("TextService")
  937. local userInputService = game:GetService("UserInputService")
  938. local runService = game:GetService("RunService")
  939. local LP = playersservice.LocalPlayer
  940. library.LP = LP
  941. library.Players = playersservice
  942. library.UserInputService = userInputService
  943. library.RunService = runService
  944. local mouse = LP and LP:GetMouse()
  945. if not mouse and PluginManager and runService:IsStudio() then
  946. shared.library_plugin = shared.library_plugin or print("Creating Studio Test-Plugin...") or PluginManager():CreatePlugin()
  947. mouse = shared.library_plugin:GetMouse()
  948. library.plugin = shared.library_plugin
  949. end
  950. library.Mouse = mouse
  951. local textToSize = nil
  952. do
  953. local textService = game:GetService("TextService")
  954. local bigv2 = Vector2.one * math.huge
  955. function textToSize(object)
  956. return textService:GetTextSize(object.Text, object.TextSize, object.Font, bigv2)
  957. end
  958. end
  959. library.subs.textToSize = textToSize
  960. local function removeSpaces(str)
  961. if str then
  962. local newStr = str:gsub(" ", "")
  963. return newStr
  964. end
  965. end
  966. library.subs.removeSpaces = removeSpaces
  967. local function Color3FromHex(hex)
  968. hex = hex:gsub("#", ""):upper():gsub("0X", "")
  969. return Color3.fromRGB(tonumber(hex:sub(1, 2), 16), tonumber(hex:sub(3, 4), 16), tonumber(hex:sub(5, 6), 16))
  970. end
  971. library.subs.Color3FromHex = Color3FromHex
  972. local floor = math.floor
  973. local function Color3ToHex(color)
  974. local r, g, b = string.format("%X", floor(color.R * 255)), string.format("%X", floor(color.G * 255)), string.format("%X", floor(color.B * 255))
  975. if #r < 2 then
  976. r = "0" .. r
  977. end
  978. if #g < 2 then
  979. g = "0" .. g
  980. end
  981. if #b < 2 then
  982. b = "0" .. b
  983. end
  984. return string.format("%s%s%s", r, g, b)
  985. end
  986. if Color3.ToHex and not shared.overridecolortohex then
  987. local x, e = pcall(Color3.ToHex, Color3.new())
  988. if x and type(e) == "string" and #e == 6 then
  989. Color3ToHex = Color3.ToHex
  990. end
  991. end
  992. library.subs.Color3ToHex = Color3ToHex
  993. local isDraggingSomething = false
  994. local function makeDraggable(topBarObject, object)
  995. local dragging = nil
  996. local dragInput = nil
  997. local dragStart = nil
  998. local startPosition = nil
  999. library.signals[1 + #library.signals] = topBarObject.InputBegan:Connect(function(input)
  1000. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  1001. dragging = true
  1002. dragStart = input.Position
  1003. startPosition = object.Position
  1004. input.Changed:Connect(function()
  1005. if input.UserInputState == Enum.UserInputState.End then
  1006. dragging = false
  1007. end
  1008. end)
  1009. end
  1010. end)
  1011. library.signals[1 + #library.signals] = topBarObject.InputChanged:Connect(function(input)
  1012. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  1013. dragInput = input
  1014. end
  1015. end)
  1016. library.signals[1 + #library.signals] = userInputService.InputChanged:Connect(function(input)
  1017. if input == dragInput and dragging then
  1018. local delta = input.Position - dragStart
  1019. if not isDraggingSomething and library.configuration.smoothDragging then
  1020. tweenService:Create(object, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  1021. Position = UDim2.new(startPosition.X.Scale, startPosition.X.Offset + delta.X, startPosition.Y.Scale, startPosition.Y.Offset + delta.Y)
  1022. }):Play()
  1023. elseif not isDraggingSomething and not library.configuration.smoothDragging then
  1024. object.Position = UDim2.new(startPosition.X.Scale, startPosition.X.Offset + delta.X, startPosition.Y.Scale, startPosition.Y.Offset + delta.Y)
  1025. end
  1026. end
  1027. end)
  1028. end
  1029. library.subs.makeDraggable = makeDraggable
  1030. local JSONEncode, JSONDecode = nil, nil
  1031. do
  1032. local temp_http = game:FindService("HttpService") or game:GetService("HttpService")
  1033. local httpservice = temp_http
  1034. if cloneref and (type(cloneref) == "function") then
  1035. httpservice, temp_http = cloneref(httpservice), nil
  1036. end
  1037. library.Http = httpservice
  1038. local JSONEncodeFunc = httpservice.JSONEncode
  1039. function JSONEncode(...)
  1040. return pcall(JSONEncodeFunc, httpservice, ...)
  1041. end
  1042. library.JSONEncode = JSONEncode
  1043. local JSONDecodeFunc = httpservice.JSONDecode
  1044. function JSONDecode(...)
  1045. return pcall(JSONDecodeFunc, httpservice, ...)
  1046. end
  1047. library.JSONDecode = JSONDecode
  1048. end
  1049. local convertfilename
  1050. do
  1051. local string_gsub = string.gsub
  1052. function convertfilename(str, default, replace)
  1053. replace = replace or "_"
  1054. local corrections = 0
  1055. local predname = string_gsub(str, "%W", function(c)
  1056. local byt = c:byte()
  1057. if ((byt == 0) or (byt == 32) or (byt == 33) or (byt == 59) or (byt == 61) or ((byt >= 35) and (byt <= 41)) or ((byt >= 43) and (byt <= 57)) or ((byt >= 64) and (byt <= 123)) or ((byt >= 125) and (byt <= 127))) then
  1058. else
  1059. corrections = 1 + corrections
  1060. return replace
  1061. end
  1062. end)
  1063. return (default and corrections == #predname and tostring(default)) or predname
  1064. end
  1065. library.subs.ConvertFilename = convertfilename
  1066. end
  1067. do
  1068. do
  1069. local function NewOption(TextStr, Order, Parent)
  1070. local Option = Instance_new("Frame")
  1071. local BBorder = Instance_new("Frame")
  1072. local Inner_2 = Instance_new("Frame")
  1073. local Border_2 = Instance_new("Frame")
  1074. local Text = Instance_new("TextLabel")
  1075. local Button = Instance_new("TextButton")
  1076. Option.AnchorPoint = Vector2.new(0, 0.5)
  1077. Option.BackgroundColor3 = library.colors.background
  1078. colored[1 + #colored] = {Option, "BackgroundColor3", "background"}
  1079. Option.BorderColor3 = Color3.fromRGB(27, 27, 27)
  1080. Option.LayoutOrder = Order or #Parent:GetChildren()
  1081. Option.Name = "Option"
  1082. Option.Position = UDim2.new(0, 5, 0.5, 0)
  1083. Option.Size = UDim2.new(0, 35, 0, 25)
  1084. BBorder.AnchorPoint = Vector2.new(0.5, 0.5)
  1085. BBorder.BackgroundColor3 = library.colors.background
  1086. colored[1 + #colored] = {BBorder, "BackgroundColor3", "background"}
  1087. BBorder.BorderColor3 = Color3.fromRGB(50, 43, 50)
  1088. BBorder.BorderMode = Enum.BorderMode.Inset
  1089. BBorder.Name = "BBorder"
  1090. BBorder.Parent = Option
  1091. BBorder.Position = UDim2.new(0.5, 0, 0.5, 0)
  1092. BBorder.Size = UDim2.new(1, 0, 1, 0)
  1093. Inner_2.AnchorPoint = Vector2.new(0.5, 0.5)
  1094. Inner_2.BackgroundColor3 = library.colors.background
  1095. colored[1 + #colored] = {Inner_2, "BackgroundColor3", "background"}
  1096. Inner_2.BorderColor3 = Color3.fromRGB(27, 27, 27)
  1097. Inner_2.Name = "Inner"
  1098. Inner_2.Parent = Option
  1099. Inner_2.Position = UDim2.new(0.5, 0, 0.5, 0)
  1100. Inner_2.Size = UDim2.new(1, -6, 1, -6)
  1101. Border_2.AnchorPoint = Vector2.new(0.5, 0.5)
  1102. Border_2.BackgroundColor3 = library.colors.background
  1103. colored[1 + #colored] = {Border_2, "BackgroundColor3", "background"}
  1104. Border_2.BorderColor3 = Color3.fromRGB(50, 43, 50)
  1105. Border_2.BorderMode = Enum.BorderMode.Inset
  1106. Border_2.Name = "Border"
  1107. Border_2.Parent = Inner_2
  1108. Border_2.Position = UDim2.new(0.5, 0, 0.5, 0)
  1109. Border_2.Size = UDim2.new(1, 0, 1, 0)
  1110. Text.AnchorPoint = Vector2.new(0.5, 0.5)
  1111. Text.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  1112. Text.BackgroundTransparency = 1
  1113. Text.Font = Enum.Font.Code
  1114. Text.FontSize = Enum.FontSize.Size14
  1115. Text.Name = "Text"
  1116. Text.Parent = Border_2
  1117. Text.Position = UDim2.new(0.5, 0, 0.5, 0)
  1118. Text.Size = UDim2.new(1, 0, 1, 0)
  1119. Text.TextColor3 = library.colors.elementText
  1120. colored[1 + #colored] = {Text, "TextColor3", "elementText"}
  1121. Text.TextSize = 14
  1122. Text.TextStrokeTransparency = 0.75
  1123. Button.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  1124. Button.BackgroundTransparency = 1
  1125. Button.BorderSizePixel = 0
  1126. Button.Font = Enum.Font.SourceSans
  1127. Button.FontSize = Enum.FontSize.Size14
  1128. Button.Name = "Button"
  1129. Button.Parent = Option
  1130. Button.Size = UDim2.new(1, 0, 1, 0)
  1131. Button.Text = ""
  1132. Button.TextColor3 = Color3.fromRGB(0, 0, 0)
  1133. Button.TextSize = 14
  1134. Button.TextTransparency = 1
  1135. Text.Text = TextStr
  1136. local siz = textToSize(Text)
  1137. Option.Size = UDim2.new(0, math.max(siz.X, 28) + 12, 0, 25)
  1138. Option.Parent = Parent
  1139. return Option, Button, Text
  1140. end
  1141. local function AddOption(OptionData, Key, OptionCount, Parent, Close, PromptEvent, KeepOpen)
  1142. local Enabled = OptionData.Enabled
  1143. if OptionData.Disabled then
  1144. Enabled = false
  1145. else
  1146. Enabled = Enabled or (Enabled == nil)
  1147. end
  1148. local OptionText = OptionData.Text or OptionData.String or OptionData.Message or OptionData.Value or OptionData.Name or Key
  1149. local Callback = OptionData.Callback or OptionData.OnPressed or OptionData.Function or nil
  1150. local Order = tonumber(OptionData.Slot or OptionData.Order or OptionData.LayoutOrder or OptionData.Index or OptionCount)
  1151. local OptionIns, OptionButton, OptionTxt = NewOption(tostring(OptionText), Order, Parent)
  1152. local OptionObj = {
  1153. Text = OptionText,
  1154. Callback = Callback,
  1155. ButtonObject = OptionIns,
  1156. Pressed = OptionButton.MouseButton1Click,
  1157. PressedRight = OptionButton.MouseButton2Click,
  1158. Activated = OptionButton.Activated,
  1159. TextButton = OptionButton,
  1160. Order = Order,
  1161. Enabled = Enabled
  1162. }
  1163. function OptionObj.Remove()
  1164. do
  1165. local Btn = OptionObj.ButtonObject
  1166. if Btn then
  1167. Btn:Destroy()
  1168. end
  1169. end
  1170. for k in next, OptionObj do
  1171. rawset(OptionObj, k, nil)
  1172. end
  1173. return true
  1174. end
  1175. local Proxy = nil
  1176. local function Clicked(f)
  1177. return function(...)
  1178. if f then
  1179. task.spawn(f, ...)
  1180. end
  1181. PromptEvent:Fire(Key, OptionButton.Text, ...)
  1182. if KeepOpen then
  1183. else
  1184. Close()
  1185. end
  1186. end
  1187. end
  1188. function OptionObj.Press(...)
  1189. OptionObj.Update()
  1190. Proxy = Proxy or Clicked(Callback)
  1191. Proxy(...)
  1192. end
  1193. function OptionObj.Lock()
  1194. OptionObj.Enabled = false
  1195. OptionObj.Update()
  1196. end
  1197. function OptionObj.Unlock()
  1198. OptionObj.Enabled = true
  1199. OptionObj.Update()
  1200. end
  1201. function OptionObj.SetLocked(self, state)
  1202. if type(self) == "boolean" then
  1203. state = self
  1204. end
  1205. OptionObj.Enabled = state
  1206. OptionObj.Update()
  1207. end
  1208. function OptionObj.SetCondition(self, Condition)
  1209. if type(self) ~= "table" then
  1210. Condition = self
  1211. end
  1212. OptionObj.Condition = Condition
  1213. OptionObj.Update()
  1214. end
  1215. function OptionObj.Update()
  1216. do
  1217. local OptionText = OptionObj.Text or OptionData.Text or OptionData.String or OptionData.Message or OptionData.Value or OptionData.Name or OptionButton.Text or Key
  1218. OptionButton.Text = tostring(OptionText)
  1219. end
  1220. OptionIns.LayoutOrder = tonumber(OptionObj.Order or OptionData.Slot or OptionData.Order or OptionData.LayoutOrder or OptionData.Index or OptionIns.LayoutOrder or OptionCount)
  1221. do
  1222. local Enabled = OptionData.Enabled
  1223. local Cond = OptionObj.Condition
  1224. if Cond then
  1225. local x, e = pcall(Cond, OptionObj)
  1226. if x then
  1227. Enabled = e and true
  1228. else
  1229. warn(debug.traceback(string.format("Error in prompt-option %s's Condition function: %s", OptionButton.Text, e), 2))
  1230. end
  1231. else
  1232. if OptionData.Disabled then
  1233. Enabled = false
  1234. else
  1235. Enabled = (Enabled and true) or (Enabled == nil)
  1236. end
  1237. end
  1238. local Proxy = nil
  1239. do
  1240. local nCallback = (Enabled and (OptionData.Callback or OptionData.OnPressed or OptionData.Function)) or nil
  1241. if not Proxy or Callback ~= nCallback then
  1242. Callback = nCallback
  1243. Proxy = Clicked(Callback)
  1244. OptionObj.PressedConnection = (OptionObj.PressedConnection and OptionObj.PressedConnection:Disconnect() and nil) or (Callback and OptionObj.Pressed:Connect(Proxy)) or nil
  1245. end
  1246. local PC = OptionObj.PressedConnection
  1247. if Enabled then
  1248. if PC then
  1249. if Callback then
  1250. else
  1251. OptionObj.PressedConnection = (PC:Disconnect() and nil) or nil
  1252. end
  1253. elseif Callback then
  1254. Proxy = Proxy or Clicked(Callback)
  1255. OptionObj.PressedConnection = OptionObj.Pressed:Connect(Proxy)
  1256. end
  1257. elseif PC then
  1258. OptionObj.PressedConnection = (PC:Disconnect() and nil) or nil
  1259. end
  1260. end
  1261. OptionObj.Enabled = Enabled
  1262. OptionTxt.TextTransparency = (Enabled and 0) or 0.5
  1263. end
  1264. return OptionObj
  1265. end
  1266. OptionObj.Update()
  1267. return OptionObj
  1268. end
  1269. local function SortByLayoutOrder(a, b)
  1270. return a.Order < b.Order
  1271. end
  1272. local DefaultSelections = {
  1273. Ok = true
  1274. }
  1275. function library.Prompt(self, PromptData, ...)
  1276. if rawequal(self, library) then
  1277. else
  1278. PromptData, self = self, library
  1279. end
  1280. local PromptEvent = Instance_new("BindableEvent")
  1281. local PromptObj = {
  1282. OnSelect = PromptEvent.Event,
  1283. Active = true,
  1284. SelectedEvent = PromptEvent
  1285. }
  1286. local ChoicePopup = Instance_new("Frame")
  1287. local Buttons = Instance_new("ScrollingFrame")
  1288. local Title = Instance_new("TextLabel")
  1289. local Description = Instance_new("TextLabel")
  1290. local DoClose = PromptData.CloseButton
  1291. DoClose = (DoClose == nil) or (DoClose == true) or DoClose or nil
  1292. local Close = DoClose and Instance_new("ImageButton")
  1293. do
  1294. local Border = Instance_new("Frame")
  1295. local Inner = Instance_new("Frame")
  1296. local InnerBorder = Instance_new("Frame")
  1297. local Bar = Instance_new("Frame")
  1298. local Splitter = Instance_new("Frame")
  1299. local ButtonBar = Instance_new("Frame")
  1300. local UIListLayout = Instance_new("UIListLayout")
  1301. ChoicePopup.AnchorPoint = Vector2.new(0.5, 0.5)
  1302. ChoicePopup.BackgroundColor3 = library.colors.background
  1303. colored[1 + #colored] = {ChoicePopup, "BackgroundColor3", "background"}
  1304. ChoicePopup.BorderColor3 = library.colors.outerBorder
  1305. colored[1 + #colored] = {ChoicePopup, "BorderColor3", "outerBorder"}
  1306. ChoicePopup.Name = "ChoicePopup"
  1307. ChoicePopup.Position = UDim2.new(0.5, 0, 0.5, 0)
  1308. ChoicePopup.Size = UDim2.new(0, 325, 0, 100)
  1309. Border.AnchorPoint = Vector2.new(0.5, 0.5)
  1310. Border.BackgroundColor3 = library.colors.background
  1311. colored[1 + #colored] = {Border, "BackgroundColor3", "background"}
  1312. Border.BorderColor3 = library.colors.innerBorder
  1313. colored[1 + #colored] = {Border, "BorderColor3", "innerBorder"}
  1314. Border.BorderMode = Enum.BorderMode.Inset
  1315. Border.Name = "Border"
  1316. Border.Parent = ChoicePopup
  1317. Border.Position = UDim2.new(0.5, 0, 0.5, 0)
  1318. Border.Size = UDim2.new(1, 0, 1, 0)
  1319. Inner.AnchorPoint = Vector2.new(0.5, 0.5)
  1320. Inner.BackgroundColor3 = library.colors.background
  1321. colored[1 + #colored] = {Inner, "BackgroundColor3", "background"}
  1322. Inner.BorderColor3 = library.colors.outerBorder
  1323. colored[1 + #colored] = {Inner, "BorderColor3", "outerBorder"}
  1324. Inner.Name = "Inner"
  1325. Inner.Parent = ChoicePopup
  1326. Inner.Position = UDim2.new(0.5, 0, 0.5, 0)
  1327. Inner.Size = UDim2.new(1, -8, 1, -8)
  1328. InnerBorder.AnchorPoint = Vector2.new(0.5, 0.5)
  1329. InnerBorder.BackgroundColor3 = library.colors.background
  1330. colored[1 + #colored] = {InnerBorder, "BackgroundColor3", "background"}
  1331. InnerBorder.BorderColor3 = library.colors.innerBorder
  1332. colored[1 + #colored] = {InnerBorder, "BorderColor3", "innerBorder"}
  1333. InnerBorder.BorderMode = Enum.BorderMode.Inset
  1334. InnerBorder.Name = "InnerBorder"
  1335. InnerBorder.Parent = Inner
  1336. InnerBorder.Position = UDim2.new(0.5, 0, 0.5, 0)
  1337. InnerBorder.Size = UDim2.new(1, 0, 1, 0)
  1338. Bar.BackgroundColor3 = library.colors.main
  1339. colored[1 + #colored] = {Bar, "BackgroundColor3", "main"}
  1340. Bar.BorderSizePixel = 0
  1341. Bar.Name = "Bar"
  1342. Bar.Parent = InnerBorder
  1343. Bar.Size = UDim2.new(1, 0, 0, 3)
  1344. Splitter.AnchorPoint = Vector2.new(0, 1)
  1345. Splitter.BackgroundColor3 = Color3.fromRGB(38, 38, 38)
  1346. Splitter.BorderSizePixel = 0
  1347. Splitter.Name = "Splitter"
  1348. Splitter.Parent = InnerBorder
  1349. Splitter.Position = UDim2.new(0, 0, 1, -35)
  1350. Splitter.Size = UDim2.new(1, 0, 0, 1)
  1351. Title.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  1352. Title.BackgroundTransparency = 1
  1353. Title.Font = Enum.Font.Code
  1354. Title.FontSize = Enum.FontSize.Size18
  1355. Title.Parent = InnerBorder
  1356. Title.Position = UDim2.new(0, 6, 0, 4)
  1357. Title.Size = UDim2.new(0, 300, 0, 25)
  1358. Title.TextColor3 = library.colors.elementText
  1359. colored[1 + #colored] = {Title, "TextColor3", "elementText"}
  1360. Title.TextSize = 15
  1361. Title.TextStrokeTransparency = 0.95
  1362. Title.TextXAlignment = Enum.TextXAlignment.Left
  1363. Description.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  1364. Description.BackgroundTransparency = 1
  1365. Description.Font = Enum.Font.Code
  1366. Description.FontSize = Enum.FontSize.Size14
  1367. Description.Name = "Description"
  1368. Description.Parent = InnerBorder
  1369. Description.Position = UDim2.new(0, 6, 0, 25)
  1370. Description.Size = UDim2.new(0, 300, 0, 25)
  1371. Description.TextColor3 = library.colors.elementText
  1372. colored[1 + #colored] = {Description, "TextColor3", "elementText"}
  1373. Description.TextSize = 14
  1374. Description.TextStrokeTransparency = 0.95
  1375. Description.TextTruncate = Enum.TextTruncate.AtEnd
  1376. Description.TextWrap = true
  1377. Description.TextWrapped = true
  1378. Description.TextXAlignment = Enum.TextXAlignment.Left
  1379. if Close then
  1380. Close.AnchorPoint = Vector2.new(1)
  1381. Close.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  1382. Close.BackgroundTransparency = 1
  1383. Close.Image = "http://www.roblox.com/asset/?id=9064270627"
  1384. Close.ImageColor3 = library.colors.section
  1385. colored[1 + #colored] = {Close, "ImageColor3", "section"}
  1386. Close.Name = "Close"
  1387. Close.Parent = InnerBorder
  1388. Close.Position = UDim2.new(1, -9, 0, 11)
  1389. Close.ScaleType = Enum.ScaleType.Fit
  1390. Close.Size = UDim2.new(0, 10, 0, 10)
  1391. end
  1392. ButtonBar.AnchorPoint = Vector2.new(0, 1)
  1393. ButtonBar.BackgroundColor3 = library.colors.sectionBackground
  1394. colored[1 + #colored] = {ButtonBar, "BackgroundColor3", "sectionBackground"}
  1395. ButtonBar.BorderSizePixel = 0
  1396. ButtonBar.Name = "ButtonBar"
  1397. ButtonBar.Parent = InnerBorder
  1398. ButtonBar.Position = UDim2.new(0, 0, 1, 0)
  1399. ButtonBar.Size = UDim2.new(1, 0, 0, 35)
  1400. Buttons.AutomaticCanvasSize = Enum.AutomaticSize.X
  1401. Buttons.BackgroundColor3 = library.colors.sectionBackground
  1402. colored[1 + #colored] = {Buttons, "BackgroundColor3", "sectionBackground"}
  1403. Buttons.BorderColor3 = library.colors.background
  1404. colored[1 + #colored] = {Buttons, "BorderColor3", "background"}
  1405. Buttons.BorderSizePixel = 0
  1406. Buttons.BottomImage = ""
  1407. Buttons.CanvasSize = UDim2.new(0, 0, 0, 0)
  1408. Buttons.MidImage = ""
  1409. Buttons.Name = "Buttons"
  1410. Buttons.Parent = ButtonBar
  1411. Buttons.Position = UDim2.new(0, 6, 0, 0)
  1412. Buttons.ScrollBarImageColor3 = Color3.fromRGB(0, 0, 0)
  1413. Buttons.ScrollBarImageTransparency = 1
  1414. Buttons.ScrollBarThickness = 0
  1415. Buttons.ScrollingDirection = Enum.ScrollingDirection.X
  1416. Buttons.Selectable = false
  1417. Buttons.Size = UDim2.new(1, -12, 1, 0)
  1418. Buttons.TopImage = ""
  1419. UIListLayout.FillDirection = Enum.FillDirection.Horizontal
  1420. UIListLayout.Padding = UDim.new(0, 10)
  1421. UIListLayout.Parent = Buttons
  1422. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  1423. UIListLayout.VerticalAlignment = Enum.VerticalAlignment.Center
  1424. end
  1425. PromptObj.FrameInstance = ChoicePopup
  1426. PromptObj.Closed = ChoicePopup.Destroying
  1427. local function ClosePrompt(method)
  1428. PromptObj.Active = (ChoicePopup and ChoicePopup:Destroy() and nil) or (PromptEvent:Fire("Close", method and (method == "timeout_")) and nil) or nil
  1429. end
  1430. PromptObj.Close = ClosePrompt
  1431. if Close then
  1432. Close.MouseButton1Click:Connect(((DoClose ~= true) and DoClose) or ClosePrompt)
  1433. end
  1434. do
  1435. local NameTxt = PromptData.Name
  1436. Title.Text = ((NameTxt ~= nil) and tostring(NameTxt)) or "Untitled Prompt"
  1437. end
  1438. do
  1439. local DescriptionTxt = PromptData.Description
  1440. if DescriptionTxt == nil then
  1441. DescriptionTxt = PromptData.Text
  1442. if DescriptionTxt == nil then
  1443. DescriptionTxt = PromptData.String
  1444. if DescriptionTxt == nil then
  1445. DescriptionTxt = PromptData.Message
  1446. if DescriptionTxt == nil then
  1447. DescriptionTxt = PromptData.Value
  1448. end
  1449. end
  1450. end
  1451. end
  1452. Description.Text = ((DescriptionTxt ~= nil) and tostring(DescriptionTxt)) or ""
  1453. end
  1454. do
  1455. local Selections = PromptData.Options or PromptData.Buttons or PromptData.Choices
  1456. if Selections then
  1457. if type(Selections) ~= "table" then
  1458. Selections = {
  1459. OK = Selections
  1460. }
  1461. end
  1462. else
  1463. Selections = DefaultSelections
  1464. end
  1465. local OptionCount = 0
  1466. local ButtonsProxy = {}
  1467. PromptObj.Buttons = ButtonsProxy
  1468. function PromptObj.ReOrder(self, SortFunc)
  1469. if self ~= ButtonsProxy then
  1470. SortFunc, self = self, nil
  1471. end
  1472. if SortFunc and (type(SortFunc) ~= "function") then
  1473. SortFunc = SortByLayoutOrder
  1474. end
  1475. local BtnOrder = {}
  1476. for _, Data in next, ButtonsProxy do
  1477. BtnOrder[1 + #BtnOrder] = Data
  1478. end
  1479. table.sort(BtnOrder, SortFunc or SortByLayoutOrder)
  1480. for Order, Data in next, BtnOrder do
  1481. Data.Order = Order or Data.Order
  1482. local UpdateFunc = Data.Update
  1483. if UpdateFunc then
  1484. spawn(UpdateFunc)
  1485. else
  1486. local Frame = Data.ButtonObject
  1487. if Frame then
  1488. Frame.LayoutOrder = Order
  1489. end
  1490. end
  1491. end
  1492. return ButtonsProxy
  1493. end
  1494. function PromptObj.PressAll(self, ...)
  1495. local isSelf = nil
  1496. if self and rawequal(self, PromptObj) then
  1497. isSelf = true
  1498. end
  1499. for _, Data in next, ButtonsProxy do
  1500. local f = Data.Callback
  1501. if f then
  1502. if isSelf then
  1503. f(...)
  1504. else
  1505. f(self, ...)
  1506. end
  1507. end
  1508. end
  1509. end
  1510. local KeepOpen = PromptData.KeepOpen
  1511. for Key, OptionData in next, Selections do
  1512. OptionCount += 1
  1513. do
  1514. local typ = OptionData and type(OptionData)
  1515. if typ ~= "table" then
  1516. OptionData = {
  1517. Name = ((typ == "string") and (type(Key) == "number") and OptionData) or Key,
  1518. Callback = ((typ == "function") and OptionData) or ClosePrompt
  1519. }
  1520. end
  1521. end
  1522. ButtonsProxy[Key] = AddOption(OptionData, Key, OptionCount, Buttons, ClosePrompt, PromptEvent, KeepOpen)
  1523. end
  1524. end
  1525. do
  1526. local to = PromptData.Timeout
  1527. to = to and tonumber(to)
  1528. if to then
  1529. task.delay(to, ClosePrompt, "timeout_")
  1530. end
  1531. end
  1532. ChoicePopup.Parent = MainScreenGui
  1533. makeDraggable(ChoicePopup, ChoicePopup)
  1534. return PromptObj, ChoicePopup
  1535. end
  1536. end
  1537. do
  1538. local Popups = Instance.new("Frame")
  1539. local UIListLayout = Instance.new("UIListLayout")
  1540. library.NotifyLayout = UIListLayout
  1541. Popups.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  1542. Popups.BackgroundTransparency = 1
  1543. Popups.Name = "Popups"
  1544. Popups.Position = UDim2.new(0, 10, 0, 10)
  1545. Popups.Size = UDim2.new(1, -20, 1, -20)
  1546. UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Right
  1547. UIListLayout.Padding = UDim.new(0, 5)
  1548. UIListLayout.Parent = Popups
  1549. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  1550. UIListLayout.VerticalAlignment = Enum.VerticalAlignment.Bottom
  1551. Popups.Parent = MainScreenGui
  1552. library.NotificationsFrame = Popups
  1553. local Inverse = true
  1554. local os_clock = os.clock
  1555. local Notifications = {}
  1556. library.Notifications = Notifications
  1557. spawn(function()
  1558. local v1, vtop, htop = Enum.FillDirection.Vertical, Enum.VerticalAlignment.Top, Enum.HorizontalAlignment.Center
  1559. while wait_check() do
  1560. local Len = #Notifications
  1561. while wait_check() and (Len <= 0) do
  1562. Len = #Notifications
  1563. if wait_check(0.25) then
  1564. else
  1565. return
  1566. end
  1567. end
  1568. Inverse = ((UIListLayout.FillDirection == v1) and (UIListLayout.VerticalAlignment ~= vtop)) or (UIListLayout.HorizontalAlignment ~= htop)
  1569. local BreathingRoom, now = 10, os_clock()
  1570. local Order = 0
  1571. for Index = Len, 1, -1 do
  1572. BreathingRoom -= 1
  1573. if BreathingRoom <= 0 then
  1574. if wait_check() then
  1575. BreathingRoom, now = 10, os_clock()
  1576. else
  1577. return
  1578. end
  1579. end
  1580. local Noti = Notifications[Index]
  1581. local Obj = Noti and Noti.Object
  1582. if Obj and Noti.Active and (Noti.Paused or ((now - Noti.Expires) < Noti.Duration)) then
  1583. if Noti.TextLabel.Text ~= Noti.Text then
  1584. Noti:SetText(Noti.Text)
  1585. end
  1586. if Obj.Visible then
  1587. Order += 1
  1588. Obj.LayoutOrder = Order * ((Inverse and -1) or 1)
  1589. end
  1590. continue
  1591. end
  1592. Noti.Object = ((Noti.Object and Noti.Object:Destroy()) and nil) or (Noti.Destroy() and nil) or (table.remove(Notifications, Index) and nil) or nil
  1593. end
  1594. end
  1595. end)
  1596. function library.Notify(self, NotificationData, ...)
  1597. if rawequal(self, library) then
  1598. else
  1599. NotificationData, self = self, library
  1600. end
  1601. local now = os_clock()
  1602. local dur = NotificationData.Time or 6
  1603. local TextStr = NotificationData.Text or NotificationData.String or NotificationData.Value or NotificationData.Message or NotificationData.Msg
  1604. TextStr = ((TextStr == nil) and "No text given") or tostring(TextStr)
  1605. local NotificationObj = {
  1606. InitTime = now,
  1607. Active = true,
  1608. Forced = false,
  1609. Duration = dur,
  1610. Expires = now + dur,
  1611. Paused = (NotificationData.Paused and true) or false,
  1612. Text = TextStr,
  1613. Arguments = NotificationData
  1614. }
  1615. NotificationObj.Forced = NotificationObj.Paused
  1616. local Notification = Instance.new("Frame")
  1617. NotificationObj.Object = Notification
  1618. local Border = Instance.new("Frame")
  1619. local Inner = Instance.new("Frame")
  1620. local Border_2 = Instance.new("Frame")
  1621. local Text = Instance.new("TextLabel")
  1622. NotificationObj.TextLabel = Text
  1623. local Bar = Instance.new("Frame")
  1624. local Close = Instance.new("ImageButton")
  1625. Notification.AnchorPoint = Vector2.one
  1626. Notification.BackgroundColor3 = library.colors.background
  1627. colored[1 + #colored] = {Notification, "BackgroundColor3", "background"}
  1628. Notification.BorderColor3 = library.colors.outerBorder
  1629. colored[1 + #colored] = {Notification, "BorderColor3", "outerBorder"}
  1630. Notification.Name = "Notification"
  1631. Notification.Position = UDim2.new(1, -10, 1, -10)
  1632. Notification.Size = UDim2.new(0, 5e4, 0, 32)
  1633. Border.AnchorPoint = Vector2.new(0.5, 0.5)
  1634. Border.BackgroundColor3 = library.colors.background
  1635. colored[1 + #colored] = {Border, "BackgroundColor3", "background"}
  1636. Border.BorderColor3 = library.colors.innerBorder
  1637. colored[1 + #colored] = {Border, "BorderColor3", "innerBorder"}
  1638. Border.BorderMode = Enum.BorderMode.Inset
  1639. Border.Name = "Border"
  1640. Border.Parent = Notification
  1641. Border.Position = UDim2.new(0.5, 0, 0.5, 0)
  1642. Border.Size = UDim2.new(1, 0, 1, 0)
  1643. Inner.AnchorPoint = Vector2.one / 2
  1644. Inner.BackgroundColor3 = library.colors.background
  1645. colored[1 + #colored] = {Inner, "BackgroundColor3", "background"}
  1646. Inner.BorderColor3 = library.colors.outerBorder
  1647. colored[1 + #colored] = {Inner, "BorderColor3", "outerBorder"}
  1648. Inner.Name = "Inner"
  1649. Inner.Parent = Notification
  1650. Inner.Position = UDim2.new(0.5, 0, 0.5, 0)
  1651. Inner.Size = UDim2.new(1, -8, 1, -8)
  1652. Border_2.AnchorPoint = Vector2.one / 2
  1653. Border_2.BackgroundColor3 = library.colors.background
  1654. colored[1 + #colored] = {Border_2, "BackgroundColor3", "background"}
  1655. Border_2.BorderColor3 = library.colors.innerBorder
  1656. colored[1 + #colored] = {Border_2, "BorderColor3", "innerBorder"}
  1657. Border_2.BorderMode = Enum.BorderMode.Inset
  1658. Border_2.Name = "Border"
  1659. Border_2.Parent = Inner
  1660. Border_2.Position = UDim2.new(0.5, 0, 0.5, 0)
  1661. Border_2.Size = UDim2.new(1, 0, 1, 0)
  1662. Text.AnchorPoint = Vector2.new(0, 0.5)
  1663. Text.BackgroundTransparency = 1
  1664. Text.Font = Enum.Font.Code
  1665. Text.FontSize = Enum.FontSize.Size14
  1666. Text.Name = "Text"
  1667. Text.Parent = Border_2
  1668. Text.Position = UDim2.new(0, 8, 0.5, 0)
  1669. Text.Size = UDim2.new(1, -8, 1, -7)
  1670. Text.Text = TextStr
  1671. Text.TextColor3 = library.colors.elementText
  1672. colored[1 + #colored] = {Text, "TextColor3", "elementText"}
  1673. Text.TextScaled = true
  1674. Text.TextSize = 14
  1675. Text.TextStrokeTransparency = 0.75
  1676. Text.TextWrap = true
  1677. Text.TextWrapped = true
  1678. Text.TextXAlignment = Enum.TextXAlignment.Left
  1679. Bar.BackgroundColor3 = library.colors.main
  1680. colored[1 + #colored] = {Bar, "BackgroundColor3", "main"}
  1681. Bar.BorderSizePixel = 0
  1682. Bar.Name = "Bar"
  1683. Bar.Parent = Border_2
  1684. Bar.Size = UDim2.new(0, 3, 1, 0)
  1685. Close.AnchorPoint = Vector2.new(1, 0.5)
  1686. Close.BackgroundTransparency = 1
  1687. Close.Image = "rbxassetid://5492252477"
  1688. Close.ImageColor3 = library.colors.elementText
  1689. colored[1 + #colored] = {Close, "ImageColor3", "elementText"}
  1690. Close.Name = "Close"
  1691. Close.Parent = Border_2
  1692. Close.Position = UDim2.new(1, -6, 0.5, 0)
  1693. Close.ScaleType = Enum.ScaleType.Fit
  1694. Close.Size = UDim2.new(0, 10, 0, 10)
  1695. Notification.Size = UDim2.new(0, 64 + textToSize(Text).X, 0, 32)
  1696. Notification.Parent = Popups
  1697. Notification.LayoutOrder = #Notification.Parent:GetChildren() * ((Inverse and 1) or -1)
  1698. if Popups.Parent then
  1699. else
  1700. Popups.Parent = MainScreenGui
  1701. end
  1702. NotificationObj.OnClose = Close.Activated
  1703. NotificationObj.InputBegan = Notification.InputBegan
  1704. NotificationObj.Destroying = Notification.Destroying
  1705. NotificationObj.MouseEnter = Notification.MouseEnter
  1706. NotificationObj.MouseLeave = Notification.MouseLeave
  1707. function NotificationObj.SetText(self, Str)
  1708. if rawequal(self, NotificationObj) then
  1709. else
  1710. Str = self
  1711. end
  1712. Str = ((Str == nil) and "No text given") or tostring(Str)
  1713. Text.Text, NotificationObj.Text = Str, Str
  1714. Notification.Size = UDim2.new(0, 44 + Text.TextBounds.X, 0, 32)
  1715. return Str, Text
  1716. end
  1717. local function Pause(self, Set, NoForce)
  1718. if rawequal(self, NotificationObj) then
  1719. else
  1720. Set, NoForce = self, Set
  1721. end
  1722. local IsPaused = NotificationObj.Paused
  1723. if Set == nil then
  1724. Set = not IsPaused
  1725. else
  1726. Set = Set or false
  1727. end
  1728. if Set or (IsPaused == Set) then
  1729. else
  1730. NotificationObj.Expires = math.max(NotificationObj.Expires, os_clock() + math.clamp(NotificationObj.Duration / 2.5, 1, 3))
  1731. end
  1732. NotificationObj.Paused = Set
  1733. if NoForce then
  1734. else
  1735. NotificationObj.Forced = Set
  1736. end
  1737. return Set
  1738. end
  1739. NotificationObj.SetPaused = Pause
  1740. function NotificationObj.AddTime(self, Extension)
  1741. if rawequal(self, NotificationObj) then
  1742. else
  1743. Extension = self
  1744. end
  1745. NotificationObj.Expires += Extension
  1746. end
  1747. function NotificationObj.Hide(self, SetPause)
  1748. if Notification and NotificationObj.Active then
  1749. if rawequal(self, NotificationObj) then
  1750. else
  1751. SetPause = self
  1752. end
  1753. if SetPause then
  1754. Pause(true)
  1755. end
  1756. Notification.Visible = false
  1757. end
  1758. end
  1759. function NotificationObj.Show(self, SetPause)
  1760. if Notification and NotificationObj.Active then
  1761. if rawequal(self, NotificationObj) then
  1762. else
  1763. SetPause = self
  1764. end
  1765. if SetPause then
  1766. Pause(false)
  1767. end
  1768. Notification.Visible = true
  1769. end
  1770. end
  1771. function NotificationObj.SetVisible(self, Visible, SetPause)
  1772. if Notification and NotificationObj.Active then
  1773. if rawequal(self, NotificationObj) then
  1774. else
  1775. Visible, SetPause = self, Visible
  1776. end
  1777. if Visible == nil then
  1778. Notification.Visible = not Notification.Visible
  1779. else
  1780. Notification.Visible = (Visible and true) or false
  1781. end
  1782. if SetPause then
  1783. Pause(Notification.Visible)
  1784. end
  1785. end
  1786. end
  1787. Notification.MouseEnter:Connect(function()
  1788. if NotificationObj.Forced then
  1789. return
  1790. end
  1791. Pause(true, true)
  1792. end)
  1793. Notification.MouseLeave:Connect(function()
  1794. if NotificationObj.Forced then
  1795. return
  1796. end
  1797. Pause(false, true)
  1798. end)
  1799. local function Destroy()
  1800. if Notification then
  1801. Notification:Destroy()
  1802. end
  1803. NotificationObj.Active = false
  1804. NotificationObj.Object = nil
  1805. end
  1806. NotificationObj.Destroy = Destroy
  1807. Close.Activated:Connect(Destroy)
  1808. Notifications[1 + #Notifications] = NotificationObj
  1809. return NotificationObj, Notification, Text
  1810. end
  1811. end
  1812. end
  1813. function library:CreateWindow(options, ...)
  1814. options = (options and type(options) == "string" and resolvevararg("Window", options, ...)) or options
  1815. local homepage = nil
  1816. local windowoptions = options
  1817. local windowName = options.Name or "Unnamed Window"
  1818. options.Name = windowName
  1819. if windowName and #windowName > 0 and library.WorkspaceName == "Elite Lib" then
  1820. library.WorkspaceName = convertfilename(windowName, "Elite Lib")
  1821. end
  1822. local EliteLibrary = Instance_new("ScreenGui")
  1823. library.MainScreenGui, MainScreenGui = EliteLibrary, EliteLibrary
  1824. local main = Instance_new("Frame")
  1825. local mainBorder = Instance_new("Frame")
  1826. local tabSlider = Instance_new("Frame")
  1827. local innerMain = Instance_new("Frame")
  1828. local innerMainBorder = Instance_new("Frame")
  1829. local innerBackdrop = Instance_new("ImageLabel")
  1830. local innerMainHolder = Instance_new("Frame")
  1831. local tabsHolder = Instance_new("ImageLabel")
  1832. local tabHolderList = Instance_new("UIListLayout")
  1833. local tabHolderPadding = Instance_new("UIPadding")
  1834. local headline = Instance_new("TextLabel")
  1835. local splitter = Instance_new("TextLabel")
  1836. local submenuOpen = nil
  1837. library.globals["__Window" .. options.Name] = {
  1838. submenuOpen = submenuOpen
  1839. }
  1840. EliteLibrary.Name = " "
  1841. EliteLibrary.Parent = library.gui_parent
  1842. EliteLibrary.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  1843. EliteLibrary.DisplayOrder = 10
  1844. EliteLibrary.ResetOnSpawn = false
  1845. main.Name = "main"
  1846. main.Parent = EliteLibrary
  1847. main.AnchorPoint = Vector2.new(0.5, 0.5)
  1848. main.BackgroundColor3 = library.colors.background
  1849. colored[1 + #colored] = {main, "BackgroundColor3", "background"}
  1850. main.BorderColor3 = library.colors.outerBorder
  1851. colored[1 + #colored] = {main, "BorderColor3", "outerBorder"}
  1852. main.Position = UDim2.fromScale(0.5, 0.5)
  1853.  
  1854.  
  1855.  
  1856. main.Size = UDim2.fromOffset(500, 545)
  1857.  
  1858. makeDraggable(main, main)
  1859. mainBorder.Name = "mainBorder"
  1860. mainBorder.Parent = main
  1861. mainBorder.AnchorPoint = Vector2.new(0.5, 0.5)
  1862. mainBorder.BackgroundColor3 = library.colors.background
  1863. colored[1 + #colored] = {mainBorder, "BackgroundColor3", "background"}
  1864. mainBorder.BorderColor3 = library.colors.innerBorder
  1865. colored[1 + #colored] = {mainBorder, "BorderColor3", "innerBorder"}
  1866. mainBorder.BorderMode = Enum.BorderMode.Inset
  1867. mainBorder.Position = UDim2.fromScale(0.5, 0.5)
  1868. mainBorder.Size = UDim2.fromScale(1, 1)
  1869. innerMain.Name = "innerMain"
  1870. innerMain.Parent = main
  1871. innerMain.AnchorPoint = Vector2.new(0.5, 0.5)
  1872. innerMain.BackgroundColor3 = library.colors.background
  1873. colored[1 + #colored] = {innerMain, "BackgroundColor3", "background"}
  1874. innerMain.BorderColor3 = library.colors.outerBorder
  1875. colored[1 + #colored] = {innerMain, "BorderColor3", "outerBorder"}
  1876. innerMain.Position = UDim2.fromScale(0.5, 0.5)
  1877. innerMain.Size = UDim2.new(1, -14, 1, -14)
  1878. innerMainBorder.Name = "innerMainBorder"
  1879. innerMainBorder.Parent = innerMain
  1880. innerMainBorder.AnchorPoint = Vector2.new(0.5, 0.5)
  1881. innerMainBorder.BackgroundColor3 = library.colors.background
  1882. colored[1 + #colored] = {innerMainBorder, "BackgroundColor3", "background"}
  1883. innerMainBorder.BorderColor3 = library.colors.innerBorder
  1884. colored[1 + #colored] = {innerMainBorder, "BorderColor3", "innerBorder"}
  1885. innerMainBorder.BorderMode = Enum.BorderMode.Inset
  1886. innerMainBorder.Position = UDim2.fromScale(0.5, 0.5)
  1887. innerMainBorder.Size = UDim2.fromScale(1, 1)
  1888. innerMainHolder.Name = "innerMainHolder"
  1889. innerMainHolder.Parent = innerMain
  1890. innerMainHolder.BackgroundColor3 = Color3.new(1, 1, 1)
  1891. innerMainHolder.BackgroundTransparency = 1
  1892. innerMainHolder.Position = UDim2:fromOffset(25)
  1893. innerMainHolder.Size = UDim2.new(1, 0, 1, -25)
  1894. innerBackdrop.Name = "innerBackdrop"
  1895. innerBackdrop.Parent = innerMainHolder
  1896. innerBackdrop.BackgroundColor3 = Color3.new(0.243137, 0.243137, 0.243137)
  1897. innerBackdrop.BackgroundTransparency = 1
  1898. innerBackdrop.Size = UDim2.fromScale(0.8, 0.8)
  1899. innerBackdrop.Position = UDim2.new(0.1,0,0.1,0)
  1900. innerBackdrop.ZIndex = -1
  1901. innerBackdrop.Visible = library_flags["__Designer.Background.UseBackgroundImage"] and true
  1902. innerBackdrop.ImageColor3 = library_flags["__Designer.Background.ImageColor"] or Color3.new(1, 1, 1)
  1903. innerBackdrop.ImageTransparency = (library_flags["__Designer.Background.ImageTransparency"] or 95) / 100
  1904. innerBackdrop.Image = resolveid(library_flags["__Designer.Background.ImageAssetID"], "__Designer.Background.ImageAssetID") or ""
  1905. library.Backdrop = innerBackdrop
  1906. tabsHolder.Name = "tabsHolder"
  1907. tabsHolder.Parent = innerMain
  1908. tabsHolder.BackgroundColor3 = library.colors.topGradient
  1909. colored[1 + #colored] = {tabsHolder, "BackgroundColor3", "topGradient"}
  1910. tabsHolder.BorderSizePixel = 0
  1911. tabsHolder.Position = UDim2.fromOffset(1, 1)
  1912. tabsHolder.Size = UDim2.new(1, -2, 0, 23)
  1913. tabsHolder.Image = "rbxassetid://2454009026"
  1914. tabsHolder.ImageColor3 = library.colors.bottomGradient
  1915. colored[1 + #colored] = {tabsHolder, "ImageColor3", "bottomGradient"}
  1916. tabHolderList.Name = "tabHolderList"
  1917. tabHolderList.Parent = tabsHolder
  1918. tabHolderList.FillDirection = Enum.FillDirection.Horizontal
  1919. tabHolderList.SortOrder = Enum.SortOrder.LayoutOrder
  1920. tabHolderList.VerticalAlignment = Enum.VerticalAlignment.Center
  1921. tabHolderList.Padding = UDim:new(3)
  1922. tabHolderPadding.Name = "tabHolderPadding"
  1923. tabHolderPadding.Parent = tabsHolder
  1924. tabHolderPadding.PaddingLeft = UDim:new(7)
  1925. headline.Name = "headline"
  1926. headline.Parent = tabsHolder
  1927. headline.BackgroundColor3 = Color3.new(0.243137, 0.243137, 0.243137)
  1928. headline.BackgroundTransparency = 1
  1929. headline.LayoutOrder = 1
  1930. headline.Font = Enum.Font.Code
  1931. headline.Text = "Elite Hub Kaitun..."
  1932. headline.TextColor3 = library.colors.main
  1933. headline.MouseEnter:Connect(function ()
  1934. headline.BackgroundTransparency = 0
  1935. headline.Text ="Elite Hub Kaitun V1"
  1936. end)
  1937. headline.MouseLeave:Connect(function ()
  1938. headline.BackgroundTransparency = 1
  1939. headline.Text = "Elite Hub Kaitun..."
  1940. end)
  1941.  
  1942.  
  1943. colored[1 + #colored] = {headline, "TextColor3", "main"}
  1944. headline.TextSize = 14
  1945. headline.TextStrokeColor3 = library.colors.outerBorder
  1946. colored[1 + #colored] = {headline, "TextStrokeColor3", "outerBorder"}
  1947. headline.TextStrokeTransparency = 0.75
  1948. headline.Size = UDim2:new(textToSize(headline).X + 4, 1)
  1949. splitter.Name = "splitter"
  1950. splitter.Parent = tabsHolder
  1951. splitter.BackgroundColor3 = Color3.new(1, 1, 1)
  1952. splitter.BackgroundTransparency = 1
  1953. splitter.LayoutOrder = 2
  1954. splitter.Size = UDim2:new(6, 1)
  1955. splitter.Font = Enum.Font.Code
  1956. splitter.Text = "|"
  1957. splitter.TextColor3 = library.colors.tabText
  1958. colored[1 + #colored] = {splitter, "TextColor3", "tabText"}
  1959. splitter.TextSize = 14
  1960. splitter.TextStrokeColor3 = library.colors.tabText
  1961. colored[1 + #colored] = {splitter, "TextStrokeColor3", "tabText"}
  1962. splitter.TextStrokeTransparency = 0.75
  1963. tabSlider.Name = "tabSlider"
  1964. tabSlider.Parent = main
  1965. tabSlider.BackgroundColor3 = library.colors.main
  1966. colored[1 + #colored] = {tabSlider, "BackgroundColor3", "main"}
  1967. tabSlider.BorderSizePixel = 0
  1968. tabSlider.Position = UDim2.fromOffset(100, 30)
  1969. tabSlider.Size = UDim2:fromOffset(1)
  1970. tabSlider.Visible = false
  1971. local IgnoreCoreInputs = nil
  1972. do
  1973. local os_clock = os.clock
  1974. library.signals[1 + #library.signals] = userInputService.InputBegan:Connect(function(keyCode)
  1975. if IgnoreCoreInputs or userInputService:GetFocusedTextBox() then
  1976. return
  1977. elseif keyCode.KeyCode == library.configuration.hideKeybind then
  1978. if not lasthidebing or ((os_clock() - lasthidebing) > 12) then
  1979. main.Visible = not main.Visible
  1980. end
  1981. lasthidebing = nil
  1982. end
  1983. end)
  1984. end
  1985. local windowFunctions = {
  1986. tabCount = 0,
  1987. selected = {},
  1988. Flags = elements
  1989. }
  1990. library.globals["__Window" .. windowName].windowFunctions = windowFunctions
  1991. function windowFunctions:Show(x)
  1992. main.Visible = (x == nil) or (x == true) or (x == 1)
  1993. return main.Visible
  1994. end
  1995. function windowFunctions:Hide(x)
  1996. main.Visible = (x == false) or (x == 0)
  1997. return main.Visible
  1998. end
  1999. function windowFunctions:Visibility(x)
  2000. if x == nil then
  2001. main.Visible = not main.Visible
  2002. else
  2003. main.Visible = x and true
  2004. end
  2005. return main.Visible
  2006. end
  2007. function windowFunctions:MoveTabSlider(tabObject)
  2008. spawn(function()
  2009. tabSlider.Visible = true
  2010. tweenService:Create(tabSlider, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2011. Size = UDim2.fromOffset(tabObject.AbsoluteSize.X, 1),
  2012. Position = UDim2.fromOffset(tabObject.AbsolutePosition.X, tabObject.AbsolutePosition.Y + tabObject.AbsoluteSize.Y) - UDim2.fromOffset(main.AbsolutePosition.X, main.AbsolutePosition.Y)
  2013. }):Play()
  2014. end)
  2015. end
  2016. windowFunctions.LastTab = nil
  2017. function windowFunctions:CreateTab(options, ...)
  2018. options = (options and (type(options) == "string") and resolvevararg("Tab", options, ...)) or options or {
  2019. Name = "Elite Style: Elite Lego Hax"
  2020. }
  2021. local image = options.Image
  2022. if image then
  2023. image = resolveid(image)
  2024. end
  2025. local tabName = options.Name or "Unnamed Tab"
  2026. options.Name = tabName
  2027. windowFunctions.tabCount = windowFunctions.tabCount + 1
  2028. local newTab = Instance_new((image and "ImageButton") or "TextButton")
  2029. local newTabHolder = Instance_new("Frame")
  2030. library.globals["__Window" .. windowName].newTabHolder = newTabHolder
  2031. local left = Instance_new("ScrollingFrame")
  2032. local leftList = Instance_new("UIListLayout")
  2033. local leftPadding = Instance_new("UIPadding")
  2034. local right = Instance_new("ScrollingFrame")
  2035. local rightList = Instance_new("UIListLayout")
  2036. local rightPadding = Instance_new("UIPadding")
  2037. newTab.Name = removeSpaces((tabName and tostring(tabName):lower() or "???") .. "Tab")
  2038. newTab.Parent = tabsHolder
  2039. newTab.BackgroundTransparency = 1
  2040. newTab.LayoutOrder = (options.LastTab and 99999) or tonumber(options.TabOrder or options.LayoutOrder) or (2 + windowFunctions.tabCount)
  2041. local colored_newTab_TextColor3 = nil
  2042. if image then
  2043. newTab.Image = image
  2044. newTab.ImageColor3 = options.ImageColor or options.Color or Color3.new(1, 1, 1)
  2045. newTab.Size = UDim2:new(tabsHolder.AbsoluteSize.Y, 1)
  2046. else
  2047. colored_newTab_TextColor3 = {newTab, "TextColor3", "tabText"}
  2048. colored[1 + #colored] = colored_newTab_TextColor3
  2049. newTab.Font = Enum.Font.Code
  2050. newTab.Text = (tabName and tostring(tabName)) or "???"
  2051. if windowFunctions.tabCount ~= 1 then
  2052. colored_newTab_TextColor3[4] = 1.35
  2053. newTab.TextColor3 = darkenColor(library.colors.tabText, 1.35)
  2054. else
  2055. newTab.TextColor3 = library.colors.tabText
  2056. end
  2057. newTab.TextSize = 14
  2058. newTab.TextStrokeColor3 = Color3.fromRGB(42, 42, 42)
  2059. newTab.TextStrokeTransparency = 0.75
  2060. newTab.Size = UDim2:new(textToSize(newTab).X + 4, 1)
  2061. end
  2062. local function goto()
  2063. if not library.colorpicker and not submenuOpen and (windowFunctions.selected.button ~= newTab) and newTab.Parent and newTabHolder.Parent then
  2064. pcall(function()
  2065. for _, e in next, library.elements do
  2066. if e and (type(e) == "table") then
  2067. if e.Update then
  2068. pcall(e.Update)
  2069. end
  2070. if e.UpdateAll then
  2071. pcall(e.UpdateAll)
  2072. end
  2073. end
  2074. end
  2075. end)
  2076. if windowFunctions.LastTab then
  2077. windowFunctions.LastTab[4] = 1.35
  2078. end
  2079. windowFunctions:MoveTabSlider(newTab)
  2080. if windowFunctions.selected.button.ClassName == "TextButton" then
  2081. tweenService:Create(windowFunctions.selected.button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2082. TextColor3 = darkenColor(library.colors.tabText, 1.35)
  2083. }):Play()
  2084. end
  2085. if colored_newTab_TextColor3 then
  2086. colored_newTab_TextColor3[4] = nil
  2087. end
  2088. windowFunctions.selected.holder.Visible = false
  2089. windowFunctions.selected.button = newTab
  2090. windowFunctions.selected.holder = newTabHolder
  2091. if windowFunctions.selected.button.ClassName == "TextButton" then
  2092. tweenService:Create(windowFunctions.selected.button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2093. TextColor3 = library.colors.tabText
  2094. }):Play()
  2095. end
  2096. windowFunctions.selected.holder.Visible = true
  2097. windowFunctions.LastTab = colored_newTab_TextColor3
  2098. end
  2099. end
  2100. if not homepage and newTab.LayoutOrder <= 4 then
  2101. homepage = goto
  2102. end
  2103. library.signals[1 + #library.signals] = newTab.MouseButton1Click:Connect(goto)
  2104. if windowFunctions.tabCount == 1 then
  2105. tabSlider.Size = UDim2.fromOffset(newTab.AbsoluteSize.X, 1)
  2106. tabSlider.Position = UDim2.fromOffset(newTab.AbsolutePosition.X, newTab.AbsolutePosition.Y + newTab.AbsoluteSize.Y) - UDim2.fromOffset(main.AbsolutePosition.X, main.AbsolutePosition.Y)
  2107. tabSlider.Visible = true
  2108. windowFunctions.selected.holder = newTabHolder
  2109. windowFunctions.selected.button = newTab
  2110. end
  2111. newTabHolder.Name = removeSpaces((tabName and tabName:lower()) or "???") .. "TabHolder"
  2112. newTabHolder.Parent = innerMainHolder
  2113. newTabHolder.BackgroundColor3 = Color3.new(1, 1, 1)
  2114. newTabHolder.BackgroundTransparency = 1
  2115. newTabHolder.Size = UDim2.fromScale(1, 1)
  2116. newTabHolder.Visible = windowFunctions.tabCount == 1
  2117. left.Name = "left"
  2118. left.Parent = newTabHolder
  2119. left.BackgroundColor3 = Color3.new(1, 1, 1)
  2120. left.BackgroundTransparency = 1
  2121. left.Size = UDim2.fromScale(0.5, 1)
  2122. left.CanvasSize = UDim2.new()
  2123. left.ScrollBarThickness = 0
  2124. leftList.Name = "leftList"
  2125. leftList.Parent = left
  2126. leftList.HorizontalAlignment = Enum.HorizontalAlignment.Center
  2127. leftList.SortOrder = Enum.SortOrder.LayoutOrder
  2128. leftList.Padding = UDim:new(14)
  2129. leftPadding.Name = "leftPadding"
  2130. leftPadding.Parent = left
  2131. leftPadding.PaddingTop = UDim:new(12)
  2132. right.Name = "right"
  2133. right.Parent = newTabHolder
  2134. right.BackgroundColor3 = Color3.new(1, 1, 1)
  2135. right.BackgroundTransparency = 1
  2136. right.Size = UDim2.fromScale(0.5, 1)
  2137. right.CanvasSize = UDim2.new()
  2138. right.ScrollBarThickness = 0
  2139. right.Position = UDim2.new(0.5)
  2140. rightList.Name = "rightList"
  2141. rightList.Parent = right
  2142. rightList.HorizontalAlignment = Enum.HorizontalAlignment.Center
  2143. rightList.SortOrder = Enum.SortOrder.LayoutOrder
  2144. rightList.Padding = UDim:new(14)
  2145. rightPadding.Name = "rightPadding"
  2146. rightPadding.Parent = right
  2147. rightPadding.PaddingTop = UDim:new(12)
  2148. local tabFunctions = {
  2149. Flags = {},
  2150. Remove = function()
  2151. local relod = nil
  2152. if newTab then
  2153. newTab.Parent = nil
  2154. relod = true
  2155. end
  2156. if newTabHolder then
  2157. newTabHolder.Parent = nil
  2158. relod = true
  2159. end
  2160. if relod then
  2161. windowFunctions:UpdateAll()
  2162. end
  2163. end,
  2164. Select = goto
  2165. }
  2166. function tabFunctions:CreateSection(options, ...)
  2167. options = (options and type(options) == "string" and resolvevararg("Tab", options, ...)) or options
  2168. local sectionName, holderSide = options.Name or "Unnamed Section", options.Side
  2169. options.Name = sectionName
  2170. local newSection = Instance_new("Frame")
  2171. local newSectionBorder = Instance_new("Frame")
  2172. local insideBorderHider = Instance_new("Frame")
  2173. local outsideBorderHider = Instance_new("Frame")
  2174. local sectionHolder = Instance_new("Frame")
  2175. local sectionList = Instance_new("UIListLayout")
  2176. local sectionPadding = Instance_new("UIPadding")
  2177. local sectionHeadline = Instance_new("TextLabel")
  2178. colorpickerconflicts[1 + #colorpickerconflicts] = insideBorderHider
  2179. colorpickerconflicts[1 + #colorpickerconflicts] = outsideBorderHider
  2180. colorpickerconflicts[1 + #colorpickerconflicts] = sectionHeadline
  2181. newSection.Name = removeSpaces((sectionName and sectionName:lower() or "???") .. "Section")
  2182. newSection.Parent = (holderSide and (((holderSide:lower() == "left") and left) or right)) or left
  2183. newSection.BackgroundColor3 = library.colors.sectionBackground
  2184. colored[1 + #colored] = {newSection, "BackgroundColor3", "sectionBackground"}
  2185. newSection.BorderColor3 = library.colors.outerBorder
  2186. colored[1 + #colored] = {newSection, "BorderColor3", "outerBorder"}
  2187. newSection.Size = UDim2.new(1, -20)
  2188. newSection.Visible = false
  2189. newSectionBorder.Name = "newSectionBorder"
  2190. newSectionBorder.Parent = newSection
  2191. newSectionBorder.BackgroundColor3 = library.colors.sectionBackground
  2192. colored[1 + #colored] = {newSectionBorder, "BackgroundColor3", "sectionBackground"}
  2193. newSectionBorder.BorderColor3 = library.colors.innerBorder
  2194. colored[1 + #colored] = {newSectionBorder, "BorderColor3", "innerBorder"}
  2195. newSectionBorder.BorderMode = Enum.BorderMode.Inset
  2196. newSectionBorder.Size = UDim2.fromScale(1, 1)
  2197. sectionHolder.Name = "sectionHolder"
  2198. sectionHolder.Parent = newSection
  2199. sectionHolder.BackgroundColor3 = Color3.new(1, 1, 1)
  2200. sectionHolder.BackgroundTransparency = 1
  2201. sectionHolder.Size = UDim2.fromScale(1, 1)
  2202. sectionList.Name = "sectionList"
  2203. sectionList.Parent = sectionHolder
  2204. sectionList.HorizontalAlignment = Enum.HorizontalAlignment.Center
  2205. sectionList.SortOrder = Enum.SortOrder.LayoutOrder
  2206. sectionList.Padding = UDim:new(1)
  2207. sectionPadding.Name = "sectionPadding"
  2208. sectionPadding.Parent = sectionHolder
  2209. sectionPadding.PaddingTop = UDim:new(9)
  2210. sectionHeadline.Name = "sectionHeadline"
  2211. sectionHeadline.Parent = newSection
  2212. sectionHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
  2213. sectionHeadline.BackgroundTransparency = 1
  2214. sectionHeadline.Position = UDim2.fromOffset(18, -8)
  2215. sectionHeadline.ZIndex = 2
  2216. sectionHeadline.Font = Enum.Font.Code
  2217. sectionHeadline.LineHeight = 1.15
  2218. sectionHeadline.Text = (sectionName and sectionName or "???")
  2219. sectionHeadline.TextColor3 = library.colors.section
  2220. colored[1 + #colored] = {sectionHeadline, "TextColor3", "section"}
  2221. sectionHeadline.TextSize = 14
  2222. sectionHeadline.Size = UDim2.fromOffset(textToSize(sectionHeadline).X + 4, 12)
  2223. insideBorderHider.Name = "insideBorderHider"
  2224. insideBorderHider.Parent = newSection
  2225. insideBorderHider.BackgroundColor3 = library.colors.sectionBackground
  2226. colored[1 + #colored] = {insideBorderHider, "BackgroundColor3", "sectionBackground"}
  2227. insideBorderHider.BorderSizePixel = 0
  2228. insideBorderHider.Position = UDim2.fromOffset(15)
  2229. insideBorderHider.Size = UDim2.fromOffset(sectionHeadline.AbsoluteSize.X + 3, 1)
  2230. outsideBorderHider.Name = "outsideBorderHider"
  2231. outsideBorderHider.Parent = newSection
  2232. outsideBorderHider.BackgroundColor3 = library.colors.background
  2233. colored[1 + #colored] = {outsideBorderHider, "BackgroundColor3", "background"}
  2234. outsideBorderHider.BorderSizePixel = 0
  2235. outsideBorderHider.Position = UDim2.fromOffset(15, -1)
  2236. outsideBorderHider.Size = UDim2.fromOffset(sectionHeadline.AbsoluteSize.X + 3, 1)
  2237. local sectionFunctions = {
  2238. Flags = {},
  2239. Remove = function()
  2240. if newSection then
  2241. newSection.Parent = nil
  2242. windowFunctions:UpdateAll()
  2243. end
  2244. end
  2245. }
  2246. function sectionFunctions:Update(extra)
  2247. local currentHolder = newSection.Parent
  2248. if not newSection.Visible then
  2249. newSection.Visible = true
  2250. end
  2251. newSection.Size = UDim2.new(1, -20, 0, (15 + sectionList.AbsoluteContentSize.Y))
  2252. if currentHolder then
  2253. currentHolder.CanvasSize = UDim2:fromOffset(currentHolder:FindFirstChildOfClass("UIListLayout").AbsoluteContentSize.Y + 22 + (tonumber(extra) or 0))
  2254. end
  2255. end
  2256. function sectionFunctions:UpdateAll(...)
  2257. for _, obj in next, sectionFunctions.Flags do
  2258. if obj then
  2259. if obj.Update then
  2260. pcall(obj.Update)
  2261. end
  2262. if obj.UpdateAll then
  2263. pcall(obj.UpdateAll)
  2264. end
  2265. end
  2266. end
  2267. sectionFunctions:Update(...)
  2268. end
  2269. function sectionFunctions:AddToggle(options, ...)
  2270. options = (options and type(options) == "string" and resolvevararg("Tab", options, ...)) or options
  2271. local toggleName, alreadyEnabled, callback, flagName = assert(options.Name, "Missing Name for new toggle."), options.Value or options.Enabled, options.Callback, options.Flag or (function()
  2272. library.unnamedtoggles = 1 + (library.unnamedtoggles or 0)
  2273. return "Toggle" .. tostring(library.unnamedtoggles)
  2274. end)()
  2275. if elements[flagName] ~= nil then
  2276. warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
  2277. end
  2278. local newToggle = Instance_new("Frame")
  2279. local toggle = Instance_new("ImageLabel")
  2280. local toggleInner = Instance_new("ImageLabel")
  2281. local toggleButton = Instance_new("TextButton")
  2282. local toggleHeadline = Instance_new("TextLabel")
  2283. local keybindPositioner = Instance_new("Frame")
  2284. local keybindList = Instance_new("UIListLayout")
  2285. local keybindButton = Instance_new("TextButton")
  2286. local lockedup = options.Locked
  2287. newToggle.Name = removeSpaces((toggleName and toggleName:lower() or "???") .. "Toggle")
  2288. newToggle.Parent = sectionHolder
  2289. newToggle.BackgroundColor3 = Color3.new(1, 1, 1)
  2290. newToggle.BackgroundTransparency = 1
  2291. newToggle.Size = UDim2.new(1, 0, 0, 19)
  2292. toggle.Name = "toggle"
  2293. toggle.Parent = newToggle
  2294. toggle.Active = true
  2295. toggle.BackgroundColor3 = library.colors.topGradient
  2296. local colored_toggle_BackgroundColor3 = {toggle, "BackgroundColor3", "topGradient"}
  2297. colored[1 + #colored] = colored_toggle_BackgroundColor3
  2298. toggle.BorderColor3 = library.colors.elementBorder
  2299. colored[1 + #colored] = {toggle, "BorderColor3", "elementBorder"}
  2300. toggle.Position = UDim2.fromScale(0.0308237672, 0.165842205)
  2301. toggle.Selectable = true
  2302. toggle.Size = UDim2.fromOffset(12, 12)
  2303. toggle.Image = "rbxassetid://2454009026"
  2304. toggle.ImageColor3 = library.colors.bottomGradient
  2305. local colored_toggle_ImageColor3 = {toggle, "ImageColor3", "bottomGradient"}
  2306. colored[1 + #colored] = colored_toggle_ImageColor3
  2307. toggleInner.Name = "toggleInner"
  2308. toggleInner.Parent = toggle
  2309. toggleInner.Active = true
  2310. toggleInner.AnchorPoint = Vector2.new(0.5, 0.5)
  2311. toggleInner.BackgroundColor3 = library.colors.topGradient
  2312. local colored_toggleInner_BackgroundColor3 = {toggleInner, "BackgroundColor3", "topGradient"}
  2313. colored[1 + #colored] = colored_toggleInner_BackgroundColor3
  2314. toggleInner.BorderColor3 = library.colors.elementBorder
  2315. colored[1 + #colored] = {toggleInner, "BorderColor3", "elementBorder"}
  2316. toggleInner.Position = UDim2.fromScale(0.5, 0.5)
  2317. toggleInner.Selectable = true
  2318. toggleInner.Size = UDim2.new(1, -4, 1, -4)
  2319. toggleInner.Image = "rbxassetid://2454009026"
  2320. toggleInner.ImageColor3 = library.colors.bottomGradient
  2321. local colored_toggleInner_ImageColor3 = {toggleInner, "ImageColor3", "bottomGradient"}
  2322. colored[1 + #colored] = colored_toggleInner_ImageColor3
  2323. toggleButton.Name = "toggleButton"
  2324. toggleButton.Parent = newToggle
  2325. toggleButton.BackgroundColor3 = Color3.new(1, 1, 1)
  2326. toggleButton.BackgroundTransparency = 1
  2327. toggleButton.Size = UDim2.fromScale(1, 1)
  2328. toggleButton.ZIndex = 5
  2329. toggleButton.Font = Enum.Font.SourceSans
  2330. toggleButton.Text = ""
  2331. toggleButton.TextColor3 = Color3.new()
  2332. toggleButton.TextSize = 14
  2333. toggleButton.TextTransparency = 1
  2334. toggleHeadline.Name = "toggleHeadline"
  2335. toggleHeadline.Parent = newToggle
  2336. toggleHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
  2337. toggleHeadline.BackgroundTransparency = 1
  2338. toggleHeadline.Position = UDim2.fromScale(0.123, 0.165842161)
  2339. toggleHeadline.Size = UDim2.fromOffset(170, 11)
  2340. toggleHeadline.Font = Enum.Font.Code
  2341. toggleHeadline.Text = toggleName or "???"
  2342. toggleHeadline.TextColor3 = library.colors.elementText
  2343. local colored_toggleHeadline_TextColor3 = {toggleHeadline, "TextColor3", "elementText", (lockedup and 0.5) or nil}
  2344. colored[1 + #colored] = colored_toggleHeadline_TextColor3
  2345. toggleHeadline.TextSize = 14
  2346. toggleHeadline.TextXAlignment = Enum.TextXAlignment.Left
  2347. local last_v = nil
  2348. local function Set(t, newStatus)
  2349. if nil == newStatus and t ~= nil then
  2350. newStatus = t
  2351. end
  2352. last_v = library_flags[flagName]
  2353. if options.Condition ~= nil then
  2354. if type(options.Condition) == "function" then
  2355. local v, e = pcall(options.Condition, newStatus, last_v)
  2356. if e then
  2357. if not v then
  2358. warn(debug.traceback(string.format("Error in toggle %s's Condition function: %s", flagName, e), 2))
  2359. end
  2360. else
  2361. return last_v
  2362. end
  2363. end
  2364. end
  2365. if newStatus ~= nil and type(newStatus) == "boolean" then
  2366. library_flags[flagName] = newStatus
  2367. if options.Location then
  2368. options.Location[options.LocationFlag or flagName] = newStatus
  2369. end
  2370. if callback and (last_v ~= newStatus or options.AllowDuplicateCalls) then
  2371. colored_toggleInner_BackgroundColor3[3] = (newStatus and "main") or "topGradient"
  2372. colored_toggleInner_BackgroundColor3[4] = (newStatus and 1.5) or nil
  2373. colored_toggleInner_ImageColor3[3] = (newStatus and "main") or "bottomGradient"
  2374. colored_toggleInner_ImageColor3[4] = (newStatus and 2.5) or nil
  2375. tweenService:Create(toggleInner, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2376. BackgroundColor3 = (newStatus and darkenColor(library.colors.main, 1.5)) or library.colors.topGradient,
  2377. ImageColor3 = (newStatus and darkenColor(library.colors.main, 2.5)) or library.colors.bottomGradient
  2378. }):Play()
  2379. task.spawn(callback, newStatus, last_v)
  2380. end
  2381. end
  2382. return newStatus
  2383. end
  2384. options.Keybind = options.Keybind or options.Key or options.KeyBind
  2385. local haskbflag, kbUpdate, kbData = nil, nil, nil
  2386. if options.Keybind then
  2387. local options = options.Keybind
  2388. local htyp = typeof(options)
  2389. if htyp == "EnumItem" then
  2390. options = {
  2391. Value = options
  2392. }
  2393. elseif htyp ~= "table" then
  2394. options = {}
  2395. end
  2396. local presetKeybind, callback, kbpresscallback, kbflag = options.Value or options.Key, options.Callback, options.Pressed, options.Flag or (function()
  2397. if flagName then
  2398. return flagName .. "_ToggleKeybind"
  2399. end
  2400. library.unnamedkeybinds = 1 + (library.unnamedkeybinds or 0)
  2401. return "Keybind" .. tostring(library.unnamedkeybinds)
  2402. end)()
  2403. if elements[kbflag] ~= nil or kbflag == flagName then
  2404. warn(debug.traceback("Warning! Re-used flag '" .. kbflag .. "'", 3))
  2405. end
  2406. haskbflag = kbflag
  2407. library.keyHandler = keyHandler
  2408. local keyHandler = options.KeyNames or keyHandler
  2409. local bindedKey = presetKeybind
  2410. local justBinded = false
  2411. local keyName = keyHandler.allowedKeys[bindedKey] or (bindedKey and (bindedKey.Name or tostring(bindedKey):gsub("Enum.KeyCode.", ""))) or "NONE"
  2412. local newKeybind = newToggle
  2413. keybindPositioner.Name = "keybindPositioner"
  2414. keybindPositioner.Parent = newKeybind
  2415. keybindPositioner.BackgroundColor3 = Color3.new(1, 1, 1)
  2416. keybindPositioner.BackgroundTransparency = 1
  2417. keybindPositioner.Position = UDim2.new(0.00448430516)
  2418. keybindPositioner.Size = UDim2.fromOffset(214, 19)
  2419. keybindPositioner.ZIndex = 1 + toggleButton.ZIndex
  2420. keybindList.Name = "keybindList"
  2421. keybindList.Parent = keybindPositioner
  2422. keybindList.FillDirection = Enum.FillDirection.Horizontal
  2423. keybindList.HorizontalAlignment = Enum.HorizontalAlignment.Right
  2424. keybindList.SortOrder = Enum.SortOrder.LayoutOrder
  2425. keybindList.VerticalAlignment = Enum.VerticalAlignment.Center
  2426. keybindButton.Name = "keybindButton"
  2427. keybindButton.Parent = keybindPositioner
  2428. keybindButton.Active = false
  2429. keybindButton.BackgroundColor3 = Color3.new(1, 1, 1)
  2430. keybindButton.BackgroundTransparency = 1
  2431. keybindButton.Position = UDim2.fromScale(0.598130822, 0.184210524)
  2432. keybindButton.Selectable = false
  2433. keybindButton.Size = UDim2.fromOffset(46, 12)
  2434. keybindButton.Font = Enum.Font.Code
  2435. keybindButton.Text = keyName or (presetKeybind and tostring(presetKeybind):gsub("Enum.KeyCode.", "")) or "[NONE]"
  2436. keybindButton.TextColor3 = library.colors.otherElementText
  2437. local colored_keybindButton_TextColor3 = {keybindButton, "TextColor3", "otherElementText"}
  2438. colored[1 + #colored] = colored_keybindButton_TextColor3
  2439. keybindButton.TextSize = 14
  2440. keybindButton.TextXAlignment = Enum.TextXAlignment.Right
  2441. keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
  2442. local klast_v = bindedKey or presetKeybind
  2443. local function newkey()
  2444. if lockedup then
  2445. return
  2446. end
  2447. local old_texts = keybindButton.Text
  2448. colored_keybindButton_TextColor3[3] = "main"
  2449. colored_keybindButton_TextColor3[4] = nil
  2450. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2451. TextColor3 = library.colors.main
  2452. }):Play()
  2453. if klast_v then
  2454. keybindButton.Text = "(Was " .. (klast_v and tostring(klast_v):gsub("Enum.KeyCode.", "") or "[NONE]") .. ") [...]"
  2455. else
  2456. keybindButton.Text = "[...]"
  2457. end
  2458. local receivingKey = nil
  2459. receivingKey = userInputService.InputBegan:Connect(function(key)
  2460. if lockedup then
  2461. return receivingKey:Disconnect()
  2462. end
  2463. klast_v = library_flags[kbflag]
  2464. if not keyHandler.notAllowedKeys[key.KeyCode] then
  2465. if key.KeyCode ~= Enum.KeyCode.Unknown then
  2466. bindedKey = (key.KeyCode ~= Enum.KeyCode.Escape and key.KeyCode) or library_flags[kbflag]
  2467. library_flags[kbflag] = bindedKey
  2468. if options.Location then
  2469. options.Location[options.LocationFlag or kbflag] = bindedKey
  2470. end
  2471. if bindedKey then
  2472. keyName = keyHandler.allowedKeys[bindedKey] or (bindedKey and (bindedKey.Name or tostring(bindedKey):gsub("Enum.KeyCode.", ""))) or "NONE"
  2473. keybindButton.Text = "[" .. (keyName or (bindedKey and bindedKey.Name) or "NONE") .. "]"
  2474. keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
  2475. justBinded = true
  2476. colored_keybindButton_TextColor3[3] = "otherElementText"
  2477. colored_keybindButton_TextColor3[4] = nil
  2478. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2479. TextColor3 = library.colors.otherElementText
  2480. }):Play()
  2481. receivingKey:Disconnect()
  2482. end
  2483. if callback and klast_v ~= bindedKey then
  2484. task.spawn(callback, bindedKey, klast_v)
  2485. end
  2486. return
  2487. elseif key.KeyCode == Enum.KeyCode.Unknown and not keyHandler.notAllowedMouseInputs[key.UserInputType] then
  2488. bindedKey = key.UserInputType
  2489. library_flags[kbflag] = bindedKey
  2490. if options.Location then
  2491. options.Location[options.LocationFlag or kbflag] = bindedKey
  2492. end
  2493. keyName = keyHandler.allowedKeys[bindedKey]
  2494. keybindButton.Text = "[" .. (keyName or (bindedKey and bindedKey.Name) or tostring(bindedKey.KeyCode):gsub("Enum.KeyCode.", "")) .. "]"
  2495. keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
  2496. justBinded = true
  2497. colored_keybindButton_TextColor3[3] = "otherElementText"
  2498. colored_keybindButton_TextColor3[4] = nil
  2499. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2500. TextColor3 = library.colors.otherElementText
  2501. }):Play()
  2502. receivingKey:Disconnect()
  2503. if callback and klast_v ~= bindedKey then
  2504. task.spawn(callback, bindedKey, klast_v)
  2505. end
  2506. return
  2507. end
  2508. end
  2509. if key.KeyCode == Enum.KeyCode.Backspace or Enum.KeyCode.Escape == key.KeyCode then
  2510. old_texts, bindedKey = "[NONE]", nil
  2511. end
  2512. keybindButton.Text = old_texts
  2513. colored_keybindButton_TextColor3[3] = "otherElementText"
  2514. colored_keybindButton_TextColor3[4] = nil
  2515. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2516. TextColor3 = library.colors.otherElementText
  2517. }):Play()
  2518. receivingKey:Disconnect()
  2519. if callback and klast_v ~= bindedKey then
  2520. task.spawn(callback, bindedKey, klast_v)
  2521. end
  2522. end)
  2523. library.signals[1 + #library.signals] = receivingKey
  2524. end
  2525. library.signals[1 + #library.signals] = keybindButton.MouseButton1Click:Connect(newkey)
  2526. if kbpresscallback and not justBinded then
  2527. library.signals[1 + #library.signals] = userInputService.InputBegan:Connect(function(key, chatting)
  2528. chatting = chatting or (userInputService:GetFocusedTextBox() and true)
  2529. if not chatting and not justBinded then
  2530. if not keyHandler.notAllowedKeys[key.KeyCode] and not keyHandler.notAllowedMouseInputs[key.UserInputType] then
  2531. if bindedKey == key.UserInputType or not justBinded and bindedKey == key.KeyCode then
  2532. if kbpresscallback then
  2533. task.spawn(kbpresscallback, key, chatting)
  2534. end
  2535. end
  2536. justBinded = false
  2537. end
  2538. end
  2539. end)
  2540. end
  2541. options.Mode = (options.Mode and string.lower(tostring(options.Mode))) or "dynamic"
  2542. local modes = {
  2543. dynamic = 1,
  2544. hold = 1,
  2545. toggle = 1
  2546. }
  2547. library.signals[1 + #library.signals] = userInputService.InputBegan:Connect(function(input, chatting)
  2548. if justBinded then
  2549. wait(0.1)
  2550. justBinded = false
  2551. return
  2552. elseif lockedup then
  2553. return
  2554. end
  2555. chatting = chatting or userInputService:GetFocusedTextBox()
  2556. if not chatting then
  2557. local key = library_flags[kbflag]
  2558. local mode = options.Mode
  2559. if not modes[mode] then
  2560. mode = "dynamic"
  2561. options.Mode = mode
  2562. end
  2563. if key == input.KeyCode or key == input.UserInputType then
  2564. if mode == "dynamic" or mode == "both" or mode == "hold" then
  2565. if mode == "dynamic" and library_flags[flagName] then
  2566. return Set(false)
  2567. end
  2568. Set(true)
  2569. local now = os.clock()
  2570. local waittil = nil
  2571. if mode == "dynamic" then
  2572. waittil = Instance.new("BindableEvent")
  2573. end
  2574. local xconnection = nil
  2575. xconnection = userInputService.InputEnded:Connect(function(input, chatting)
  2576. chatting = chatting or userInputService:GetFocusedTextBox()
  2577. if not chatting and (key == input.KeyCode or key == input.UserInputType) then
  2578. xconnection = (xconnection and xconnection:Disconnect() and nil) or nil
  2579. if mode == "hold" or os.clock() - now > math.clamp(tonumber(options.DynamicTime) or 0.65, 0.05, 20) then
  2580. Set(false)
  2581. end
  2582. end
  2583. end)
  2584. library.signals[1 + #library.signals] = xconnection
  2585. else
  2586. Set(not library_flags[flagName])
  2587. end
  2588. end
  2589. end
  2590. end)
  2591. local function kbset(t, key)
  2592. if nil == key and t ~= nil then
  2593. key = t
  2594. end
  2595. if key == "nil" or key == "NONE" or key == "none" then
  2596. key = nil
  2597. end
  2598. last_v = library_flags[kbflag]
  2599. bindedKey = key
  2600. library_flags[kbflag] = key
  2601. if options.Location then
  2602. options.Location[options.LocationFlag or kbflag] = key
  2603. end
  2604. keyName = (key == nil and "NONE") or keyHandler.allowedKeys[key]
  2605. keybindButton.Text = "[" .. (keyName or key.Name or tostring(key):gsub("Enum.KeyCode.", "")) .. "]"
  2606. keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
  2607. justBinded = true
  2608. colored_keybindButton_TextColor3[3] = "otherElementText"
  2609. colored_keybindButton_TextColor3[4] = nil
  2610. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2611. TextColor3 = library.colors.otherElementText
  2612. }):Play()
  2613. if callback and (last_v ~= key or options.AllowDuplicateCalls) then
  2614. task.spawn(callback, key, last_v)
  2615. end
  2616. return key
  2617. end
  2618. if presetKeybind ~= nil then
  2619. kbset(presetKeybind)
  2620. else
  2621. library_flags[kbflag] = bindedKey
  2622. if options.Location then
  2623. options.Location[options.LocationFlag or kbflag] = bindedKey
  2624. end
  2625. end
  2626. local default = library_flags[kbflag]
  2627. local function UpdateKb()
  2628. callback, kbpresscallback = options.Callback, options.Pressed
  2629. local key = library_flags[kbflag]
  2630. bindedKey = key
  2631. keyName = keyHandler.allowedKeys[bindedKey] or (bindedKey and (bindedKey.Name or tostring(bindedKey):gsub("Enum.KeyCode.", ""))) or "NONE"
  2632. keybindButton.Text = "[" .. (keyName or (key and key.Name) or tostring(key):gsub("Enum.KeyCode.", "")) .. "]"
  2633. keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
  2634. colored_keybindButton_TextColor3[3] = "otherElementText"
  2635. colored_keybindButton_TextColor3[4] = (lockedup and 2.5) or nil
  2636. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2637. TextColor3 = (lockedup and darkenColor(library.colors.otherElementText, colored_keybindButton_TextColor3[4])) or library.colors.otherElementText
  2638. }):Play()
  2639. return key
  2640. end
  2641. kbUpdate = UpdateKb
  2642. local objectdata = {
  2643. Options = options,
  2644. Name = kbflag,
  2645. Flag = kbflag,
  2646. Type = "Keybind",
  2647. Default = default,
  2648. Parent = sectionFunctions,
  2649. Instance = keybindButton,
  2650. Get = function()
  2651. return library_flags[kbflag]
  2652. end,
  2653. Set = kbset,
  2654. RawSet = function(t, key)
  2655. if t ~= nil and key == nil then
  2656. key = t
  2657. end
  2658. library_flags[kbflag] = key
  2659. UpdateKb()
  2660. return key
  2661. end,
  2662. Update = UpdateKb,
  2663. Reset = function()
  2664. return kbset(nil, default)
  2665. end
  2666. }
  2667. kbData = objectdata
  2668. tabFunctions.Flags[kbflag], sectionFunctions.Flags[kbflag], elements[kbflag] = objectdata, objectdata, objectdata
  2669. end
  2670. sectionFunctions:Update()
  2671. library.signals[1 + #library.signals] = toggleButton.MouseButton1Click:Connect(function()
  2672. if not library.colorpicker and not submenuOpen and not lockedup then
  2673. local newval = not library_flags[flagName]
  2674. if options.Condition ~= nil then
  2675. if type(options.Condition) == "function" then
  2676. local v, e = pcall(options.Condition, newval, not newval)
  2677. if e then
  2678. if not v then
  2679. warn(debug.traceback(string.format("Error in toggle %s's Condition function: %s", flagName, e), 2))
  2680. end
  2681. else
  2682. return last_v
  2683. end
  2684. end
  2685. end
  2686. library_flags[flagName] = newval
  2687. if options.Location then
  2688. options.Location[options.LocationFlag or flagName] = newval
  2689. end
  2690. colored_toggleInner_BackgroundColor3[3] = (newval and "main") or "topGradient"
  2691. colored_toggleInner_BackgroundColor3[4] = (newval and 1.5) or nil
  2692. colored_toggleInner_ImageColor3[3] = (newval and "main") or "bottomGradient"
  2693. colored_toggleInner_ImageColor3[4] = (newval and 2.5) or nil
  2694. tweenService:Create(toggleInner, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2695. BackgroundColor3 = (newval and darkenColor(library.colors.main, 1.5)) or library.colors.topGradient,
  2696. ImageColor3 = (newval and darkenColor(library.colors.main, 2.5)) or library.colors.bottomGradient
  2697. }):Play()
  2698. if callback then
  2699. task.spawn(callback, newval)
  2700. end
  2701. end
  2702. end)
  2703. library.signals[1 + #library.signals] = newToggle.MouseEnter:Connect(function()
  2704. colored_toggle_BackgroundColor3[3] = "main"
  2705. colored_toggle_BackgroundColor3[4] = 1.5
  2706. colored_toggle_ImageColor3[3] = "main"
  2707. colored_toggle_ImageColor3[4] = 2.5
  2708. tweenService:Create(toggle, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2709. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  2710. ImageColor3 = darkenColor(library.colors.main, 2.5)
  2711. }):Play()
  2712. end)
  2713. library.signals[1 + #library.signals] = newToggle.MouseLeave:Connect(function()
  2714. colored_toggle_BackgroundColor3[3] = "topGradient"
  2715. colored_toggle_BackgroundColor3[4] = nil
  2716. colored_toggle_ImageColor3[3] = "bottomGradient"
  2717. colored_toggle_ImageColor3[4] = nil
  2718. tweenService:Create(toggle, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2719. BackgroundColor3 = library.colors.topGradient,
  2720. ImageColor3 = library.colors.bottomGradient
  2721. }):Play()
  2722. end)
  2723. if library_flags[flagName] then
  2724. colored_toggleInner_BackgroundColor3[3] = "main"
  2725. colored_toggleInner_BackgroundColor3[4] = 1.5
  2726. colored_toggleInner_ImageColor3[3] = "main"
  2727. colored_toggleInner_ImageColor3[4] = 2.5
  2728. tweenService:Create(toggleInner, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2729. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  2730. ImageColor3 = darkenColor(library.colors.main, 2.5)
  2731. }):Play()
  2732. end
  2733. local function Update()
  2734. toggleName, callback = options.Name or toggleName, options.Callback
  2735. local boolstatus = library_flags[flagName]
  2736. colored_toggleInner_BackgroundColor3[3] = (boolstatus and "main") or "topGradient"
  2737. colored_toggleInner_BackgroundColor3[4] = (boolstatus and 1.5) or nil
  2738. colored_toggleInner_ImageColor3[3] = (boolstatus and "main") or "bottomGradient"
  2739. colored_toggleInner_ImageColor3[4] = (boolstatus and 2.5) or nil
  2740. if lockedup then
  2741. colored_toggleInner_BackgroundColor3[4] = 1 + (colored_toggleInner_BackgroundColor3[4] or 1)
  2742. colored_toggleInner_ImageColor3[4] = 1 + (colored_toggleInner_ImageColor3[4] or 1)
  2743. end
  2744. tweenService:Create(toggleInner, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2745. BackgroundColor3 = (boolstatus and darkenColor(library.colors.main, colored_toggleInner_BackgroundColor3[4])) or library.colors.topGradient,
  2746. ImageColor3 = (boolstatus and darkenColor(library.colors.main, colored_toggleInner_ImageColor3[4])) or library.colors.bottomGradient
  2747. }):Play()
  2748. colored_toggleHeadline_TextColor3[4] = (lockedup and 2.5) or nil
  2749. tweenService:Create(toggleHeadline, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2750. TextColor3 = (lockedup and darkenColor(library.colors.elementText, colored_toggleHeadline_TextColor3[4])) or library.colors.elementText
  2751. }):Play()
  2752. toggleHeadline.Text = toggleName or "???"
  2753. return boolstatus
  2754. end
  2755. if alreadyEnabled ~= nil then
  2756. Set(alreadyEnabled)
  2757. else
  2758. library_flags[flagName] = alreadyEnabled and true
  2759. if options.Location then
  2760. options.Location[options.LocationFlag or flagName] = alreadyEnabled and true
  2761. end
  2762. end
  2763. local default = library_flags[flagName] and true
  2764. Update()
  2765. if kbUpdate then
  2766. kbUpdate()
  2767. end
  2768. local objectdata = {
  2769. Options = options,
  2770. Type = "Toggle",
  2771. Name = flagName,
  2772. Flag = flagName,
  2773. Default = default,
  2774. Parent = sectionFunctions,
  2775. Instance = toggleButton,
  2776. Set = Set,
  2777. Remove = function()
  2778. if newToggle then
  2779. newToggle.Parent = nil
  2780. sectionFunctions:Update()
  2781. end
  2782. end,
  2783. RawSet = function(t, newStatus, condition)
  2784. if t ~= nil and type(t) ~= "table" then
  2785. newStatus, condition = t, newStatus
  2786. end
  2787. last_v = library_flags[flagName]
  2788. if (condition ~= false) and (condition ~= 0) then
  2789. local overridecondition = condition and (type(condition) == "function") and condition
  2790. if overridecondition or (options.Condition ~= nil) then
  2791. if type(overridecondition or options.Condition) == "function" then
  2792. local v, e = pcall(overridecondition or options.Condition, newStatus, last_v)
  2793. if e then
  2794. if not v then
  2795. warn(debug.traceback(string.format("Error in toggle (RawSet) %s's Condition function: %s", flagName, e), 2))
  2796. end
  2797. else
  2798. return last_v
  2799. end
  2800. end
  2801. end
  2802. end
  2803. library_flags[flagName] = newStatus
  2804. if options.Location then
  2805. options.Location[options.LocationFlag or flagName] = newStatus
  2806. end
  2807. Update()
  2808. return newStatus
  2809. end,
  2810. KeybindData = kbData,
  2811. Get = function()
  2812. return library_flags[flagName]
  2813. end,
  2814. Update = Update,
  2815. Reset = function()
  2816. return Set(nil, default)
  2817. end,
  2818. SetLocked = function(t, state)
  2819. if type(t) ~= "table" then
  2820. state = t
  2821. end
  2822. local last_v = lockedup
  2823. if state == nil then
  2824. lockedup = not lockedup
  2825. else
  2826. lockedup = state
  2827. end
  2828. if lockedup ~= last_v then
  2829. colored_toggleHeadline_TextColor3[4] = (lockedup and 2.5) or nil
  2830. Update()
  2831. if kbUpdate then
  2832. kbUpdate()
  2833. end
  2834. end
  2835. return lockedup
  2836. end,
  2837. Lock = function()
  2838. if not lockedup then
  2839. lockedup = true
  2840. colored_toggleHeadline_TextColor3[4] = 2.5
  2841. Update()
  2842. if kbUpdate then
  2843. kbUpdate()
  2844. end
  2845. end
  2846. return lockedup
  2847. end,
  2848. Unlock = function()
  2849. if lockedup then
  2850. lockedup = false
  2851. colored_toggleHeadline_TextColor3[4] = nil
  2852. Update()
  2853. if kbUpdate then
  2854. kbUpdate()
  2855. end
  2856. end
  2857. return lockedup
  2858. end,
  2859. SetCondition = function(t, condition)
  2860. if type(t) ~= "table" and condition == nil then
  2861. condition = t
  2862. end
  2863. options.Condition = condition
  2864. return condition
  2865. end
  2866. }
  2867. if kbData then
  2868. kbData.ToggleData = objectdata
  2869. end
  2870. tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
  2871. return objectdata
  2872. end
  2873. sectionFunctions.CreateToggle = sectionFunctions.AddToggle
  2874. sectionFunctions.NewToggle = sectionFunctions.AddToggle
  2875. sectionFunctions.Toggle = sectionFunctions.AddToggle
  2876. sectionFunctions.Tog = sectionFunctions.AddToggle
  2877. function sectionFunctions:AddButton(...)
  2878. local args = nil
  2879. if ... and not select(2, ...) and type(...) == "table" and #... > 0 and type((...)[1]) == "table" and (...)[1].Name then
  2880. args = ...
  2881. else
  2882. args = {...}
  2883. end
  2884. local buttons, offset = {}, 0
  2885. local frames = {}
  2886. local fram = nil
  2887. for _, options in next, args do
  2888. options = (options and options[1] and type(options[1]) == "string" and resolvevararg("Button", unpack(options))) or options
  2889. local buttonName, callback = assert(options.Name, "Missing Name for new button."), options.Callback or (warn("AddButton missing callback. Name:", options.Name or "No Name", debug.traceback("")) and nil) or function()
  2890. end
  2891. local lockedup = options.Locked
  2892. local realButton = Instance_new("TextButton")
  2893. realButton.Name = "realButton"
  2894. realButton.BackgroundColor3 = Color3.new(1, 1, 1)
  2895. realButton.BackgroundTransparency = 1
  2896. realButton.Size = UDim2.fromScale(1, 1)
  2897. realButton.ZIndex = 5
  2898. realButton.Font = Enum.Font.Code
  2899. realButton.Text = (buttonName and tostring(buttonName)) or "???"
  2900. realButton.TextColor3 = library.colors.elementText
  2901. local colored_realButton_TextColor3 = {realButton, "TextColor3", "elementText"}
  2902. colored[1 + #colored] = colored_realButton_TextColor3
  2903. realButton.TextSize = 14
  2904. local textsize = textToSize(realButton).X + 14
  2905. if newSection.Parent and (newSection.Parent.AbsoluteSize.X < (offset + textsize + 8)) then
  2906. offset, fram = 0, nil
  2907. end
  2908. local newButton = fram or Instance_new("Frame")
  2909. fram = newButton
  2910. local framButtons = frames[fram] or {}
  2911. frames[fram] = framButtons
  2912. local button = Instance_new("ImageLabel")
  2913. newButton.Name = removeSpaces((buttonName and buttonName:lower() or "???") .. "Holder")
  2914. newButton.Parent = sectionHolder
  2915. newButton.BackgroundColor3 = Color3.new(1, 1, 1)
  2916. newButton.BackgroundTransparency = 1
  2917. newButton.Size = UDim2.new(1, 0, 0, 24)
  2918. button.Name = "button"
  2919. button.Parent = newButton
  2920. button.Active = true
  2921. button.BackgroundColor3 = library.colors.topGradient
  2922. local colored_button_BackgroundColor3 = {button, "BackgroundColor3", "topGradient"}
  2923. colored[1 + #colored] = colored_button_BackgroundColor3
  2924. button.BorderColor3 = library.colors.elementBorder
  2925. colored[1 + #colored] = {button, "BorderColor3", "elementBorder"}
  2926. button.Position = UDim2.new(0.031, offset, 0.166)
  2927. button.Selectable = true
  2928. button.Size = UDim2.fromOffset(28, 18)
  2929. button.Image = "rbxassetid://2454009026"
  2930. button.ImageColor3 = library.colors.bottomGradient
  2931. local colored_button_ImageColor3 = {button, "ImageColor3", "bottomGradient"}
  2932. colored[1 + #colored] = colored_button_ImageColor3
  2933. local buttonInner = Instance_new("ImageLabel")
  2934. buttonInner.Name = "buttonInner"
  2935. buttonInner.Parent = button
  2936. buttonInner.Active = true
  2937. buttonInner.AnchorPoint = Vector2.new(0.5, 0.5)
  2938. buttonInner.BackgroundColor3 = library.colors.topGradient
  2939. local colored_buttonInner_BackgroundColor3 = {buttonInner, "BackgroundColor3", "topGradient"}
  2940. colored[1 + #colored] = colored_buttonInner_BackgroundColor3
  2941. buttonInner.BorderColor3 = library.colors.elementBorder
  2942. colored[1 + #colored] = {buttonInner, "BorderColor3", "elementBorder"}
  2943. buttonInner.Position = UDim2.fromScale(0.5, 0.5)
  2944. buttonInner.Selectable = true
  2945. buttonInner.Size = UDim2.new(1, -4, 1, -4)
  2946. buttonInner.Image = "rbxassetid://2454009026"
  2947. buttonInner.ImageColor3 = library.colors.bottomGradient
  2948. local colored_buttonInner_ImageColor3 = {buttonInner, "ImageColor3", "bottomGradient"}
  2949. colored[1 + #colored] = colored_buttonInner_ImageColor3
  2950. button.Size = UDim2.fromOffset(textsize, 18)
  2951. realButton.Parent = button
  2952. offset = offset + textsize + 6
  2953. sectionFunctions:Update()
  2954. local presses = 0
  2955. library.signals[1 + #library.signals] = realButton.MouseButton1Click:Connect(function()
  2956. if lockedup then
  2957. return
  2958. end
  2959. if options.Condition ~= nil and type(options.Condition) == "function" then
  2960. local v, e = pcall(options.Condition, presses)
  2961. if e then
  2962. if not v then
  2963. warn(debug.traceback(string.format("Error in button %s's Condition function: %s", buttonName, e), 2))
  2964. end
  2965. else
  2966. return
  2967. end
  2968. end
  2969. if not library.colorpicker and not submenuOpen then
  2970. presses = 1 + presses
  2971. task.spawn(callback, presses)
  2972. end
  2973. end)
  2974. local imin = nil
  2975. library.signals[1 + #library.signals] = button.MouseEnter:Connect(function()
  2976. imin = 1
  2977. colored_button_BackgroundColor3[3] = "main"
  2978. colored_button_BackgroundColor3[4] = 1.5
  2979. colored_button_ImageColor3[3] = "main"
  2980. colored_button_ImageColor3[4] = 2.5
  2981. tweenService:Create(button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2982. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  2983. ImageColor3 = darkenColor(library.colors.main, 2.5)
  2984. }):Play()
  2985. end)
  2986. library.signals[1 + #library.signals] = button.MouseLeave:Connect(function()
  2987. imin = nil
  2988. colored_button_BackgroundColor3[3] = "topGradient"
  2989. colored_button_BackgroundColor3[4] = nil
  2990. colored_button_ImageColor3[3] = "bottomGradient"
  2991. colored_button_ImageColor3[4] = nil
  2992. tweenService:Create(button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  2993. BackgroundColor3 = library.colors.topGradient,
  2994. ImageColor3 = library.colors.bottomGradient
  2995. }):Play()
  2996. end)
  2997. local function Update(Recursive)
  2998. buttonName, callback = options.Name or buttonName, options.Callback or (warn(debug.traceback("AddButton missing callback. Name:" .. (options.Name or buttonName or "No Name"), 2)) and nil) or function()
  2999. end
  3000. colored_button_BackgroundColor3[3] = (imin and "main") or "topGradient"
  3001. colored_button_BackgroundColor3[4] = (imin and 1.5) or nil
  3002. colored_button_ImageColor3[3] = (imin and "main") or "bottomGradient"
  3003. colored_button_ImageColor3[4] = (imin and 2.5) or nil
  3004. colored_buttonInner_BackgroundColor3[4] = nil
  3005. colored_buttonInner_ImageColor3[4] = nil
  3006. colored_realButton_TextColor3[4] = nil
  3007. if lockedup then
  3008. colored_button_BackgroundColor3[4] = 1.25
  3009. colored_button_ImageColor3[4] = 1.25
  3010. colored_buttonInner_BackgroundColor3[4] = 1.25
  3011. colored_buttonInner_ImageColor3[4] = 1.25
  3012. colored_realButton_TextColor3[4] = 1.75
  3013. end
  3014. tweenService:Create(button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  3015. BackgroundColor3 = (imin and darkenColor(library.colors.main, colored_button_BackgroundColor3[4])) or darkenColor(library.colors.topGradient, colored_button_BackgroundColor3[4]),
  3016. ImageColor3 = (imin and darkenColor(library.colors.main, colored_button_ImageColor3[4])) or darkenColor(library.colors.bottomGradient, colored_button_ImageColor3[4])
  3017. }):Play()
  3018. tweenService:Create(buttonInner, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  3019. BackgroundColor3 = darkenColor(library.colors.topGradient, colored_buttonInner_BackgroundColor3[4]),
  3020. ImageColor3 = darkenColor(library.colors.bottomGradient, colored_buttonInner_ImageColor3[4])
  3021. }):Play()
  3022. tweenService:Create(realButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  3023. TextColor3 = darkenColor(library.colors.elementText, colored_realButton_TextColor3[4])
  3024. }):Play()
  3025. realButton.Text = (buttonName and tostring(buttonName)) or "???"
  3026. local newtextsize = textToSize(realButton).X + 14
  3027. if textsize ~= newtextsize then
  3028. textsize = newtextsize
  3029. button.Size = UDim2.fromOffset(textsize, 18)
  3030. if Recursive ~= "Recursive" then
  3031. if buttons and buttons.UpdateAll then
  3032. buttons.UpdateAll()
  3033. end
  3034. end
  3035. end
  3036. return presses, textsize
  3037. end
  3038. Update()
  3039. local objectdata = {
  3040. Options = options,
  3041. Name = buttonName,
  3042. Flag = buttonName,
  3043. Type = "Button",
  3044. Parent = sectionFunctions,
  3045. Instance = realButton,
  3046. Frame = fram or newButton,
  3047. ButtonFrame = button,
  3048. Remove = function()
  3049. if button then
  3050. button.Parent = nil
  3051. buttons.UpdateAll()
  3052. sectionFunctions.UpdateAll()
  3053. end
  3054. end,
  3055. Press = function(...)
  3056. if lockedup then
  3057. return presses
  3058. end
  3059. if options.Condition ~= nil and type(options.Condition) == "function" then
  3060. local v, e = pcall(options.Condition, presses)
  3061. if e then
  3062. if v then
  3063. else
  3064. warn(debug.traceback(string.format("Error in button %s's Condition function: %s", buttonName, e), 2))
  3065. end
  3066. else
  3067. return presses
  3068. end
  3069. end
  3070. local args = {...}
  3071. local a1 = args[1]
  3072. if a1 and type(a1) == "table" then
  3073. table.remove(args, 1)
  3074. end
  3075. presses = 1 + presses
  3076. task.spawn(callback, presses, ...)
  3077. return presses
  3078. end,
  3079. RawPress = function(...)
  3080. local args = {...}
  3081. local a1 = args[1]
  3082. if a1 and type(a1) == "table" then
  3083. table.remove(args, 1)
  3084. end
  3085. task.spawn(callback, presses, ...)
  3086. return presses
  3087. end,
  3088. Get = function()
  3089. return callback, presses
  3090. end,
  3091. SetLocked = function(t, state)
  3092. if type(t) ~= "table" then
  3093. state = t
  3094. end
  3095. local last_v = lockedup
  3096. if state == nil then
  3097. lockedup = not lockedup
  3098. else
  3099. lockedup = state
  3100. end
  3101. if lockedup ~= last_v then
  3102. Update()
  3103. end
  3104. return lockedup
  3105. end,
  3106. Lock = function()
  3107. if not lockedup then
  3108. lockedup = true
  3109. Update()
  3110. end
  3111. return lockedup
  3112. end,
  3113. Unlock = function()
  3114. if lockedup then
  3115. lockedup = false
  3116. Update()
  3117. end
  3118. return lockedup
  3119. end,
  3120. SetCondition = function(t, condition)
  3121. if type(t) ~= "table" and condition == nil then
  3122. condition = t
  3123. end
  3124. options.Condition = condition
  3125. return condition
  3126. end,
  3127. Update = Update,
  3128. SetText = function(t, str)
  3129. if type(t) ~= "table" and str == nil then
  3130. str = t
  3131. end
  3132. buttonName = str
  3133. options.Name = str
  3134. realButton.Text = (buttonName and tostring(buttonName)) or "???"
  3135. return str
  3136. end,
  3137. SetCallback = function(t, call)
  3138. if type(t) ~= "table" and call == nil then
  3139. call = t
  3140. end
  3141. options.Callback = call
  3142. callback = call
  3143. return call
  3144. end
  3145. }
  3146. tabFunctions.Flags[buttonName], sectionFunctions.Flags[buttonName], elements[buttonName] = objectdata, objectdata, objectdata
  3147. buttons[1 + #buttons] = objectdata
  3148. framButtons[1 + #framButtons] = objectdata
  3149. end
  3150. function buttons.PressAll()
  3151. for _, v in next, buttons do
  3152. v.Press()
  3153. end
  3154. end
  3155. function buttons.UpdateAll()
  3156. for fram, Fram in next, frames do
  3157. if Fram and fram then
  3158. local offset = 0
  3159. for _, v in next, Fram do
  3160. if v and v.Instance and fram:IsAncestorOf(v.Instance) then
  3161. local _, textsize = v.Update("Recursive")
  3162. textsize = tonumber(textsize) or (textToSize(v.Instance).X + 14)
  3163. v.ButtonFrame.Position = UDim2.new(0.031, offset, 0.166)
  3164. offset = offset + textsize + 6
  3165. end
  3166. end
  3167. end
  3168. end
  3169. end
  3170. buttons.Update = buttons.UpdateAll
  3171. function buttons.RemoveAll()
  3172. for _, v in next, buttons do
  3173. v.Remove()
  3174. end
  3175. end
  3176. function buttons.Remove()
  3177. for fram in next, frames do
  3178. if fram then
  3179. fram.Parent = nil
  3180. end
  3181. end
  3182. end
  3183. if #buttons == 1 then
  3184. for k, v in next, buttons[1] do
  3185. if buttons[k] == nil then
  3186. buttons[k] = v
  3187. end
  3188. end
  3189. end
  3190. return buttons
  3191. end
  3192. sectionFunctions.CreateButton = sectionFunctions.AddButton
  3193. sectionFunctions.NewButton = sectionFunctions.AddButton
  3194. sectionFunctions.Button = sectionFunctions.AddButton
  3195. function sectionFunctions:AddTextbox(options, ...)
  3196. options = (options and type(options) == "string" and resolvevararg("Textbox", options, ...)) or options
  3197. local textboxName, presetValue, placeholder, callback, flagName = assert(options.Name, "Missing Name for new textbox."), options.Value, options.Placeholder, options.Callback, options.Flag or (function()
  3198. library.unnamedtextboxes = 1 + (library.unnamedtextboxes or 0)
  3199. return "Textbox" .. tostring(library.unnamedtextboxes)
  3200. end)()
  3201. if elements[flagName] ~= nil then
  3202. warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
  3203. end
  3204. local requiredtype = options.Type
  3205. local newTextbox = Instance_new("Frame")
  3206. local textbox = Instance_new("ImageLabel")
  3207. local textboxInner = Instance_new("ImageLabel")
  3208. local realTextbox = Instance_new("TextBox")
  3209. local textboxHeadline = Instance_new("TextLabel")
  3210. newTextbox.Name = removeSpaces((textboxName and textboxName:lower()) or "???") .. "Holder"
  3211. newTextbox.Parent = sectionHolder
  3212. newTextbox.BackgroundColor3 = Color3.new(1, 1, 1)
  3213. newTextbox.BackgroundTransparency = 1
  3214. newTextbox.Size = UDim2.new(1, 0, 0, 42)
  3215. textbox.Name = "textbox"
  3216. textbox.Parent = newTextbox
  3217. textbox.Active = true
  3218. textbox.BackgroundColor3 = library.colors.topGradient
  3219. local colored_textbox_BackgroundColor3 = {textbox, "BackgroundColor3", "topGradient"}
  3220. colored[1 + #colored] = colored_textbox_BackgroundColor3
  3221. textbox.BorderColor3 = library.colors.elementBorder
  3222. colored[1 + #colored] = {textbox, "BorderColor3", "elementBorder"}
  3223. textbox.Position = UDim2.fromScale(0.031, 0.48)
  3224. textbox.Selectable = true
  3225. textbox.Size = UDim2.fromOffset(206, 18)
  3226. textbox.Image = "rbxassetid://2454009026"
  3227. textbox.ImageColor3 = library.colors.bottomGradient
  3228. local colored_textbox_ImageColor3 = {textbox, "ImageColor3", "bottomGradient"}
  3229. colored[1 + #colored] = colored_textbox_ImageColor3
  3230. textboxInner.Name = "textboxInner"
  3231. textboxInner.Parent = textbox
  3232. textboxInner.Active = true
  3233. textboxInner.AnchorPoint = Vector2.new(0.5, 0.5)
  3234. textboxInner.BackgroundColor3 = library.colors.topGradient
  3235. colored[1 + #colored] = {textboxInner, "BackgroundColor3", "topGradient"}
  3236. textboxInner.BorderColor3 = library.colors.elementBorder
  3237. colored[1 + #colored] = {textboxInner, "BorderColor3", "elementBorder"}
  3238. textboxInner.Position = UDim2.fromScale(0.5, 0.5)
  3239. textboxInner.Selectable = true
  3240. textboxInner.Size = UDim2.new(1, -4, 1, -4)
  3241. textboxInner.Image = "rbxassetid://2454009026"
  3242. textboxInner.ImageColor3 = library.colors.bottomGradient
  3243. colored[1 + #colored] = {textboxInner, "ImageColor3", "bottomGradient"}
  3244. realTextbox.Name = "realTextbox"
  3245. if options.Rich or options.RichText or options.RichTextBox then
  3246. realTextbox.RichText = true
  3247. end
  3248. if options.MultiLine or options.Lines then
  3249. realTextbox.MultiLine = true
  3250. end
  3251. if options.Font or options.TextFont then
  3252. realTextbox.Font = options.Font
  3253. end
  3254. if options.TextScaled or options.Scaled then
  3255. realTextbox.TextScaled = true
  3256. end
  3257. realTextbox.BackgroundColor3 = Color3.new(1, 1, 1)
  3258. realTextbox.BackgroundTransparency = 1
  3259. realTextbox.Position = UDim2.new(0.0295485705)
  3260. realTextbox.Size = UDim2.fromScale(0.97, 1)
  3261. realTextbox.ZIndex = 5
  3262. realTextbox.Font = Enum.Font.Code
  3263. realTextbox.LineHeight = 1.15
  3264. realTextbox.Text = tostring(presetValue)
  3265. realTextbox.TextColor3 = library.colors.otherElementText
  3266. colored[1 + #colored] = {realTextbox, "TextColor3", "otherElementText"}
  3267. realTextbox.TextSize = 14
  3268. if options.ClearTextOnFocus or options.ClearText then
  3269. realTextbox.ClearTextOnFocus = true
  3270. else
  3271. realTextbox.ClearTextOnFocus = false
  3272. end
  3273. realTextbox.PlaceholderText = (placeholder ~= nil and tostring(placeholder)) or (presetValue ~= nil and tostring(presetValue)) or ""
  3274. realTextbox.TextXAlignment = Enum.TextXAlignment.Left
  3275. if options.CustomProperties and type(options.CustomProperties) == "table" then
  3276. for k, v in next, options.CustomProperties do
  3277. local oof, e = pcall(function()
  3278. realTextbox[k] = v
  3279. end)
  3280. if not oof and e then
  3281. warn("Error setting Textbox", flagName, "|", e, debug.traceback(""))
  3282. end
  3283. end
  3284. end
  3285. realTextbox.Parent = textbox
  3286. textboxHeadline.Name = "textboxHeadline"
  3287. textboxHeadline.Parent = newTextbox
  3288. textboxHeadline.Active = true
  3289. textboxHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
  3290. textboxHeadline.BackgroundTransparency = 1
  3291. textboxHeadline.Position = UDim2.new(0.031)
  3292. textboxHeadline.Selectable = true
  3293. textboxHeadline.Size = UDim2.fromOffset(206, 20)
  3294. textboxHeadline.ZIndex = 5
  3295. textboxHeadline.Font = Enum.Font.Code
  3296. textboxHeadline.LineHeight = 1.15
  3297. textboxHeadline.Text = (textboxName and tostring(textboxName)) or "???"
  3298. textboxHeadline.TextColor3 = library.colors.elementText
  3299. colored[1 + #colored] = {textboxHeadline, "TextColor3", "elementText"}
  3300. textboxHeadline.TextSize = 14
  3301. textboxHeadline.TextXAlignment = Enum.TextXAlignment.Left
  3302. sectionFunctions:Update()
  3303. local last_v = presetValue
  3304. local function resolvevalue(val)
  3305. if options.PreFormat then
  3306. local typ = type(options.PreFormat)
  3307. if typ == "function" then
  3308. local x, e = pcall(options.PreFormat, val)
  3309. if not x and e then
  3310. warn("Error in Pre-Format (Textbox " .. flagName .. "):", e)
  3311. else
  3312. val = e
  3313. end
  3314. end
  3315. end
  3316. if requiredtype == "number" then
  3317. if not options.Hex and not options.Binary and not options.Base then
  3318. val = tonumber(val) or tonumber(val:gsub("%D", ""), 10) or 0
  3319. else
  3320. val = tonumber(val, (options.Hex and 16) or (options.Binary and 2) or options.Base or 10) or 0
  3321. end
  3322. if options.Max or options.Min then
  3323. val = math.clamp(val, options.Min or -math.huge, options.Max or math.huge)
  3324. end
  3325. local decimalprecision = tonumber(options.Decimals or options.Precision or options.Precise)
  3326. if decimalprecision then
  3327. val = tonumber(string.format("%0." .. tostring(decimalprecision) .. "f", val))
  3328. end
  3329. end
  3330. if options.PostFormat then
  3331. local typ = type(options.PostFormat)
  3332. if typ == "function" then
  3333. local x, e = pcall(options.PostFormat, val)
  3334. if not x and e then
  3335. warn("Error in Post-Format (Textbox " .. flagName .. "):", e)
  3336. else
  3337. val = e
  3338. end
  3339. end
  3340. end
  3341. return (val and tonumber(val)) or val
  3342. end
  3343. library.signals[1 + #library.signals] = realTextbox.FocusLost:Connect(function()
  3344. last_v = library_flags[flagName]
  3345. local val = resolvevalue(realTextbox.Text)
  3346. library_flags[flagName] = val
  3347. if options.Location then
  3348. options.Location[options.LocationFlag or flagName] = val
  3349. end
  3350. if callback and last_v ~= val then
  3351. task.spawn(callback, tostring(val), last_v, realTextbox)
  3352. end
  3353. end)
  3354. library.signals[1 + #library.signals] = newTextbox.MouseEnter:Connect(function()
  3355. colored_textbox_BackgroundColor3[3] = "main"
  3356. colored_textbox_BackgroundColor3[4] = 1.5
  3357. colored_textbox_ImageColor3[3] = "main"
  3358. colored_textbox_ImageColor3[4] = 2.5
  3359. tweenService:Create(textbox, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  3360. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  3361. ImageColor3 = darkenColor(library.colors.main, 2.5)
  3362. }):Play()
  3363. end)
  3364. library.signals[1 + #library.signals] = newTextbox.MouseLeave:Connect(function()
  3365. colored_textbox_BackgroundColor3[3] = "topGradient"
  3366. colored_textbox_BackgroundColor3[4] = nil
  3367. colored_textbox_ImageColor3[3] = "bottomGradient"
  3368. colored_textbox_ImageColor3[4] = nil
  3369. tweenService:Create(textbox, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  3370. BackgroundColor3 = library.colors.topGradient,
  3371. ImageColor3 = library.colors.bottomGradient
  3372. }):Play()
  3373. end)
  3374. local function set(t, str)
  3375. if nil == str and t ~= nil then
  3376. str = t
  3377. end
  3378. last_v = library_flags[flagName]
  3379. library_flags[flagName] = str
  3380. if options.Location then
  3381. options.Location[options.LocationFlag or flagName] = str
  3382. end
  3383. local sstr = (str ~= nil and tostring(str)) or "Empty Text"
  3384. if realTextbox.Text ~= sstr then
  3385. realTextbox.Text = sstr
  3386. end
  3387. if callback and (last_v ~= str or options.AllowDuplicateCalls) then
  3388. task.spawn(callback, str, last_v, realTextbox)
  3389. end
  3390. return str
  3391. end
  3392. if presetValue ~= nil then
  3393. set(presetValue)
  3394. else
  3395. library_flags[flagName] = presetValue
  3396. if options.Location then
  3397. options.Location[options.LocationFlag or flagName] = presetValue
  3398. end
  3399. end
  3400. local default = library_flags[flagName]
  3401. local function update()
  3402. textboxName, placeholder, callback = options.Name or textboxName, options.Placeholder or placeholder, options.Callback
  3403. local str = library_flags[flagName]
  3404. str = (str ~= nil and tostring(str)) or "Empty Text"
  3405. if realTextbox.Text ~= str then
  3406. realTextbox.Text = str
  3407. end
  3408. textboxHeadline.Text = (textboxName and tostring(textboxName)) or "???"
  3409. return str
  3410. end
  3411. local objectdata = {
  3412. Options = options,
  3413. Name = flagName,
  3414. Flag = flagName,
  3415. Type = "Textbox",
  3416. Default = default,
  3417. Parent = sectionFunctions,
  3418. Instance = realTextbox,
  3419. Get = function()
  3420. return library_flags[flagName]
  3421. end,
  3422. Set = set,
  3423. Update = update,
  3424. Remove = function()
  3425. if newTextbox then
  3426. newTextbox.Parent = nil
  3427. sectionFunctions:Update()
  3428. end
  3429. end,
  3430. RawSet = function(t, str)
  3431. if t ~= nil and str == nil then
  3432. str = t
  3433. end
  3434. last_v = library_flags[flagName]
  3435. library_flags[flagName] = str
  3436. if options.Location then
  3437. options.Location[options.LocationFlag or flagName] = str
  3438. end
  3439. update()
  3440. return str
  3441. end,
  3442. Reset = function()
  3443. return set(nil, default)
  3444. end
  3445. }
  3446. tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
  3447. return objectdata
  3448. end
  3449. sectionFunctions.AddTextBox = sectionFunctions.AddTextbox
  3450. sectionFunctions.NewTextBox = sectionFunctions.AddTextbox
  3451. sectionFunctions.CreateTextBox = sectionFunctions.AddTextbox
  3452. sectionFunctions.TextBox = sectionFunctions.AddTextbox
  3453. sectionFunctions.NewTextbox = sectionFunctions.AddTextbox
  3454. sectionFunctions.CreateTextbox = sectionFunctions.AddTextbox
  3455. sectionFunctions.Textbox = sectionFunctions.AddTextbox
  3456. sectionFunctions.Box = sectionFunctions.AddTextbox
  3457. function sectionFunctions:AddKeybind(options, ...)
  3458. options = (options and type(options) == "string" and resolvevararg("Keybind", options, ...)) or options
  3459. local keybindName, presetKeybind, callback, presscallback, flag = assert(options.Name, "Missing Name for new keybind."), options.Value, options.Callback, options.Pressed, options.Flag or (function()
  3460. library.unnamedkeybinds = 1 + (library.unnamedkeybinds or 0)
  3461. return "Keybind" .. tostring(library.unnamedkeybinds)
  3462. end)()
  3463. local IsCore = (options.CoreBinding and true) or nil
  3464. if elements[flag] ~= nil then
  3465. warn(debug.traceback("Warning! Re-used flag '" .. flag .. "'", 3))
  3466. end
  3467. library.keyHandler = keyHandler
  3468. local keyHandler = options.KeyNames or keyHandler
  3469. local newKeybind = Instance_new("Frame")
  3470. local keybindHeadline = Instance_new("TextLabel")
  3471. local keybindPositioner = Instance_new("Frame")
  3472. local keybindList = Instance_new("UIListLayout")
  3473. local keybindButton = Instance_new("TextButton")
  3474. local bindedKey = presetKeybind
  3475. local justBinded = false
  3476. local keyName = (presetKeybind and tostring(presetKeybind):gsub("Enum.KeyCode.", "") or "")
  3477. newKeybind.Name = "newKeybind"
  3478. newKeybind.Parent = sectionHolder
  3479. newKeybind.BackgroundColor3 = Color3.new(1, 1, 1)
  3480. newKeybind.BackgroundTransparency = 1
  3481. newKeybind.Size = UDim2.new(1, 0, 0, 19)
  3482. keybindHeadline.Name = "keybindHeadline"
  3483. keybindHeadline.Parent = newKeybind
  3484. keybindHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
  3485. keybindHeadline.BackgroundTransparency = 1
  3486. keybindHeadline.Position = UDim2.fromScale(0.031, 0.165842161)
  3487. keybindHeadline.Size = UDim2.fromOffset(215, 12)
  3488. keybindHeadline.Font = Enum.Font.Code
  3489. keybindHeadline.Text = (keybindName and tostring(keybindName)) or "???"
  3490. keybindHeadline.TextColor3 = library.colors.elementText
  3491. colored[1 + #colored] = {keybindHeadline, "TextColor3", "elementText"}
  3492. keybindHeadline.TextSize = 14
  3493. keybindHeadline.TextXAlignment = Enum.TextXAlignment.Left
  3494. keybindPositioner.Name = "keybindPositioner"
  3495. keybindPositioner.Parent = newKeybind
  3496. keybindPositioner.BackgroundColor3 = Color3.new(1, 1, 1)
  3497. keybindPositioner.BackgroundTransparency = 1
  3498. keybindPositioner.Position = UDim2.new(0.00448430516)
  3499. keybindPositioner.Size = UDim2.fromOffset(214, 19)
  3500. keybindList.Name = "keybindList"
  3501. keybindList.Parent = keybindPositioner
  3502. keybindList.FillDirection = Enum.FillDirection.Horizontal
  3503. keybindList.HorizontalAlignment = Enum.HorizontalAlignment.Right
  3504. keybindList.SortOrder = Enum.SortOrder.LayoutOrder
  3505. keybindList.VerticalAlignment = Enum.VerticalAlignment.Center
  3506. keybindButton.Name = "keybindButton"
  3507. keybindButton.Parent = keybindPositioner
  3508. keybindButton.Active = false
  3509. keybindButton.BackgroundColor3 = Color3.new(1, 1, 1)
  3510. keybindButton.BackgroundTransparency = 1
  3511. keybindButton.Position = UDim2.fromScale(0.598130822, 0.184210524)
  3512. keybindButton.Selectable = false
  3513. keybindButton.Size = UDim2.fromOffset(46, 12)
  3514. keybindButton.Font = Enum.Font.Code
  3515. keybindButton.Text = (presetKeybind and tostring(presetKeybind):gsub("Enum.KeyCode.", "") or "[NONE]")
  3516. keybindButton.TextColor3 = library.colors.otherElementText
  3517. local colored_keybindButton_TextColor3 = {keybindButton, "TextColor3", "otherElementText"}
  3518. colored[1 + #colored] = colored_keybindButton_TextColor3
  3519. keybindButton.TextSize = 14
  3520. keybindButton.TextXAlignment = Enum.TextXAlignment.Right
  3521. keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
  3522. sectionFunctions:Update()
  3523. local last_v = bindedKey or presetKeybind
  3524. local function newkey()
  3525. local IgnoreKey = nil
  3526. if IsCore then
  3527. IgnoreKey = tick()
  3528. IgnoreCoreInputs = IgnoreKey
  3529. end
  3530. local old_texts = keybindButton.Text
  3531. colored_keybindButton_TextColor3[3] = "main"
  3532. colored_keybindButton_TextColor3[4] = nil
  3533. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  3534. TextColor3 = library.colors.main
  3535. }):Play()
  3536. if last_v then
  3537. keybindButton.Text = "(Was " .. (last_v and tostring(last_v):gsub("Enum.KeyCode.", "") or "[NONE]") .. ") [...]"
  3538. else
  3539. keybindButton.Text = "[...]"
  3540. end
  3541. local receivingKey = nil
  3542. receivingKey = userInputService.InputBegan:Connect(function(key)
  3543. last_v = library_flags[flag]
  3544. if not keyHandler.notAllowedKeys[key.KeyCode] then
  3545. if key.KeyCode ~= Enum.KeyCode.Unknown then
  3546. bindedKey = (key.KeyCode ~= Enum.KeyCode.Escape and key.KeyCode) or library_flags[flag]
  3547. library_flags[flag] = bindedKey
  3548. if options.Location then
  3549. options.Location[options.LocationFlag or flag] = bindedKey
  3550. end
  3551. if bindedKey then
  3552. keyName = keyHandler.allowedKeys[bindedKey]
  3553. keybindButton.Text = "[" .. (keyName or bindedKey.Name or tostring(key.KeyCode):gsub("Enum.KeyCode.", "")) .. "]"
  3554. keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
  3555. justBinded = true
  3556. colored_keybindButton_TextColor3[3] = "otherElementText"
  3557. colored_keybindButton_TextColor3[4] = nil
  3558. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  3559. TextColor3 = library.colors.otherElementText
  3560. }):Play()
  3561. receivingKey:Disconnect()
  3562. end
  3563. if callback and last_v ~= bindedKey then
  3564. task.spawn(callback, bindedKey, last_v)
  3565. end
  3566. if IsCore then
  3567. delay(0.1, function()
  3568. if IgnoreCoreInputs and (IgnoreCoreInputs == IgnoreKey) then
  3569. IgnoreCoreInputs = nil
  3570. end
  3571. end)
  3572. end
  3573. return
  3574. elseif key.KeyCode == Enum.KeyCode.Unknown and not keyHandler.notAllowedMouseInputs[key.UserInputType] then
  3575. bindedKey = key.UserInputType
  3576. library_flags[flag] = bindedKey
  3577. if options.Location then
  3578. options.Location[options.LocationFlag or flag] = bindedKey
  3579. end
  3580. keyName = keyHandler.allowedKeys[bindedKey]
  3581. keybindButton.Text = "[" .. (keyName or bindedKey.Name or tostring(key.KeyCode):gsub("Enum.KeyCode.", "")) .. "]"
  3582. keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
  3583. justBinded = true
  3584. colored_keybindButton_TextColor3[3] = "otherElementText"
  3585. colored_keybindButton_TextColor3[4] = nil
  3586. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  3587. TextColor3 = library.colors.otherElementText
  3588. }):Play()
  3589. receivingKey:Disconnect()
  3590. if callback and last_v ~= bindedKey then
  3591. task.spawn(callback, bindedKey, last_v)
  3592. end
  3593. if IsCore then
  3594. delay(0.1, function()
  3595. if IgnoreCoreInputs and (IgnoreCoreInputs == IgnoreKey) then
  3596. IgnoreCoreInputs = nil
  3597. end
  3598. end)
  3599. end
  3600. return
  3601. end
  3602. end
  3603. if key.KeyCode == Enum.KeyCode.Backspace or Enum.KeyCode.Escape == key.KeyCode then
  3604. old_texts, bindedKey = "[NONE]", nil
  3605. end
  3606. keybindButton.Text = old_texts
  3607. colored_keybindButton_TextColor3[3] = "otherElementText"
  3608. colored_keybindButton_TextColor3[4] = nil
  3609. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  3610. TextColor3 = library.colors.otherElementText
  3611. }):Play()
  3612. receivingKey:Disconnect()
  3613. if callback and last_v ~= bindedKey then
  3614. task.spawn(callback, bindedKey, last_v)
  3615. end
  3616. end)
  3617. library.signals[1 + #library.signals] = receivingKey
  3618. end
  3619. library.signals[1 + #library.signals] = keybindButton.MouseButton1Click:Connect(newkey)
  3620. library.signals[1 + #library.signals] = newKeybind.InputEnded:Connect(function(input)
  3621. if not library.colorpicker and not submenuOpen and input.UserInputType == Enum.UserInputType.MouseButton1 then
  3622. newkey()
  3623. end
  3624. end)
  3625. if presscallback then
  3626. library.signals[1 + #library.signals] = userInputService.InputBegan:Connect(function(key, chatting)
  3627. if not keyHandler.notAllowedKeys[key.KeyCode] and not keyHandler.notAllowedMouseInputs[key.UserInputType] then
  3628. if not justBinded and bindedKey == key.UserInputType or not justBinded and bindedKey == key.KeyCode and not chatting then
  3629. if presscallback then
  3630. task.spawn(presscallback, key, chatting)
  3631. end
  3632. end
  3633. if justBinded then
  3634. justBinded = false
  3635. end
  3636. end
  3637. end)
  3638. end
  3639. local function set(t, key)
  3640. if (nil == key) and (t ~= nil) then
  3641. key = t
  3642. end
  3643. if (key == "nil") or (key == "NONE") or (key == "none") then
  3644. key = nil
  3645. end
  3646. last_v = library_flags[flag]
  3647. bindedKey = key
  3648. library_flags[flag] = key
  3649. if options.Location then
  3650. options.Location[options.LocationFlag or flag] = key
  3651. end
  3652. keyName = (key == nil and "NONE") or keyHandler.allowedKeys[key]
  3653. keybindButton.Text = "[" .. (keyName or key.Name or tostring(key):gsub("Enum.KeyCode.", "")) .. "]"
  3654. keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
  3655. justBinded = true
  3656. colored_keybindButton_TextColor3[3] = "otherElementText"
  3657. colored_keybindButton_TextColor3[4] = nil
  3658. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  3659. TextColor3 = library.colors.otherElementText
  3660. }):Play()
  3661. if callback and ((last_v ~= key) or options.AllowDuplicateCalls) then
  3662. task.spawn(callback, key, last_v)
  3663. end
  3664. return key
  3665. end
  3666. if presetKeybind ~= nil then
  3667. set(presetKeybind)
  3668. else
  3669. library_flags[flag] = bindedKey
  3670. if options.Location then
  3671. options.Location[options.LocationFlag or flag] = bindedKey
  3672. end
  3673. end
  3674. local default = library_flags[flag]
  3675. local function update()
  3676. keybindName, callback, presscallback = options.Name or keybindName, options.Callback, options.Pressed
  3677. local key = library_flags[flag]
  3678. keyName = (key == nil and "NONE") or keyHandler.allowedKeys[key]
  3679. keybindButton.Text = "[" .. (keyName or key.Name or tostring(key):gsub("Enum.KeyCode.", "")) .. "]"
  3680. keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
  3681. colored_keybindButton_TextColor3[3] = "otherElementText"
  3682. colored_keybindButton_TextColor3[4] = nil
  3683. tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  3684. TextColor3 = library.colors.otherElementText
  3685. }):Play()
  3686. keybindHeadline.Text = (keybindName and tostring(keybindName)) or "???"
  3687. return key
  3688. end
  3689. local objectdata = {
  3690. Options = options,
  3691. Name = flag,
  3692. Flag = flag,
  3693. Type = "Keybind",
  3694. Default = default,
  3695. Parent = sectionFunctions,
  3696. Instance = keybindButton,
  3697. Get = function()
  3698. return library_flags[flag]
  3699. end,
  3700. Set = set,
  3701. Remove = function()
  3702. if newKeybind then
  3703. newKeybind.Parent = nil
  3704. sectionFunctions:Update()
  3705. end
  3706. end,
  3707. RawSet = function(t, key)
  3708. if nil == key and t ~= nil then
  3709. key = t
  3710. end
  3711. if key == "nil" or key == "NONE" or key == "none" then
  3712. key = nil
  3713. end
  3714. last_v = library_flags[flag]
  3715. bindedKey = key
  3716. library_flags[flag] = key
  3717. if options.Location then
  3718. options.Location[options.LocationFlag or flag] = key
  3719. end
  3720. justBinded = true
  3721. return key
  3722. end,
  3723. Update = update,
  3724. Reset = function()
  3725. return set(nil, default)
  3726. end
  3727. }
  3728. tabFunctions.Flags[flag], sectionFunctions.Flags[flag], elements[flag] = objectdata, objectdata, objectdata
  3729. return objectdata
  3730. end
  3731. sectionFunctions.NewKeybind = sectionFunctions.AddKeybind
  3732. sectionFunctions.CreateKeybind = sectionFunctions.AddKeybind
  3733. sectionFunctions.Keybind = sectionFunctions.AddKeybind
  3734. sectionFunctions.Bind = sectionFunctions.AddKeybind
  3735. function sectionFunctions:AddLabel(options, ...)
  3736. options = (options and type(options) == "string" and resolvevararg("Label", options, ...)) or options
  3737. local labelName, flag = options.Text or options.Value or options.Name, options.Flag or (function()
  3738. library.unnamedlabels = 1 + (library.unnamedlabels or 0)
  3739. return "Label" .. tostring(library.unnamedlabels)
  3740. end)()
  3741. if elements[flag] ~= nil then
  3742. warn(debug.traceback("Warning! Re-used flag '" .. flag .. "'", 3))
  3743. end
  3744. local newLabel = Instance_new("Frame")
  3745. local labelHeadline = Instance_new("TextLabel")
  3746. local labelPositioner = Instance_new("Frame")
  3747. local labelButton = Instance_new("TextButton")
  3748. newLabel.Name = "newLabel"
  3749. newLabel.Parent = sectionHolder
  3750. newLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  3751. newLabel.BackgroundTransparency = 1
  3752. newLabel.Size = UDim2.new(1, 0, 0, 19)
  3753. labelHeadline.Name = "labelHeadline"
  3754. labelHeadline.Parent = newLabel
  3755. labelHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
  3756. labelHeadline.BackgroundTransparency = 1
  3757. labelHeadline.Position = UDim2.fromScale(0.031, 0.165842161)
  3758. labelHeadline.Size = UDim2.fromOffset(215, 12)
  3759. labelHeadline.Font = Enum.Font.Code
  3760. labelHeadline.Text = (labelName and tostring(labelName)) or "Empty Text"
  3761. labelHeadline.TextColor3 = library.colors.elementText
  3762. colored[1 + #colored] = {labelHeadline, "TextColor3", "elementText"}
  3763. labelHeadline.TextSize = 14
  3764. labelHeadline.TextXAlignment = Enum.TextXAlignment.Left
  3765. labelPositioner.Name = "labelPositioner"
  3766. labelPositioner.Parent = newLabel
  3767. labelPositioner.BackgroundColor3 = Color3.new(1, 1, 1)
  3768. labelPositioner.BackgroundTransparency = 1
  3769. labelPositioner.Position = UDim2.new(0.00448430516)
  3770. labelPositioner.Size = UDim2.fromOffset(214, 19)
  3771. sectionFunctions:Update()
  3772. local function set(t, str)
  3773. if nil == str and t ~= nil then
  3774. str = t
  3775. end
  3776. labelHeadline.Text = (nil ~= str and tostring(str)) or "Empty Text"
  3777. return str
  3778. end
  3779. local default = labelHeadline.Text
  3780. local objectdata = {
  3781. Options = options,
  3782. Name = flag,
  3783. Flag = flag,
  3784. Type = "Label",
  3785. Default = default,
  3786. Parent = sectionFunctions,
  3787. Instance = labelHeadline,
  3788. Get = function()
  3789. return labelHeadline.Text, labelHeadline
  3790. end,
  3791. Set = set,
  3792. SetText = set,
  3793. Remove = function()
  3794. if newLabel then
  3795. newLabel.Parent = nil
  3796. sectionFunctions:Update()
  3797. end
  3798. end,
  3799. RawSet = set,
  3800. Update = function()
  3801. return labelHeadline.Text
  3802. end,
  3803. Reset = function()
  3804. return set(nil, default)
  3805. end
  3806. }
  3807. tabFunctions.Flags[flag], sectionFunctions.Flags[flag], elements[flag] = objectdata, objectdata, objectdata
  3808. return objectdata
  3809. end
  3810. sectionFunctions.NewLabel = sectionFunctions.AddLabel
  3811. sectionFunctions.CreateLabel = sectionFunctions.AddLabel
  3812. sectionFunctions.Label = sectionFunctions.AddLabel
  3813. sectionFunctions.Text = sectionFunctions.AddLabel
  3814. function sectionFunctions:AddSlider(options, ...)
  3815. options = (options and type(options) == "string" and resolvevararg("Slider", options, ...)) or options
  3816. local sliderName, maxValue, minValue, presetValue, callback, flagName = assert(options.Name, "Missing Name for new slider."), assert(options.Max, "Missing Max for new slider."), assert(options.Min, "Missing Min for new slider."), options.Value, options.Callback, options.Flag or (function()
  3817. library.unnamedsliders = 1 + (library.unnamedsliders or 0)
  3818. return "Slider" .. tostring(library.unnamedsliders)
  3819. end)()
  3820. if elements[flagName] ~= nil then
  3821. warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
  3822. end
  3823. local decimalprecision = tonumber(options.Decimals or options.Precision or options.Precise)
  3824. if not decimalprecision and options.Max - options.Min <= 1 then
  3825. decimalprecision = 1
  3826. end
  3827. if decimalprecision then
  3828. decimalprecision = math.clamp(decimalprecision, 0, 99)
  3829. if decimalprecision <= 0 then
  3830. decimalprecision = nil
  3831. end
  3832. decimalprecision = tostring(decimalprecision)
  3833. end
  3834. local formattyp = options.Format and type(options.Format)
  3835. local function resolvedisplay(val, was)
  3836. local str = nil
  3837. if decimalprecision then
  3838. str = string.format("%0." .. decimalprecision .. "f", val)
  3839. end
  3840. str = str or tostring(val)
  3841. if formattyp == "string" then
  3842. return string.format(options.Format, val)
  3843. elseif formattyp == "function" then
  3844. local oof, g = pcall(options.Format, val, was)
  3845. if not oof or not g then
  3846. warn("Your format function for", sliderName, "Slider:", flagName, "has returned nothing. It should return a string to display.", debug.traceback(""))
  3847. return "Format Function Errored"
  3848. end
  3849. return tostring(g)
  3850. end
  3851. return (sliderName or "???") .. ": " .. str
  3852. end
  3853. local usetextbox = options.Textbox or options.InputBox or options.CustomInput
  3854. local newSlider = Instance_new("Frame")
  3855. local slider = Instance_new("ImageLabel")
  3856. local sliderInner = Instance_new("ImageLabel")
  3857. local sliderColored = Instance_new("ImageLabel")
  3858. local sliderHeadline = Instance_new("TextLabel")
  3859. local startingValue = presetValue or minValue
  3860. local sliderDragging = false
  3861. newSlider.Name = "newSlider"
  3862. newSlider.Parent = sectionHolder
  3863. newSlider.BackgroundColor3 = Color3.new(1, 1, 1)
  3864. newSlider.BackgroundTransparency = 1
  3865. newSlider.Size = UDim2.new(1, 0, 0, 42)
  3866. slider.Name = "slider"
  3867. slider.Parent = newSlider
  3868. slider.Active = true
  3869. slider.BackgroundColor3 = library.colors.topGradient
  3870. local colored_slider_BackgroundColor3 = {slider, "BackgroundColor3", "topGradient"}
  3871. colored[1 + #colored] = colored_slider_BackgroundColor3
  3872. slider.BorderColor3 = library.colors.elementBorder
  3873. colored[1 + #colored] = {slider, "BorderColor3", "elementBorder"}
  3874. slider.Position = UDim2.fromScale(0.031, 0.48)
  3875. slider.Selectable = true
  3876. slider.Size = (usetextbox and UDim2.fromOffset(156, 18)) or UDim2.fromOffset(206, 18)
  3877. slider.Image = "rbxassetid://2454009026"
  3878. slider.ImageColor3 = library.colors.bottomGradient
  3879. local colored_slider_ImageColor3 = {slider, "ImageColor3", "bottomGradient"}
  3880. colored[1 + #colored] = colored_slider_ImageColor3
  3881. sliderInner.Name = "sliderInner"
  3882. sliderInner.Parent = slider
  3883. sliderInner.Active = true
  3884. sliderInner.AnchorPoint = Vector2.new(0.5, 0.5)
  3885. sliderInner.BackgroundColor3 = library.colors.topGradient
  3886. colored[1 + #colored] = {sliderInner, "BackgroundColor3", "topGradient"}
  3887. sliderInner.BorderColor3 = library.colors.elementBorder
  3888. colored[1 + #colored] = {sliderInner, "BorderColor3", "elementBorder"}
  3889. sliderInner.Position = UDim2.fromScale(0.5, 0.5)
  3890. sliderInner.Selectable = true
  3891. sliderInner.Size = UDim2.new(1, -4, 1, -4)
  3892. sliderInner.Image = "rbxassetid://2454009026"
  3893. sliderInner.ImageColor3 = library.colors.bottomGradient
  3894. colored[1 + #colored] = {sliderInner, "ImageColor3", "bottomGradient"}
  3895. sliderColored.Name = "sliderColored"
  3896. sliderColored.Parent = sliderInner
  3897. sliderColored.Active = true
  3898. sliderColored.BackgroundColor3 = darkenColor(library.colors.main, 1.5)
  3899. colored[1 + #colored] = {sliderColored, "BackgroundColor3", "main", 1.5}
  3900. sliderColored.BorderSizePixel = 0
  3901. sliderColored.Selectable = true
  3902. sliderColored.Size = UDim2.fromScale(((startingValue or minValue) - minValue) / (maxValue - minValue), 1)
  3903. sliderColored.Image = "rbxassetid://2454009026"
  3904. sliderColored.ImageColor3 = darkenColor(library.colors.main, 2.5)
  3905. colored[1 + #colored] = {sliderColored, "ImageColor3", "main", 2.5}
  3906. sliderHeadline.Name = "sliderHeadline"
  3907. sliderHeadline.Parent = newSlider
  3908. sliderHeadline.Active = true
  3909. sliderHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
  3910. sliderHeadline.BackgroundTransparency = 1
  3911. sliderHeadline.Position = UDim2.new(0.031)
  3912. sliderHeadline.Selectable = true
  3913. sliderHeadline.Size = UDim2.fromOffset(206, 20)
  3914. sliderHeadline.ZIndex = 5
  3915. sliderHeadline.Font = Enum.Font.Code
  3916. sliderHeadline.LineHeight = 1.15
  3917. sliderHeadline.Text = resolvedisplay(startingValue)
  3918. sliderHeadline.TextColor3 = library.colors.elementText
  3919. colored[1 + #colored] = {sliderHeadline, "TextColor3", "elementText"}
  3920. sliderHeadline.TextSize = 14
  3921. sliderHeadline.TextXAlignment = Enum.TextXAlignment.Left
  3922. local realTextbox = nil
  3923. local function Set(t, newValue)
  3924. if nil == newValue and t ~= nil then
  3925. newValue = t
  3926. end
  3927. minValue, maxValue = options.Min, options.Max
  3928. if newValue and (options.IllegalInput or ((not minValue or newValue >= minValue) and (not maxValue or newValue <= maxValue))) then
  3929. local last_val = library_flags[flagName]
  3930. library_flags[flagName] = newValue
  3931. if options.Location then
  3932. options.Location[options.LocationFlag or flagName] = newValue
  3933. end
  3934. do
  3935. local newValue = (options.IllegalInput and math.clamp(newValue, minValue or -math.huge, maxValue or math.huge)) or newValue
  3936. tweenService:Create(sliderColored, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  3937. Size = UDim2.fromScale(((newValue or minValue) - minValue) / (maxValue - minValue), 1)
  3938. }):Play()
  3939. end
  3940. sliderHeadline.Text = resolvedisplay(newValue, last_val)
  3941. if usetextbox and realTextbox then
  3942. realTextbox.Text = tostring(newValue)
  3943. end
  3944. if callback and (last_val ~= newValue or options.AllowDuplicateCalls) then
  3945. task.spawn(callback, newValue, last_val)
  3946. end
  3947. end
  3948. return newValue
  3949. end
  3950. if presetValue ~= nil then
  3951. Set(presetValue)
  3952. else
  3953. library_flags[flagName] = startingValue
  3954. if options.Location then
  3955. options.Location[options.LocationFlag or flagName] = startingValue
  3956. end
  3957. end
  3958. if usetextbox then
  3959. if type(usetextbox) ~= "table" then
  3960. usetextbox = options
  3961. end
  3962. local textbox = Instance_new("ImageLabel")
  3963. local textboxInner = Instance_new("ImageLabel")
  3964. realTextbox = Instance_new("TextBox")
  3965. textbox.Name = "textbox"
  3966. textbox.Parent = newSlider
  3967. textbox.Active = true
  3968. textbox.BackgroundColor3 = library.colors.topGradient
  3969. local colored_textbox_BackgroundColor3 = {textbox, "BackgroundColor3", "topGradient"}
  3970. colored[1 + #colored] = colored_textbox_BackgroundColor3
  3971. textbox.BorderColor3 = library.colors.elementBorder
  3972. colored[1 + #colored] = {textbox, "BorderColor3", "elementBorder"}
  3973. textbox.Position = UDim2.new(1, -54, 0.48)
  3974. textbox.Selectable = true
  3975. textbox.Size = UDim2.fromOffset(43, 18)
  3976. textbox.Image = "rbxassetid://2454009026"
  3977. textbox.ImageColor3 = library.colors.bottomGradient
  3978. local colored_textbox_ImageColor3 = {textbox, "ImageColor3", "bottomGradient"}
  3979. colored[1 + #colored] = colored_textbox_ImageColor3
  3980. textboxInner.Name = "textboxInner"
  3981. textboxInner.Parent = textbox
  3982. textboxInner.Active = true
  3983. textboxInner.AnchorPoint = Vector2.new(0.5, 0.5)
  3984. textboxInner.BackgroundColor3 = library.colors.topGradient
  3985. colored[1 + #colored] = {textboxInner, "BackgroundColor3", "topGradient"}
  3986. textboxInner.BorderColor3 = library.colors.elementBorder
  3987. colored[1 + #colored] = {textboxInner, "BorderColor3", "elementBorder"}
  3988. textboxInner.Position = UDim2.fromScale(0.5, 0.5)
  3989. textboxInner.Selectable = true
  3990. textboxInner.Size = UDim2.new(1, -4, 1, -4)
  3991. textboxInner.Image = "rbxassetid://2454009026"
  3992. textboxInner.ImageColor3 = library.colors.bottomGradient
  3993. colored[1 + #colored] = {textboxInner, "ImageColor3", "bottomGradient"}
  3994. realTextbox.Name = "realTextbox"
  3995. realTextbox.Parent = textbox
  3996. realTextbox.BackgroundColor3 = Color3.new(1, 1, 1)
  3997. realTextbox.BackgroundTransparency = 1
  3998. realTextbox.Position = UDim2.new(0.0295485705)
  3999. realTextbox.Size = UDim2.fromScale(0.97, 1)
  4000. realTextbox.ZIndex = 5
  4001. realTextbox.ClearTextOnFocus = false
  4002. realTextbox.Font = Enum.Font.Code
  4003. realTextbox.LineHeight = 1.15
  4004. realTextbox.Text = tostring(presetValue)
  4005. realTextbox.TextColor3 = library.colors.otherElementText
  4006. colored[1 + #colored] = {realTextbox, "TextColor3", "otherElementText"}
  4007. realTextbox.TextSize = 14
  4008. realTextbox.PlaceholderText = (presetValue ~= nil and tostring(presetValue)) or ""
  4009. library.signals[1 + #library.signals] = realTextbox.FocusLost:Connect(function()
  4010. local val = realTextbox.Text
  4011. if usetextbox.PreFormat then
  4012. local typ = type(usetextbox.PreFormat)
  4013. if typ == "function" then
  4014. local x, e = pcall(usetextbox.PreFormat, val)
  4015. if not x and e then
  4016. warn("Error in Pre-Format (Textbox " .. flagName .. "):", e)
  4017. else
  4018. val = e
  4019. end
  4020. end
  4021. end
  4022. val = (not usetextbox.Hex and not usetextbox.Binary and not usetextbox.Base and (tonumber(val) or tonumber(val:gsub("%D", ""), 10) or 0)) or tonumber(val, (usetextbox.Hex and 16) or (usetextbox.Binary and 2) or usetextbox.Base or 10) or 0
  4023. if not options.IllegalInput and (options.Max or options.Min) then
  4024. val = math.clamp(val, options.Min or -math.huge, options.Max or math.huge)
  4025. end
  4026. local decimalprecision = tonumber(options.Decimals or options.Precision or options.Precise)
  4027. if decimalprecision then
  4028. val = tonumber(string.format("%0." .. tostring(decimalprecision) .. "f", val))
  4029. end
  4030. if usetextbox.PostFormat then
  4031. local typ = type(usetextbox.PostFormat)
  4032. if typ == "function" then
  4033. local x, e = pcall(usetextbox.PostFormat, val)
  4034. if not x and e then
  4035. warn("Error in Post-Format (Textbox " .. flagName .. "):", e)
  4036. else
  4037. val = e
  4038. end
  4039. end
  4040. end
  4041. Set((val and tonumber(val)) or presetValue or 0)
  4042. end)
  4043. library.signals[1 + #library.signals] = textbox.MouseEnter:Connect(function()
  4044. colored_textbox_BackgroundColor3[3] = "main"
  4045. colored_textbox_BackgroundColor3[4] = 1.5
  4046. colored_textbox_ImageColor3[3] = "main"
  4047. colored_textbox_ImageColor3[4] = 2.5
  4048. tweenService:Create(textbox, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  4049. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  4050. ImageColor3 = darkenColor(library.colors.main, 2.5)
  4051. }):Play()
  4052. end)
  4053. library.signals[1 + #library.signals] = textbox.MouseLeave:Connect(function()
  4054. colored_textbox_BackgroundColor3[3] = "topGradient"
  4055. colored_textbox_BackgroundColor3[4] = nil
  4056. colored_textbox_ImageColor3[3] = "bottomGradient"
  4057. colored_textbox_ImageColor3[4] = nil
  4058. tweenService:Create(textbox, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  4059. BackgroundColor3 = library.colors.topGradient,
  4060. ImageColor3 = library.colors.bottomGradient
  4061. }):Play()
  4062. end)
  4063. end
  4064. sectionFunctions:Update()
  4065. library.signals[1 + #library.signals] = slider.MouseEnter:Connect(function()
  4066. colored_slider_BackgroundColor3[3] = "main"
  4067. colored_slider_BackgroundColor3[4] = 1.5
  4068. colored_slider_ImageColor3[3] = "main"
  4069. colored_slider_ImageColor3[4] = 2.5
  4070. tweenService:Create(slider, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  4071. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  4072. ImageColor3 = darkenColor(library.colors.main, 2.5)
  4073. }):Play()
  4074. end)
  4075. library.signals[1 + #library.signals] = slider.MouseLeave:Connect(function()
  4076. colored_slider_BackgroundColor3[3] = "topGradient"
  4077. colored_slider_BackgroundColor3[4] = nil
  4078. colored_slider_ImageColor3[3] = "bottomGradient"
  4079. colored_slider_ImageColor3[4] = nil
  4080. tweenService:Create(slider, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  4081. BackgroundColor3 = library.colors.topGradient,
  4082. ImageColor3 = library.colors.bottomGradient
  4083. }):Play()
  4084. end)
  4085. local function sliding(input, sb, sc)
  4086. local last_val = library_flags[flagName]
  4087. local pos = UDim2.fromScale(math.clamp((input.Position.X - sb.AbsolutePosition.X) / sb.AbsoluteSize.X, 0, 1), 1)
  4088. tweenService:Create(sc, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  4089. Size = pos
  4090. }):Play()
  4091. local sliderValue = nil
  4092. if decimalprecision then
  4093. sliderValue = tonumber(string.format("%0." .. decimalprecision .. "f", ((pos.X.Scale * maxValue) / maxValue) * (maxValue - minValue) + minValue))
  4094. end
  4095. sliderValue = sliderValue or tonumber(string.format("%0.2f", (floor(((pos.X.Scale * maxValue) / maxValue) * (maxValue - minValue) + minValue))))
  4096. library_flags[flagName] = sliderValue
  4097. if options.Location then
  4098. options.Location[options.LocationFlag or flagName] = sliderValue
  4099. end
  4100. sliderHeadline.Text = resolvedisplay(sliderValue, last_val)
  4101. if usetextbox and realTextbox then
  4102. realTextbox.Text = tostring(sliderValue)
  4103. end
  4104. if callback and last_val ~= sliderValue then
  4105. task.spawn(callback, sliderValue, last_val)
  4106. end
  4107. last_val = sliderValue
  4108. end
  4109. library.signals[1 + #library.signals] = newSlider.InputBegan:Connect(function(input)
  4110. if not library.colorpicker and input.UserInputType == Enum.UserInputType.MouseButton1 then
  4111. sliderDragging = true
  4112. isDraggingSomething = true
  4113. end
  4114. end)
  4115. library.signals[1 + #library.signals] = newSlider.InputEnded:Connect(function(input)
  4116. if not library.colorpicker and input.UserInputType == Enum.UserInputType.MouseButton1 then
  4117. sliderDragging = false
  4118. isDraggingSomething = false
  4119. end
  4120. end)
  4121. library.signals[1 + #library.signals] = newSlider.InputBegan:Connect(function(input)
  4122. if not library.colorpicker and not isDraggingSomething and input.UserInputType == Enum.UserInputType.MouseButton1 then
  4123. isDraggingSomething = true
  4124. sliding(input, sliderInner, sliderColored)
  4125. end
  4126. end)
  4127. library.signals[1 + #library.signals] = userInputService.InputChanged:Connect(function(input)
  4128. if not library.colorpicker and sliderDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  4129. sliding(input, sliderInner, sliderColored)
  4130. end
  4131. end)
  4132. local default = library_flags[flagName]
  4133. local function Update(t, last_val)
  4134. if last_val == nil and t ~= nil and type(t) ~= "table" then
  4135. last_val = t
  4136. end
  4137. sliderName, maxValue, minValue, callback = options.Name or sliderName, options.Max or maxValue, options.Min or minValue, options.Callback
  4138. local newValue = library_flags[flagName]
  4139. do
  4140. local newValue = math.clamp(newValue, options.Min or -math.huge, options.Max or math.huge)
  4141. tweenService:Create(sliderColored, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  4142. Size = UDim2.fromScale(((newValue or minValue) - minValue) / (maxValue - minValue), 1)
  4143. }):Play()
  4144. end
  4145. sliderHeadline.Text = resolvedisplay(newValue, last_val)
  4146. if usetextbox and realTextbox then
  4147. realTextbox.Text = tostring(newValue)
  4148. end
  4149. return newValue
  4150. end
  4151. local objectdata = {
  4152. Options = options,
  4153. Name = flagName,
  4154. Flag = flagName,
  4155. Type = "Slider",
  4156. Default = default,
  4157. Parent = sectionFunctions,
  4158. Instance = sliderHeadline,
  4159. Set = Set,
  4160. Get = function()
  4161. return library_flags[flagName]
  4162. end,
  4163. SetConstraints = function(t, min, max)
  4164. if t and type(t) ~= "table" then
  4165. min, max = t, min
  4166. end
  4167. if min then
  4168. options.Min = min
  4169. end
  4170. if max then
  4171. options.Max = max
  4172. end
  4173. Update()
  4174. end,
  4175. SetMin = function(t, min)
  4176. if min == nil and t ~= nil then
  4177. min = t
  4178. end
  4179. if min and min ~= options.Min then
  4180. options.Min = min
  4181. Update()
  4182. end
  4183. end,
  4184. SetMax = function(t, max)
  4185. if max == nil and t ~= nil then
  4186. max = t
  4187. end
  4188. if max and max ~= options.Max then
  4189. options.Max = max
  4190. Update()
  4191. end
  4192. end,
  4193. Update = Update,
  4194. Remove = function()
  4195. if newSlider then
  4196. newSlider.Parent = nil
  4197. sectionFunctions:Update()
  4198. end
  4199. end,
  4200. RawSet = function(t, newValue)
  4201. if nil == newValue and t ~= nil then
  4202. newValue = t
  4203. end
  4204. local last_val = library_flags[flagName]
  4205. library_flags[flagName] = newValue
  4206. if options.Location then
  4207. options.Location[options.LocationFlag or flagName] = newValue
  4208. end
  4209. Update(nil, last_val)
  4210. end,
  4211. Reset = function()
  4212. return Set(nil, default)
  4213. end
  4214. }
  4215. tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
  4216. return objectdata
  4217. end
  4218. sectionFunctions.NewSlider = sectionFunctions.AddSlider
  4219. sectionFunctions.CreateSlider = sectionFunctions.AddSlider
  4220. sectionFunctions.NumberConstraint = sectionFunctions.AddSlider
  4221. sectionFunctions.Slider = sectionFunctions.AddSlider
  4222. sectionFunctions.Slide = sectionFunctions.AddSlider
  4223. function sectionFunctions:AddSearchBox(options, ...)
  4224. options = (options and (type(options) == "string") and resolvevararg("SearchBox", options, ...)) or options
  4225. local dropdownName, listt, val, callback, flagName = assert(options.Name, "Missing Name for new searchbox."), assert(options.List, "Missing List for new searchbox."), options.Value, options.Callback, options.Flag or (function()
  4226. library.unnamedsearchbox = 1 + (library.unnamedsearchbox or 0)
  4227. return "SearchBox" .. tostring(library.unnamedsearchbox)
  4228. end)()
  4229. if elements[flagName] ~= nil then
  4230. warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
  4231. end
  4232. local newDropdown = Instance_new("Frame")
  4233. local dropdown = Instance_new("ImageLabel")
  4234. local dropdownInner = Instance_new("ImageLabel")
  4235. local dropdownToggle = Instance_new("ImageButton")
  4236. local dropdownSelection = Instance_new("TextBox")
  4237. local dropdownHeadline = Instance_new("TextLabel")
  4238. local dropdownHolderFrame = Instance_new("ImageLabel")
  4239. local dropdownHolderInner = Instance_new("ImageLabel")
  4240. local realDropdownHolder = Instance_new("ScrollingFrame")
  4241. local realDropdownHolderList = Instance_new("UIListLayout")
  4242. local dropdownEnabled = false
  4243. local resolvelist = getresolver(listt, options.Filter)
  4244. local list = resolvelist()
  4245. if next(list) then
  4246. else
  4247. local EmptyVal = options.EmptyValue
  4248. if EmptyVal ~= nil then
  4249. table.insert(list, 1, EmptyVal)
  4250. end
  4251. end
  4252. local multiselect = options.MultiSelect or options.Multi or options.Multiple
  4253. local passed_multiselect = multiselect and type(multiselect)
  4254. local blankstring = not multiselect and (options.BlankValue or options.NoValueString or options.Nothing)
  4255. local selectedOption = val or list[1] or blankstring
  4256. local addcallback = options.ItemAdded or options.AddedCallback
  4257. local delcallback = options.ItemRemoved or options.RemovedCallback
  4258. local clrcallback = options.ItemsCleared or options.ClearedCallback
  4259. local modcallback = options.ItemChanged or options.ChangedCallback
  4260. if blankstring and val == nil then
  4261. val = blankstring
  4262. end
  4263. if val ~= nil then
  4264. selectedOption = val
  4265. end
  4266. if multiselect and (not selectedOption or type(selectedOption) ~= "table") then
  4267. selectedOption = {}
  4268. end
  4269. local selectedObjects = {}
  4270. local optionCount = 0
  4271. newDropdown.Name = "newDropdown"
  4272. newDropdown.Parent = sectionHolder
  4273. newDropdown.BackgroundColor3 = Color3.new(1, 1, 1)
  4274. newDropdown.BackgroundTransparency = 1
  4275. newDropdown.Size = UDim2.new(1, 0, 0, 42)
  4276. dropdown.Name = "dropdown"
  4277. dropdown.Parent = newDropdown
  4278. dropdown.Active = true
  4279. dropdown.BackgroundColor3 = library.colors.topGradient
  4280. local colored_dropdown_BackgroundColor3 = {dropdown, "BackgroundColor3", "topGradient"}
  4281. colored[1 + #colored] = colored_dropdown_BackgroundColor3
  4282. dropdown.BorderColor3 = library.colors.elementBorder
  4283. colored[1 + #colored] = {dropdown, "BorderColor3", "elementBorder"}
  4284. dropdown.Position = UDim2.fromScale(0.027, 0.45)
  4285. dropdown.Selectable = true
  4286. dropdown.Size = UDim2.fromOffset(206, 18)
  4287. dropdown.Image = "rbxassetid://2454009026"
  4288. dropdown.ImageColor3 = library.colors.bottomGradient
  4289. local colored_dropdown_ImageColor3 = {dropdown, "ImageColor3", "bottomGradient"}
  4290. colored[1 + #colored] = colored_dropdown_ImageColor3
  4291. dropdownInner.Name = "dropdownInner"
  4292. dropdownInner.Parent = dropdown
  4293. dropdownInner.Active = true
  4294. dropdownInner.AnchorPoint = Vector2.new(0.5, 0.5)
  4295. dropdownInner.BackgroundColor3 = library.colors.topGradient
  4296. colored[1 + #colored] = {dropdownInner, "BackgroundColor3", "topGradient"}
  4297. dropdownInner.BorderColor3 = library.colors.elementBorder
  4298. colored[1 + #colored] = {dropdownInner, "BorderColor3", "elementBorder"}
  4299. dropdownInner.Position = UDim2.fromScale(0.5, 0.5)
  4300. dropdownInner.Selectable = true
  4301. dropdownInner.Size = UDim2.new(1, -4, 1, -4)
  4302. dropdownInner.Image = "rbxassetid://2454009026"
  4303. dropdownInner.ImageColor3 = library.colors.bottomGradient
  4304. colored[1 + #colored] = {dropdownInner, "ImageColor3", "bottomGradient"}
  4305. dropdownToggle.Name = "dropdownToggle"
  4306. dropdownToggle.Parent = dropdown
  4307. dropdownToggle.BackgroundColor3 = Color3.new(1, 1, 1)
  4308. dropdownToggle.BackgroundTransparency = 1
  4309. dropdownToggle.Position = UDim2.fromScale(0.9, 0.17)
  4310. dropdownToggle.Rotation = 90
  4311. dropdownToggle.Size = UDim2.fromOffset(12, 12)
  4312. dropdownToggle.ZIndex = 6
  4313. dropdownToggle.Image = "rbxassetid://71659683"
  4314. dropdownToggle.ImageColor3 = Color3.fromRGB(171, 171, 171)
  4315. dropdownSelection.Name = "dropdownSelection"
  4316. dropdownSelection.Parent = dropdown
  4317. dropdownSelection.BackgroundColor3 = Color3.new(1, 1, 1)
  4318. dropdownSelection.BackgroundTransparency = 1
  4319. dropdownSelection.Position = UDim2.new(0.0295485705)
  4320. dropdownSelection.Size = UDim2.fromScale(0.85, 1)
  4321. dropdownSelection.ZIndex = 5
  4322. dropdownSelection.Font = Enum.Font.Code
  4323. dropdownSelection.LineHeight = 1.15
  4324. dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or tostring((multiselect and (blankstring or "Select Item(s)")) or (selectedOption and tostring(selectedOption)) or blankstring or "No Blank String")
  4325. dropdownSelection.TextColor3 = library.colors.otherElementText
  4326. colored[1 + #colored] = {dropdownSelection, "TextColor3", "otherElementText"}
  4327. dropdownSelection.TextSize = 14
  4328. dropdownSelection.TextXAlignment = Enum.TextXAlignment.Left
  4329. dropdownSelection.ClearTextOnFocus = true
  4330. dropdownHeadline.Name = "dropdownHeadline"
  4331. dropdownHeadline.Parent = newDropdown
  4332. dropdownHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
  4333. dropdownHeadline.BackgroundTransparency = 1
  4334. dropdownHeadline.Position = UDim2.fromScale(0.034, 0.03)
  4335. dropdownHeadline.Size = UDim2.fromOffset(167, 11)
  4336. dropdownHeadline.Font = Enum.Font.Code
  4337. dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
  4338. dropdownHeadline.TextColor3 = library.colors.elementText
  4339. colored[1 + #colored] = {dropdownHeadline, "TextColor3", "elementText"}
  4340. dropdownHeadline.TextSize = 14
  4341. dropdownHeadline.TextXAlignment = Enum.TextXAlignment.Left
  4342. dropdownHolderFrame.Name = "dropdownHolderFrame"
  4343. dropdownHolderFrame.Parent = newDropdown
  4344. dropdownHolderFrame.Active = true
  4345. dropdownHolderFrame.BackgroundColor3 = library.colors.topGradient
  4346. colored[1 + #colored] = {dropdownHolderFrame, "BackgroundColor3", "topGradient"}
  4347. dropdownHolderFrame.BorderColor3 = library.colors.elementBorder
  4348. colored[1 + #colored] = {dropdownHolderFrame, "BorderColor3", "elementBorder"}
  4349. dropdownHolderFrame.Position = UDim2.fromScale(0.025, 1.012)
  4350. dropdownHolderFrame.Selectable = true
  4351. dropdownHolderFrame.Size = UDim2.fromOffset(206, 22)
  4352. dropdownHolderFrame.Visible = false
  4353. dropdownHolderFrame.Image = "rbxassetid://2454009026"
  4354. dropdownHolderFrame.ImageColor3 = library.colors.bottomGradient
  4355. colored[1 + #colored] = {dropdownHolderFrame, "ImageColor3", "bottomGradient"}
  4356. dropdownHolderInner.Name = "dropdownHolderInner"
  4357. dropdownHolderInner.Parent = dropdownHolderFrame
  4358. dropdownHolderInner.Active = true
  4359. dropdownHolderInner.AnchorPoint = Vector2.new(0.5, 0.5)
  4360. dropdownHolderInner.BackgroundColor3 = library.colors.topGradient
  4361. colored[1 + #colored] = {dropdownHolderInner, "BackgroundColor3", "topGradient"}
  4362. dropdownHolderInner.BorderColor3 = library.colors.elementBorder
  4363. dropdownHolderInner.Position = UDim2.fromScale(0.5, 0.5)
  4364. dropdownHolderInner.Selectable = true
  4365. dropdownHolderInner.Size = UDim2.new(1, -4, 1, -4)
  4366. dropdownHolderInner.Image = "rbxassetid://2454009026"
  4367. dropdownHolderInner.ImageColor3 = library.colors.bottomGradient
  4368. colored[1 + #colored] = {dropdownHolderInner, "ImageColor3", "bottomGradient"}
  4369. realDropdownHolder.Name = "realDropdownHolder"
  4370. realDropdownHolder.Parent = dropdownHolderInner
  4371. realDropdownHolder.BackgroundColor3 = Color3.new(1, 1, 1)
  4372. realDropdownHolder.BackgroundTransparency = 1
  4373. realDropdownHolder.Selectable = false
  4374. realDropdownHolder.Size = UDim2.fromScale(1, 1)
  4375. realDropdownHolder.CanvasSize = UDim2.new()
  4376. realDropdownHolder.ScrollBarThickness = 5
  4377. realDropdownHolder.ScrollingDirection = Enum.ScrollingDirection.Y
  4378. realDropdownHolder.AutomaticCanvasSize = Enum.AutomaticSize.Y
  4379. realDropdownHolder.ScrollBarImageTransparency = 0.5
  4380. realDropdownHolder.ScrollBarImageColor3 = library.colors.section
  4381. colored[1 + #colored] = {realDropdownHolder, "ScrollBarImageColor3", "section"}
  4382. realDropdownHolderList.Name = "realDropdownHolderList"
  4383. realDropdownHolderList.Parent = realDropdownHolder
  4384. realDropdownHolderList.HorizontalAlignment = Enum.HorizontalAlignment.Center
  4385. realDropdownHolderList.SortOrder = Enum.SortOrder.LayoutOrder
  4386. sectionFunctions:Update()
  4387. local restorezindex = {}
  4388. library.signals[1 + #library.signals] = newDropdown.MouseEnter:Connect(function()
  4389. colored_dropdown_BackgroundColor3[3] = "main"
  4390. colored_dropdown_BackgroundColor3[4] = 1.5
  4391. colored_dropdown_ImageColor3[3] = "main"
  4392. colored_dropdown_ImageColor3[4] = 2.5
  4393. tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  4394. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  4395. ImageColor3 = darkenColor(library.colors.main, 2.5)
  4396. }):Play()
  4397. end)
  4398. library.signals[1 + #library.signals] = newDropdown.MouseLeave:Connect(function()
  4399. if not dropdownEnabled then
  4400. colored_dropdown_BackgroundColor3[3] = "topGradient"
  4401. colored_dropdown_BackgroundColor3[4] = nil
  4402. colored_dropdown_ImageColor3[3] = "bottomGradient"
  4403. colored_dropdown_ImageColor3[4] = nil
  4404. tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  4405. BackgroundColor3 = library.colors.topGradient,
  4406. ImageColor3 = library.colors.bottomGradient
  4407. }):Play()
  4408. end
  4409. end)
  4410. local function UpdateDropdownHolder()
  4411. if optionCount >= 6 then
  4412. realDropdownHolder.CanvasSize = UDim2:fromOffset(realDropdownHolderList.AbsoluteContentSize.Y + 2)
  4413. elseif optionCount <= 5 then
  4414. dropdownHolderFrame.Size = UDim2.fromOffset(206, realDropdownHolderList.AbsoluteContentSize.Y + 4)
  4415. end
  4416. end
  4417. local validate = nil
  4418. local SetupValidation = nil
  4419. do
  4420. local Signals = {}
  4421. local Setup = nil
  4422. function SetupValidation()
  4423. for k, v in next, Signals do
  4424. v = v and v:Disconnect()
  4425. Signals[k] = nil
  4426. end
  4427. if options.AutoValidate and list and (typeof(list) == "Instance") then
  4428. local Val = library_flags[flagName] or selectedOption
  4429. if multiselect then
  4430. for _, v in next, Val do
  4431. Setup(v)
  4432. end
  4433. else
  4434. Setup(Val)
  4435. end
  4436. end
  4437. end
  4438. local gpcs = game.GetPropertyChangedSignal
  4439. function Setup(v)
  4440. if typeof(v) == "Instance" then
  4441. local Signal = nil
  4442. Signal = gpcs(v, "Parent"):Connect(function()
  4443. if options.AutoValidate then
  4444. if list and (v.Parent ~= list) then
  4445. Signal = (Signal and Signal:Disconnect() and nil) or nil
  4446. validate()
  4447. end
  4448. else
  4449. for k, v in next, Signals do
  4450. v = v and v:Disconnect()
  4451. Signals[k] = nil
  4452. end
  4453. end
  4454. end)
  4455. end
  4456. end
  4457. end
  4458. local function AddOptions(optionsTable, filter)
  4459. if options.Sort then
  4460. local didstuff, dosort = nil, options.Sort
  4461. if type(dosort) == "function" then
  4462. local g, h = pcall(table.sort, optionsTable, dosort)
  4463. if g then
  4464. didstuff = true
  4465. elseif h then
  4466. warn("Error sorting list:", h, debug.traceback(""))
  4467. end
  4468. end
  4469. if not didstuff then
  4470. table.sort(optionsTable, library.defaultSort)
  4471. end
  4472. end
  4473. if blankstring and (optionsTable[1] ~= blankstring or table.find(optionsTable, blankstring, 2)) then
  4474. local exists = table.find(optionsTable, blankstring)
  4475. if exists then
  4476. for _ = 1, 35 do
  4477. table.remove(optionsTable, exists)
  4478. exists = table.find(optionsTable, blankstring)
  4479. if not exists then
  4480. break
  4481. end
  4482. end
  4483. end
  4484. table.insert(optionsTable, 1, blankstring)
  4485. end
  4486. optionCount = 0
  4487. realDropdownHolderList.Parent = nil
  4488. realDropdownHolder:ClearAllChildren()
  4489. realDropdownHolderList.Parent = realDropdownHolder
  4490. for _, v in next, optionsTable do
  4491. if not filter or tostring(v):lower():find(dropdownSelection.Text:lower(), 1, not options.RegEx) then
  4492. optionCount = optionCount + 1
  4493. UpdateDropdownHolder()
  4494. local newOption = Instance_new("ImageLabel")
  4495. local optionButton = Instance_new("TextButton")
  4496. if selectedOption == v then
  4497. selectedObjects[1] = newOption
  4498. selectedObjects[2] = optionButton
  4499. end
  4500. newOption.Name = "Frame"
  4501. newOption.Parent = realDropdownHolder
  4502. local togged = (not multiselect and selectedOption == v) or (multiselect and table.find(selectedOption, v))
  4503. newOption.BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient
  4504. newOption.BorderSizePixel = 0
  4505. newOption.Size = UDim2.fromOffset(202, 18)
  4506. newOption.Image = "rbxassetid://2454009026"
  4507. newOption.ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
  4508. local stringed = tostring(v)
  4509. optionButton.Name = stringed
  4510. optionButton.Parent = newOption
  4511. optionButton.Active = true
  4512. optionButton.AnchorPoint = Vector2.new(0.5, 0.5)
  4513. optionButton.BackgroundColor3 = Color3.new(1, 1, 1)
  4514. optionButton.BackgroundTransparency = 1
  4515. optionButton.Position = UDim2.fromScale(0.5, 0.5)
  4516. optionButton.Selectable = true
  4517. optionButton.Size = UDim2.new(1, -10, 1)
  4518. optionButton.ZIndex = 5
  4519. optionButton.Font = Enum.Font.Code
  4520. optionButton.Text = (togged and (" " .. stringed)) or stringed
  4521. optionButton.TextColor3 = (togged and library.colors.main) or library.colors.otherElementText
  4522. optionButton.TextSize = 14
  4523. optionButton.TextXAlignment = Enum.TextXAlignment.Left
  4524. library.signals[1 + #library.signals] = optionButton[(multiselect and "MouseButton1Click") or "MouseButton1Down"]:Connect(function()
  4525. if not library.colorpicker then
  4526. dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or tostring(blankstring or "Select Item(s)")
  4527. restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
  4528. restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
  4529. restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
  4530. if multiselect then
  4531. local cloned = {unpack(selectedOption)}
  4532. local togged = table.find(selectedOption, v)
  4533. if togged then
  4534. table.remove(selectedOption, togged)
  4535. else
  4536. selectedOption[1 + #selectedOption] = v
  4537. end
  4538. togged = table.find(selectedOption, v)
  4539. optionButton.Text = (togged and (" " .. stringed)) or stringed
  4540. newOption.BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient
  4541. newOption.ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
  4542. optionButton.TextColor3 = (togged and library.colors.main) or library.colors.otherElementText
  4543. if callback then
  4544. task.spawn(callback, selectedOption, cloned)
  4545. end
  4546. if togged then
  4547. if addcallback then
  4548. task.spawn(addcallback, v, selectedOption)
  4549. end
  4550. elseif delcallback then
  4551. task.spawn(delcallback, v, selectedOption)
  4552. end
  4553. if modcallback then
  4554. task.spawn(modcallback, v, togged, selectedOption)
  4555. end
  4556. if #selectedOption == 0 and clrcallback then
  4557. task.spawn(clrcallback, selectedOption, cloned)
  4558. end
  4559. return
  4560. else
  4561. dropdownSelection.Text = stringed
  4562. if selectedOption ~= v then
  4563. local last_v = library_flags[flagName]
  4564. do
  4565. local First = selectedObjects[1]
  4566. if First then
  4567. selectedObjects[1].BackgroundColor3 = library.colors.topGradient
  4568. selectedObjects[1].ImageColor3 = library.colors.bottomGradient
  4569. end
  4570. end
  4571. do
  4572. local Second = selectedObjects[2]
  4573. if Second then
  4574. selectedObjects[2].Text = selectedObjects[2].Name
  4575. selectedObjects[2].TextColor3 = library.colors.otherElementText
  4576. end
  4577. end
  4578. selectedOption = v
  4579. selectedObjects[1] = newOption
  4580. selectedObjects[2] = optionButton
  4581. newOption.BackgroundColor3 = library.colors.selectedOption
  4582. newOption.ImageColor3 = library.colors.unselectedOption
  4583. optionButton.TextColor3 = library.colors.main
  4584. dropdownHolderFrame.Visible = false
  4585. dropdownToggle.Rotation = 90
  4586. dropdownEnabled = false
  4587. newDropdown.ZIndex = 1
  4588. colored_dropdown_BackgroundColor3[3] = "topGradient"
  4589. colored_dropdown_BackgroundColor3[4] = nil
  4590. colored_dropdown_ImageColor3[3] = "bottomGradient"
  4591. colored_dropdown_ImageColor3[4] = nil
  4592. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  4593. BackgroundColor3 = library.colors.topGradient,
  4594. ImageColor3 = library.colors.bottomGradient
  4595. }):Play()
  4596. library_flags[flagName] = selectedOption
  4597. if options.Location then
  4598. options.Location[options.LocationFlag or flagName] = selectedOption
  4599. end
  4600. dropdownSelection.Text = tostring(selectedOption)
  4601. if submenuOpen then
  4602. submenuOpen = nil
  4603. end
  4604. if callback then
  4605. task.spawn(callback, selectedOption, last_v)
  4606. end
  4607. else
  4608. submenuOpen = nil
  4609. dropdownToggle.Rotation = 90
  4610. colored_dropdown_BackgroundColor3[3] = "topGradient"
  4611. colored_dropdown_BackgroundColor3[4] = nil
  4612. colored_dropdown_ImageColor3[3] = "bottomGradient"
  4613. colored_dropdown_ImageColor3[4] = nil
  4614. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  4615. BackgroundColor3 = library.colors.topGradient,
  4616. ImageColor3 = library.colors.bottomGradient
  4617. }):Play()
  4618. dropdownHolderFrame.Visible = false
  4619. end
  4620. end
  4621. for ins, z in next, restorezindex do
  4622. ins.ZIndex = z
  4623. end
  4624. end
  4625. end)
  4626. library.signals[1 + #library.signals] = optionButton.MouseEnter:Connect(function()
  4627. tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  4628. BackgroundColor3 = library.colors.hoveredOptionTop,
  4629. ImageColor3 = library.colors.hoveredOptionBottom
  4630. }):Play()
  4631. end)
  4632. library.signals[1 + #library.signals] = optionButton.MouseLeave:Connect(function()
  4633. local togged = (not multiselect and selectedOption == v) or (multiselect and table.find(selectedOption, v))
  4634. tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  4635. BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient,
  4636. ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
  4637. }):Play()
  4638. end)
  4639. UpdateDropdownHolder()
  4640. end
  4641. end
  4642. end
  4643. local precisionscrolling, update = nil
  4644. local showing = false
  4645. local function display(dropdownEnabled, f)
  4646. if submenuOpen == dropdown or submenuOpen == nil then
  4647. if dropdownEnabled then
  4648. list = resolvelist()
  4649. if next(list) then
  4650. else
  4651. local EmptyVal = options.EmptyValue
  4652. if EmptyVal ~= nil then
  4653. table.insert(list, 1, EmptyVal)
  4654. end
  4655. end
  4656. AddOptions(list, f)
  4657. submenuOpen = dropdown
  4658. dropdownToggle.Rotation = 270
  4659. restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
  4660. restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
  4661. restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
  4662. newSection.ZIndex = 50 + newSection.ZIndex
  4663. newDropdown.ZIndex = 2
  4664. sectionHolder.ZIndex = 2
  4665. colored_dropdown_BackgroundColor3[3] = "main"
  4666. colored_dropdown_BackgroundColor3[4] = 1.5
  4667. colored_dropdown_ImageColor3[3] = "main"
  4668. colored_dropdown_ImageColor3[4] = 2.5
  4669. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  4670. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  4671. ImageColor3 = darkenColor(library.colors.main, 2.5)
  4672. }):Play()
  4673. dropdownHolderFrame.Visible = true
  4674. if not options.DisablePrecisionScrolling then
  4675. local scrollrate = tonumber(options.ScrollButtonRate or options.ScrollRate) or 5
  4676. local upkey = options.ScrollUpButton or library.scrollupbutton or shared.scrollupbutton or Enum.KeyCode.Up
  4677. local downkey = options.ScrollDownButton or library.scrolldownbutton or shared.scrolldownbutton or Enum.KeyCode.Down
  4678. precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or userInputService.InputBegan:Connect(function(input)
  4679. if input.UserInputType == Enum.UserInputType.Keyboard then
  4680. local code = input.KeyCode
  4681. local isup = code == upkey
  4682. local isdown = code == downkey
  4683. if isup or isdown then
  4684. local txt = userInputService:GetFocusedTextBox()
  4685. if not txt or txt == dropdownSelection then
  4686. while wait_check() and userInputService:IsKeyDown(code) do
  4687. realDropdownHolder.CanvasPosition = Vector2:new(math.clamp(realDropdownHolder.CanvasPosition.Y + ((isup and -scrollrate) or scrollrate), 0, realDropdownHolder.AbsoluteCanvasSize.Y))
  4688. end
  4689. end
  4690. end
  4691. end
  4692. end)
  4693. library.signals[1 + #library.signals] = precisionscrolling
  4694. end
  4695. else
  4696. submenuOpen = nil
  4697. dropdownToggle.Rotation = 90
  4698. colored_dropdown_BackgroundColor3[3] = "topGradient"
  4699. colored_dropdown_BackgroundColor3[4] = nil
  4700. colored_dropdown_ImageColor3[3] = "bottomGradient"
  4701. colored_dropdown_ImageColor3[4] = nil
  4702. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  4703. BackgroundColor3 = library.colors.topGradient,
  4704. ImageColor3 = library.colors.bottomGradient
  4705. }):Play()
  4706. dropdownHolderFrame.Visible = false
  4707. for ins, z in next, restorezindex do
  4708. ins.ZIndex = z
  4709. end
  4710. precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or nil
  4711. end
  4712. end
  4713. showing = dropdownEnabled
  4714. if showing or dropdownEnabled then
  4715. else
  4716. delay(0.01, update)
  4717. end
  4718. end
  4719. local Set = (multiselect and function(t, dat)
  4720. if nil == dat and t ~= nil then
  4721. dat = t
  4722. end
  4723. local lastv = library_flags[flagName]
  4724. if not lastv or selectedOption ~= lastv then
  4725. if lastv and type(lastv) == "table" then
  4726. selectedOption = library_flags[flagName]
  4727. else
  4728. library_flags[flagName] = selectedOption
  4729. end
  4730. warn("Attempting to use new table for", flagName, " Please use :Set(), because setting it through flags table may cause errors", debug.traceback(""))
  4731. lastv = library_flags[flagName]
  4732. end
  4733. local cloned = {unpack(selectedOption)}
  4734. if not dat then
  4735. if #selectedOption ~= 0 then
  4736. table.clear(selectedOption)
  4737. if callback then
  4738. task.spawn(callback, selectedOption, cloned)
  4739. end
  4740. end
  4741. return selectedOption
  4742. elseif type(dat) ~= "table" then
  4743. warn("Expected table for argument #1 on Set for MultiSelect searchbox. Got", dat, debug.traceback(""))
  4744. return selectedOption
  4745. end
  4746. for k = table.pack(unpack(dat)).n, 1, -1 do
  4747. if dat[k] == nil then
  4748. table.remove(dat, k)
  4749. end
  4750. end
  4751. local proceed = #cloned ~= #dat
  4752. table.clear(selectedOption)
  4753. for k, v in next, dat do
  4754. selectedOption[k] = v
  4755. if not proceed and cloned[k] ~= v then
  4756. proceed = 1
  4757. end
  4758. end
  4759. dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or tostring(blankstring or "Select Item(s)")
  4760. if proceed and callback then
  4761. task.spawn(callback, selectedOption, cloned)
  4762. end
  4763. if options.AutoValidate then
  4764. SetupValidation()
  4765. end
  4766. return selectedOption
  4767. end) or function(t, str)
  4768. if nil == str and t then
  4769. str = t
  4770. end
  4771. local last_v = library_flags[flagName]
  4772. selectedOption = str
  4773. library_flags[flagName] = str
  4774. if options.Location then
  4775. options.Location[options.LocationFlag or flagName] = str
  4776. end
  4777. local sstr = (selectedOption and tostring(selectedOption)) or blankstring or "No Blank String"
  4778. if dropdownSelection.Text ~= sstr then
  4779. dropdownSelection.Text = sstr
  4780. end
  4781. if callback and (last_v ~= str or options.AllowDuplicateCalls) then
  4782. task.spawn(callback, str, last_v)
  4783. end
  4784. if options.AutoValidate then
  4785. SetupValidation()
  4786. end
  4787. return str
  4788. end
  4789. if val ~= nil then
  4790. Set(val)
  4791. else
  4792. library_flags[flagName] = selectedOption
  4793. if options.Location then
  4794. options.Location[options.LocationFlag or flagName] = selectedOption
  4795. end
  4796. if options.AutoValidate then
  4797. SetupValidation()
  4798. end
  4799. end
  4800. library.signals[1 + #library.signals] = dropdownToggle.MouseButton1Click:Connect(function()
  4801. showing = not showing
  4802. display(showing)
  4803. end)
  4804. library.signals[1 + #library.signals] = dropdownSelection.Focused:Connect(function()
  4805. showing = true
  4806. display(true)
  4807. end)
  4808. library.signals[1 + #library.signals] = dropdownSelection:GetPropertyChangedSignal("Text"):Connect(function()
  4809. if showing then
  4810. display(true, #dropdownSelection.Text > 0)
  4811. end
  4812. end)
  4813. if not multiselect then
  4814. library.signals[1 + #library.signals] = dropdownSelection.FocusLost:Connect(function(b)
  4815. if showing then
  4816. wait()
  4817. end
  4818. showing = false
  4819. display(false)
  4820. if b then
  4821. Set(dropdownSelection.Text)
  4822. end
  4823. end)
  4824. end
  4825. AddOptions(list)
  4826. local default = library_flags[flagName]
  4827. function update()
  4828. dropdownName, callback = options.Name or dropdownName, options.Callback
  4829. local sstr = (passed_multiselect == "string" and multiselect) or (not multiselect and library_flags[flagName] and tostring(library_flags[flagName])) or (not multiselect and selectedOption and tostring(selectedOption)) or blankstring or "Nothing"
  4830. if dropdownSelection.Text ~= sstr then
  4831. dropdownSelection.Text = sstr
  4832. end
  4833. dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
  4834. return sstr
  4835. end
  4836. function validate(fallbackValue)
  4837. if list and table.find(list, library_flags[flagName]) then
  4838. update()
  4839. return true
  4840. end
  4841. if fallbackValue ~= nil then
  4842. if fallbackValue == "__DEFAULT" then
  4843. fallbackValue = default
  4844. end
  4845. else
  4846. fallbackValue = list[1]
  4847. end
  4848. if multiselect and type(fallbackValue) ~= "table" then
  4849. fallbackValue = {fallbackValue}
  4850. end
  4851. return Set(fallbackValue)
  4852. end
  4853. local objectdata = {
  4854. Options = options,
  4855. Name = flagName,
  4856. Flag = flagName,
  4857. Type = "SearchBox",
  4858. Default = default,
  4859. Parent = sectionFunctions,
  4860. Instance = dropdownSelection,
  4861. Validate = validate,
  4862. Set = Set,
  4863. Remove = function()
  4864. if newDropdown then
  4865. newDropdown.Parent = nil
  4866. sectionFunctions:Update()
  4867. end
  4868. end,
  4869. RawSet = ((multiselect and function(t, dat)
  4870. if nil == dat and t ~= nil then
  4871. dat = t
  4872. end
  4873. local lastv = library_flags[flagName]
  4874. if not lastv or selectedOption ~= lastv then
  4875. if lastv and type(lastv) == "table" then
  4876. selectedOption = library_flags[flagName]
  4877. else
  4878. library_flags[flagName] = selectedOption
  4879. end
  4880. warn("Attempting to use new table for", flagName, " Please use :Set(), as setting through flags table may cause errors", debug.traceback(""))
  4881. lastv = library_flags[flagName]
  4882. end
  4883. local cloned = {unpack(selectedOption)}
  4884. if not dat then
  4885. if #selectedOption ~= 0 then
  4886. table.clear(selectedOption)
  4887. if callback then
  4888. task.spawn(callback, selectedOption, cloned)
  4889. end
  4890. end
  4891. return selectedOption
  4892. elseif type(dat) ~= "table" then
  4893. warn("Expected table for argument #1 on Set for MultiSelect searchbox. Got", dat, debug.traceback(""))
  4894. return selectedOption
  4895. end
  4896. for k = table.pack(unpack(dat)).n, 1, -1 do
  4897. if dat[k] == nil then
  4898. table.remove(dat, k)
  4899. end
  4900. end
  4901. local proceed = #cloned ~= #dat
  4902. table.clear(selectedOption)
  4903. for k, v in next, dat do
  4904. selectedOption[k] = v
  4905. if not proceed and cloned[k] ~= v then
  4906. proceed = 1
  4907. end
  4908. end
  4909. update()
  4910. return selectedOption
  4911. end) or function(t, str)
  4912. if nil == str and t then
  4913. str = t
  4914. end
  4915. selectedOption = str
  4916. library_flags[flagName] = str
  4917. if options.Location then
  4918. options.Location[options.LocationFlag or flagName] = str
  4919. end
  4920. update()
  4921. return str
  4922. end),
  4923. Get = function()
  4924. return library_flags[flagName]
  4925. end,
  4926. Update = update,
  4927. Reset = function()
  4928. return Set(nil, default)
  4929. end
  4930. }
  4931. function objectdata.UpdateList(t, listt, updateValues)
  4932. if (nil == listt and t ~= nil) or (type(t) == "table" and type(listt) ~= "table") then
  4933. listt, updateValues = t, listt
  4934. end
  4935. if listt == objectdata then
  4936. listt = nil
  4937. end
  4938. resolvelist = getresolver(listt or options.List, options.Filter, options.Method)
  4939. list = resolvelist()
  4940. if next(list) then
  4941. else
  4942. local EmptyVal = options.EmptyValue
  4943. if EmptyVal ~= nil then
  4944. table.insert(list, 1, EmptyVal)
  4945. end
  4946. end
  4947. if updateValues then
  4948. validate()
  4949. end
  4950. if showing then
  4951. display(false)
  4952. display(true)
  4953. end
  4954. return list
  4955. end
  4956. tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
  4957. return objectdata
  4958. end
  4959. sectionFunctions.NewSearchBox = sectionFunctions.AddSearchBox
  4960. sectionFunctions.CreateSearchBox = sectionFunctions.AddSearchBox
  4961. sectionFunctions.SearchBox = sectionFunctions.AddSearchBox
  4962. sectionFunctions.CreateSearchbox = sectionFunctions.AddSearchBox
  4963. sectionFunctions.NewSearchbox = sectionFunctions.AddSearchBox
  4964. sectionFunctions.Searchbox = sectionFunctions.AddSearchBox
  4965. sectionFunctions.Sbox = sectionFunctions.AddSearchBox
  4966. sectionFunctions.SBox = sectionFunctions.AddSearchBox
  4967. if isfolder and makefolder and listfiles and readfile and writefile then
  4968. function sectionFunctions:AddPersistence(options, ...)
  4969. options = (options and type(options) == "string" and resolvevararg("Tab", options, ...)) or options
  4970. local dropdownName, custom_workspace, val, persistiveflags, suffix, callback, loadcallback, savecallback, postload, postsave, flagName = assert(options.Name, "Missing Name for new persistence."), options.Workspace or library.WorkspaceName, options.Value, options.Persistive or options.Flags or "all", options.Suffix, options.Callback, options.LoadCallback, options.SaveCallback, options.PostLoadCallback, options.PostSaveCallback, options.Flag or (function()
  4971. library.unnamedpersistence = 1 + (library.unnamedpersistence or 0)
  4972. return "Persistence" .. tostring(library.unnamedpersistence)
  4973. end)()
  4974. if elements[flagName] ~= nil then
  4975. warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
  4976. end
  4977. local designerpersists = options.Desginer
  4978. local newDropdown = Instance_new("Frame")
  4979. local dropdown = Instance_new("ImageLabel")
  4980. local dropdownInner = Instance_new("ImageLabel")
  4981. local dropdownToggle = Instance_new("ImageButton")
  4982. local dropdownSelection = Instance_new("TextBox")
  4983. local dropdownHeadline = Instance_new("TextLabel")
  4984. local dropdownHolderFrame = Instance_new("ImageLabel")
  4985. local dropdownHolderInner = Instance_new("ImageLabel")
  4986. local realDropdownHolder = Instance_new("ScrollingFrame")
  4987. local realDropdownHolderList = Instance_new("UIListLayout")
  4988. local dropdownEnabled = false
  4989. if not isfolder("./Elite Lib") then
  4990. makefolder("./Elite Lib")
  4991. end
  4992. local common_string = "./Elite Lib/" .. tostring(custom_workspace or library.WorkspaceName)
  4993. local function resolvelist(nofold)
  4994. if custom_workspace ~= options.Workspace then
  4995. custom_workspace = options.Workspace
  4996. common_string = "./Elite Lib/" .. tostring(custom_workspace or library.WorkspaceName)
  4997. end
  4998. if not isfolder or not makefolder or not listfiles then
  4999. return {}
  5000. end
  5001. if not isfolder(common_string) then
  5002. if nofold then
  5003. return {}
  5004. end
  5005. makefolder(common_string)
  5006. end
  5007. assert(isfolder(common_string), "Couldn't create folder: " .. tostring(library.WorkspaceName or "No workspace name?"))
  5008. local names, files = {}, listfiles(common_string)
  5009. if #files > 0 then
  5010. local len = #common_string + 2
  5011. for _, f in next, files do
  5012. names[1 + #names] = string.sub(f, len, -5)
  5013. end
  5014. table.sort(names)
  5015. end
  5016. return names
  5017. end
  5018. local list = resolvelist(true)
  5019. local blankstring = options.BlankValue or options.NoValueString or options.Nothing
  5020. local selectedObjects = {}
  5021. local optionCount = 0
  5022. if blankstring and val == nil then
  5023. val = blankstring
  5024. end
  5025. local selectedOption = val or blankstring or list[1]
  5026. newDropdown.Name = "newDropdown"
  5027. newDropdown.Parent = sectionHolder
  5028. newDropdown.BackgroundColor3 = Color3.new(1, 1, 1)
  5029. newDropdown.BackgroundTransparency = 1
  5030. newDropdown.Size = UDim2.new(1, 0, 0, 42)
  5031. dropdown.Name = "dropdown"
  5032. dropdown.Parent = newDropdown
  5033. dropdown.Active = true
  5034. dropdown.BackgroundColor3 = library.colors.topGradient
  5035. local colored_dropdown_BackgroundColor3 = {dropdown, "BackgroundColor3", "topGradient"}
  5036. colored[1 + #colored] = colored_dropdown_BackgroundColor3
  5037. dropdown.BorderColor3 = library.colors.elementBorder
  5038. colored[1 + #colored] = {dropdown, "BorderColor3", "elementBorder"}
  5039. dropdown.Position = UDim2.fromScale(0.027, 0.45)
  5040. dropdown.Selectable = true
  5041. dropdown.Size = UDim2.fromOffset(206, 18)
  5042. dropdown.Image = "rbxassetid://2454009026"
  5043. dropdown.ImageColor3 = library.colors.bottomGradient
  5044. local colored_dropdown_ImageColor3 = {dropdown, "ImageColor3", "bottomGradient"}
  5045. colored[1 + #colored] = colored_dropdown_ImageColor3
  5046. dropdownInner.Name = "dropdownInner"
  5047. dropdownInner.Parent = dropdown
  5048. dropdownInner.Active = true
  5049. dropdownInner.AnchorPoint = Vector2.new(0.5, 0.5)
  5050. dropdownInner.BackgroundColor3 = library.colors.topGradient
  5051. colored[1 + #colored] = {dropdownInner, "BackgroundColor3", "topGradient"}
  5052. dropdownInner.BorderColor3 = library.colors.elementBorder
  5053. colored[1 + #colored] = {dropdownInner, "BorderColor3", "elementBorder"}
  5054. dropdownInner.Position = UDim2.fromScale(0.5, 0.5)
  5055. dropdownInner.Selectable = true
  5056. dropdownInner.Size = UDim2.new(1, -4, 1, -4)
  5057. dropdownInner.Image = "rbxassetid://2454009026"
  5058. dropdownInner.ImageColor3 = library.colors.bottomGradient
  5059. colored[1 + #colored] = {dropdownInner, "ImageColor3", "bottomGradient"}
  5060. dropdownToggle.Name = "dropdownToggle"
  5061. dropdownToggle.Parent = dropdown
  5062. dropdownToggle.BackgroundColor3 = Color3.new(1, 1, 1)
  5063. dropdownToggle.BackgroundTransparency = 1
  5064. dropdownToggle.Position = UDim2.fromScale(0.9, 0.17)
  5065. dropdownToggle.Rotation = 90
  5066. dropdownToggle.Size = UDim2.fromOffset(12, 12)
  5067. dropdownToggle.ZIndex = 2
  5068. dropdownToggle.Image = "rbxassetid://71659683"
  5069. dropdownToggle.ImageColor3 = Color3.fromRGB(171, 171, 171)
  5070. dropdownSelection.Name = "dropdownSelection"
  5071. dropdownSelection.Parent = dropdown
  5072. dropdownSelection.BackgroundColor3 = Color3.new(1, 1, 1)
  5073. dropdownSelection.BackgroundTransparency = 1
  5074. dropdownSelection.Position = UDim2.new(0.0295485705)
  5075. dropdownSelection.Size = UDim2.fromScale(0.97, 1)
  5076. dropdownSelection.ZIndex = 5
  5077. dropdownSelection.Font = Enum.Font.Code
  5078. dropdownSelection.LineHeight = 1.15
  5079. dropdownSelection.Text = (selectedOption and tostring(selectedOption)) or "nil"
  5080. dropdownSelection.TextColor3 = library.colors.otherElementText
  5081. colored[1 + #colored] = {dropdownSelection, "TextColor3", "otherElementText"}
  5082. dropdownSelection.TextSize = 14
  5083. dropdownSelection.TextXAlignment = Enum.TextXAlignment.Left
  5084. dropdownHeadline.Name = "dropdownHeadline"
  5085. dropdownHeadline.Parent = newDropdown
  5086. dropdownHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
  5087. dropdownHeadline.BackgroundTransparency = 1
  5088. dropdownHeadline.Position = UDim2.fromScale(0.034, 0.03)
  5089. dropdownHeadline.Size = UDim2.fromOffset(167, 11)
  5090. dropdownHeadline.Font = Enum.Font.Code
  5091. dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
  5092. dropdownHeadline.TextColor3 = library.colors.elementText
  5093. colored[1 + #colored] = {dropdownHeadline, "TextColor3", "elementText"}
  5094. dropdownHeadline.TextSize = 14
  5095. dropdownHeadline.TextXAlignment = Enum.TextXAlignment.Left
  5096. dropdownHolderFrame.Name = "dropdownHolderFrame"
  5097. dropdownHolderFrame.Parent = newDropdown
  5098. dropdownHolderFrame.Active = true
  5099. dropdownHolderFrame.BackgroundColor3 = library.colors.topGradient
  5100. colored[1 + #colored] = {dropdownHolderFrame, "BackgroundColor3", "topGradient"}
  5101. dropdownHolderFrame.BorderColor3 = library.colors.elementBorder
  5102. colored[1 + #colored] = {dropdownHolderFrame, "BorderColor3", "elementBorder"}
  5103. dropdownHolderFrame.Position = UDim2.fromScale(0.025, 1.012)
  5104. dropdownHolderFrame.Selectable = true
  5105. dropdownHolderFrame.Size = UDim2.fromOffset(206, 22)
  5106. dropdownHolderFrame.Visible = false
  5107. dropdownHolderFrame.Image = "rbxassetid://2454009026"
  5108. dropdownHolderFrame.ImageColor3 = library.colors.bottomGradient
  5109. colored[1 + #colored] = {dropdownHolderFrame, "ImageColor3", "bottomGradient"}
  5110. dropdownHolderInner.Name = "dropdownHolderInner"
  5111. dropdownHolderInner.Parent = dropdownHolderFrame
  5112. dropdownHolderInner.Active = true
  5113. dropdownHolderInner.AnchorPoint = Vector2.new(0.5, 0.5)
  5114. dropdownHolderInner.BackgroundColor3 = library.colors.topGradient
  5115. colored[1 + #colored] = {dropdownHolderInner, "BackgroundColor3", "topGradient"}
  5116. dropdownHolderInner.BorderColor3 = library.colors.elementBorder
  5117. colored[1 + #colored] = {dropdownHolderInner, "BorderColor3", "elementBorder"}
  5118. dropdownHolderInner.Position = UDim2.fromScale(0.5, 0.5)
  5119. dropdownHolderInner.Selectable = true
  5120. dropdownHolderInner.Size = UDim2.new(1, -4, 1, -4)
  5121. dropdownHolderInner.Image = "rbxassetid://2454009026"
  5122. dropdownHolderInner.ImageColor3 = library.colors.bottomGradient
  5123. colored[1 + #colored] = {dropdownHolderInner, "ImageColor3", "bottomGradient"}
  5124. realDropdownHolder.Name = "realDropdownHolder"
  5125. realDropdownHolder.Parent = dropdownHolderInner
  5126. realDropdownHolder.BackgroundColor3 = Color3.new(1, 1, 1)
  5127. realDropdownHolder.BackgroundTransparency = 1
  5128. realDropdownHolder.Selectable = false
  5129. realDropdownHolder.Size = UDim2.fromScale(1, 1)
  5130. realDropdownHolder.CanvasSize = UDim2.new()
  5131. realDropdownHolder.ScrollBarThickness = 5
  5132. realDropdownHolder.ScrollingDirection = Enum.ScrollingDirection.Y
  5133. realDropdownHolder.AutomaticCanvasSize = Enum.AutomaticSize.Y
  5134. realDropdownHolder.ScrollBarImageTransparency = 0.5
  5135. realDropdownHolder.ScrollBarImageColor3 = library.colors.section
  5136. colored[1 + #colored] = {realDropdownHolder, "ScrollBarImageColor3", "section"}
  5137. realDropdownHolderList.Name = "realDropdownHolderList"
  5138. realDropdownHolderList.Parent = realDropdownHolder
  5139. realDropdownHolderList.HorizontalAlignment = Enum.HorizontalAlignment.Center
  5140. realDropdownHolderList.SortOrder = Enum.SortOrder.LayoutOrder
  5141. sectionFunctions:Update()
  5142. library.signals[1 + #library.signals] = newDropdown.MouseEnter:Connect(function()
  5143. colored_dropdown_BackgroundColor3[3] = "main"
  5144. colored_dropdown_BackgroundColor3[4] = 1.5
  5145. colored_dropdown_ImageColor3[3] = "main"
  5146. colored_dropdown_ImageColor3[4] = 2.5
  5147. tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  5148. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  5149. ImageColor3 = darkenColor(library.colors.main, 2.5)
  5150. }):Play()
  5151. end)
  5152. library.signals[1 + #library.signals] = newDropdown.MouseLeave:Connect(function()
  5153. if not dropdownEnabled then
  5154. colored_dropdown_BackgroundColor3[3] = "topGradient"
  5155. colored_dropdown_BackgroundColor3[4] = nil
  5156. colored_dropdown_ImageColor3[3] = "bottomGradient"
  5157. colored_dropdown_ImageColor3[4] = nil
  5158. tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  5159. BackgroundColor3 = library.colors.topGradient,
  5160. ImageColor3 = library.colors.bottomGradient
  5161. }):Play()
  5162. end
  5163. end)
  5164. local restorezindex = {}
  5165. local function UpdateDropdownHolder()
  5166. if optionCount >= 6 then
  5167. realDropdownHolder.CanvasSize = UDim2:fromOffset(realDropdownHolderList.AbsoluteContentSize.Y + 2)
  5168. elseif optionCount <= 5 then
  5169. dropdownHolderFrame.Size = UDim2.fromOffset(206, (realDropdownHolderList.AbsoluteContentSize.Y + 4))
  5170. end
  5171. end
  5172. local function AddOptions(optionsTable, filter)
  5173. if options.Sort then
  5174. local didstuff, dosort = nil, options.Sort
  5175. if type(dosort) == "function" then
  5176. local g, h = pcall(table.sort, optionsTable, dosort)
  5177. if g then
  5178. didstuff = true
  5179. elseif h then
  5180. warn("Error sorting list:", h, debug.traceback(""))
  5181. end
  5182. end
  5183. if not didstuff then
  5184. table.sort(optionsTable, library.defaultSort)
  5185. end
  5186. end
  5187. if blankstring and (optionsTable[1] ~= blankstring or table.find(optionsTable, blankstring, 2)) then
  5188. local exists = table.find(optionsTable, blankstring)
  5189. if exists then
  5190. for _ = 1, 35 do
  5191. table.remove(optionsTable, exists)
  5192. exists = table.find(optionsTable, blankstring)
  5193. if not exists then
  5194. break
  5195. end
  5196. end
  5197. end
  5198. table.insert(optionsTable, 1, blankstring)
  5199. end
  5200. optionCount = 0
  5201. realDropdownHolderList.Parent = nil
  5202. realDropdownHolder:ClearAllChildren()
  5203. realDropdownHolderList.Parent = realDropdownHolder
  5204. for _, v in next, optionsTable do
  5205. if not filter or tostring(v):lower():find(dropdownSelection.Text:lower(), 1, true) then
  5206. optionCount = optionCount + 1
  5207. UpdateDropdownHolder()
  5208. local newOption = Instance_new("ImageLabel")
  5209. local optionButton = Instance_new("TextButton")
  5210. if selectedOption == v or not selectedObjects[1] or not selectedObjects[2] then
  5211. selectedObjects[1] = newOption
  5212. selectedObjects[2] = optionButton
  5213. end
  5214. newOption.Name = "Frame"
  5215. newOption.Parent = realDropdownHolder
  5216. newOption.BackgroundColor3 = (selectedOption == v and library.colors.selectedOption or library.colors.topGradient)
  5217. newOption.BorderSizePixel = 0
  5218. newOption.Size = UDim2.fromOffset(202, 18)
  5219. newOption.Image = "rbxassetid://2454009026"
  5220. newOption.ImageColor3 = (selectedOption == v and library.colors.unselectedOption or library.colors.bottomGradient)
  5221. optionButton.Name = tostring(v)
  5222. optionButton.Parent = newOption
  5223. optionButton.AnchorPoint = Vector2.new(0.5, 0.5)
  5224. optionButton.BackgroundColor3 = Color3.new(1, 1, 1)
  5225. optionButton.BackgroundTransparency = 1
  5226. optionButton.Position = UDim2.fromScale(0.5, 0.5)
  5227. optionButton.Size = UDim2.new(1, -10, 1)
  5228. optionButton.ZIndex = 5
  5229. optionButton.Font = Enum.Font.Code
  5230. optionButton.Text = (selectedOption == v and " " .. tostring(v)) or tostring(v)
  5231. optionButton.TextColor3 = (selectedOption == v and library.colors.main or library.colors.otherElementText)
  5232. optionButton.TextSize = 14
  5233. optionButton.TextXAlignment = Enum.TextXAlignment.Left
  5234. library.signals[1 + #library.signals] = optionButton.MouseButton1Down:Connect(function()
  5235. dropdownSelection.Text = tostring(v)
  5236. restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
  5237. restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
  5238. restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
  5239. if selectedOption ~= v then
  5240. local last_v = library_flags[flagName]
  5241. selectedObjects[1].BackgroundColor3 = library.colors.topGradient
  5242. selectedObjects[1].ImageColor3 = library.colors.bottomGradient
  5243. selectedObjects[2].Text = selectedObjects[2].Name
  5244. selectedObjects[2].TextColor3 = library.colors.otherElementText
  5245. selectedOption = v
  5246. selectedObjects[1] = newOption
  5247. selectedObjects[2] = optionButton
  5248. newOption.BackgroundColor3 = library.colors.selectedOption
  5249. newOption.ImageColor3 = library.colors.unselectedOption
  5250. optionButton.TextColor3 = library.colors.main
  5251. dropdownHolderFrame.Visible = false
  5252. dropdownToggle.Rotation = 90
  5253. dropdownEnabled = false
  5254. colored_dropdown_BackgroundColor3[3] = "topGradient"
  5255. colored_dropdown_BackgroundColor3[4] = nil
  5256. colored_dropdown_ImageColor3[3] = "bottomGradient"
  5257. colored_dropdown_ImageColor3[4] = nil
  5258. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  5259. BackgroundColor3 = library.colors.topGradient,
  5260. ImageColor3 = library.colors.bottomGradient
  5261. }):Play()
  5262. library_flags[flagName] = selectedOption
  5263. if options.Location then
  5264. options.Location[options.LocationFlag or flagName] = selectedOption
  5265. end
  5266. dropdownSelection.Text = tostring(selectedOption)
  5267. if submenuOpen then
  5268. submenuOpen = nil
  5269. end
  5270. if callback then
  5271. task.spawn(callback, selectedOption, last_v)
  5272. end
  5273. else
  5274. submenuOpen = nil
  5275. dropdownToggle.Rotation = 90
  5276. newDropdown.ZIndex = 1
  5277. sectionHolder.ZIndex = 1
  5278. colored_dropdown_BackgroundColor3[3] = "topGradient"
  5279. colored_dropdown_BackgroundColor3[4] = nil
  5280. colored_dropdown_ImageColor3[3] = "bottomGradient"
  5281. colored_dropdown_ImageColor3[4] = nil
  5282. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  5283. BackgroundColor3 = library.colors.topGradient,
  5284. ImageColor3 = library.colors.bottomGradient
  5285. }):Play()
  5286. dropdownHolderFrame.Visible = false
  5287. end
  5288. for ins, z in next, restorezindex do
  5289. ins.ZIndex = z
  5290. end
  5291. end)
  5292. library.signals[1 + #library.signals] = optionButton.MouseEnter:Connect(function()
  5293. tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  5294. BackgroundColor3 = library.colors.hoveredOptionTop,
  5295. ImageColor3 = library.colors.hoveredOptionBottom
  5296. }):Play()
  5297. end)
  5298. library.signals[1 + #library.signals] = optionButton.MouseLeave:Connect(function()
  5299. tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  5300. BackgroundColor3 = library.colors.unhoveredOptionTop,
  5301. ImageColor3 = library.colors.unhoveredOptionBottom
  5302. }):Play()
  5303. end)
  5304. UpdateDropdownHolder()
  5305. end
  5306. end
  5307. end
  5308. local precisionscrolling, update = nil
  5309. local showing = false
  5310. local function display(dropdownEnabled, f)
  5311. if submenuOpen == dropdown or submenuOpen == nil then
  5312. if dropdownEnabled then
  5313. list = resolvelist(true)
  5314. AddOptions(list, f)
  5315. submenuOpen = dropdown
  5316. restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
  5317. restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
  5318. restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
  5319. newSection.ZIndex = 50 + newSection.ZIndex
  5320. dropdownToggle.Rotation = 270
  5321. newDropdown.ZIndex = 2
  5322. sectionHolder.ZIndex = 2
  5323. colored_dropdown_BackgroundColor3[3] = "main"
  5324. colored_dropdown_BackgroundColor3[4] = 1.5
  5325. colored_dropdown_ImageColor3[3] = "main"
  5326. colored_dropdown_ImageColor3[4] = 2.5
  5327. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  5328. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  5329. ImageColor3 = darkenColor(library.colors.main, 2.5)
  5330. }):Play()
  5331. dropdownHolderFrame.Visible = true
  5332. if not options.DisablePrecisionScrolling then
  5333. local upkey = options.ScrollUpButton or library.scrollupbutton or shared.scrollupbutton or Enum.KeyCode.Up
  5334. local downkey = options.ScrollDownButton or library.scrolldownbutton or shared.scrolldownbutton or Enum.KeyCode.Down
  5335. precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or userInputService.InputBegan:Connect(function(input)
  5336. if input.UserInputType == Enum.UserInputType.Keyboard then
  5337. local code = input.KeyCode
  5338. local isup = code == upkey
  5339. local isdown = code == downkey
  5340. if isup or isdown then
  5341. local txt = userInputService:GetFocusedTextBox()
  5342. if not txt then
  5343. while wait_check() and userInputService:IsKeyDown(code) do
  5344. realDropdownHolder.CanvasPosition = Vector2:new(math.clamp(realDropdownHolder.CanvasPosition.Y + ((isup and -5) or 5), 0, realDropdownHolder.AbsoluteCanvasSize.Y))
  5345. end
  5346. end
  5347. end
  5348. end
  5349. end)
  5350. library.signals[1 + #library.signals] = precisionscrolling
  5351. end
  5352. else
  5353. submenuOpen = nil
  5354. dropdownToggle.Rotation = 90
  5355. colored_dropdown_BackgroundColor3[3] = "topGradient"
  5356. colored_dropdown_BackgroundColor3[4] = nil
  5357. colored_dropdown_ImageColor3[3] = "bottomGradient"
  5358. colored_dropdown_ImageColor3[4] = nil
  5359. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  5360. BackgroundColor3 = library.colors.topGradient,
  5361. ImageColor3 = library.colors.bottomGradient
  5362. }):Play()
  5363. dropdownHolderFrame.Visible = false
  5364. for ins, z in next, restorezindex do
  5365. ins.ZIndex = z
  5366. end
  5367. precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or nil
  5368. end
  5369. showing = dropdownEnabled
  5370. if showing or dropdownEnabled then
  5371. else
  5372. delay(0.01, update)
  5373. end
  5374. end
  5375. end
  5376. local last_v = nil
  5377. local function Set(t, str)
  5378. if nil == str and t then
  5379. str = t
  5380. end
  5381. selectedOption = str
  5382. last_v = library_flags[flagName]
  5383. library_flags[flagName] = str
  5384. if options.Location then
  5385. options.Location[options.LocationFlag or flagName] = str
  5386. end
  5387. local sstr = (selectedOption and tostring(selectedOption)) or blankstring or "No Blank String"
  5388. if dropdownSelection.Text ~= sstr then
  5389. dropdownSelection.Text = sstr
  5390. end
  5391. if callback and (last_v ~= str or options.AllowDuplicateCalls) then
  5392. task.spawn(callback, str, last_v)
  5393. end
  5394. return str
  5395. end
  5396. if val ~= nil then
  5397. Set(val)
  5398. else
  5399. Set("Filename")
  5400. end
  5401. library.signals[1 + #library.signals] = dropdownSelection.Focused:Connect(function()
  5402. showing = true
  5403. display(true)
  5404. end)
  5405. library.signals[1 + #library.signals] = dropdownSelection:GetPropertyChangedSignal("Text"):Connect(function()
  5406. if showing then
  5407. display(true, #dropdownSelection.Text > 0)
  5408. end
  5409. end)
  5410. library.signals[1 + #library.signals] = dropdownSelection.FocusLost:Connect(function(b)
  5411. if showing then
  5412. wait()
  5413. end
  5414. showing = false
  5415. display(false)
  5416. if b then
  5417. Set(dropdownSelection.Text)
  5418. end
  5419. end)
  5420. AddOptions(list)
  5421. local function savestuff(s, get)
  5422. if not s or type(s) ~= "string" then
  5423. s = nil
  5424. end
  5425. local rawfile = "json__save"
  5426. if not get then
  5427. local filenameddst = string.gsub(s or dropdownSelection.Text or "", "%W", "")
  5428. if #filenameddst == 0 then
  5429. return
  5430. end
  5431. rawfile = string.format("%s/%s.txt", common_string, filenameddst)
  5432. end
  5433. if savecallback then
  5434. local x, e = pcall(savecallback, rawfile, library_flags[flagName])
  5435. if not x and e then
  5436. warn("Error while calling the Pre-Save callback:", e, debug.traceback(""))
  5437. end
  5438. end
  5439. local working_with = {}
  5440. if persistiveflags == 1 or persistiveflags == true or persistiveflags == "*" then
  5441. persistiveflags = "all"
  5442. elseif persistiveflags == 2 then
  5443. persistiveflags = "tab"
  5444. elseif persistiveflags == 3 then
  5445. persistiveflags = "section"
  5446. end
  5447. if persistiveflags == "all" or persistiveflags == "tab" or persistiveflags == "section" then
  5448. for cflag, data in next, (persistiveflags == "all" and elements) or (persistiveflags == "tab" and tabFunctions.Flags) or (persistiveflags == "section" and sectionFunctions.Flags) do
  5449. if data.Type ~= "Persistence" and (designerpersists or string.sub(cflag, 1, 11) ~= "__Designer.") then
  5450. working_with[cflag] = data
  5451. end
  5452. end
  5453. elseif type(persistiveflags) == "table" then
  5454. if #persistiveflags > 0 then
  5455. local inverted = persistiveflags[0] == false or persistiveflags.Inverted
  5456. for k, cflag in next, persistiveflags do
  5457. if k > 0 then
  5458. local data = elements[cflag]
  5459. if data and data.Type ~= "Persistence" and (designerpersists or string.sub(cflag, 1, 11) ~= "__Designer.") then
  5460. working_with[cflag] = (not inverted and data) or nil
  5461. end
  5462. end
  5463. end
  5464. else
  5465. for cflag, persists in next, elements do
  5466. if persists and (designerpersists or string.sub(cflag, 1, 11) ~= "__Designer.") then
  5467. local data = elements[cflag]
  5468. if data then
  5469. working_with[cflag] = data
  5470. end
  5471. end
  5472. end
  5473. end
  5474. end
  5475. local saving = {}
  5476. for cflag in next, working_with do
  5477. local value = library_flags[cflag]
  5478. local good, jval = nil, nil
  5479. if value ~= nil then
  5480. good, jval = JSONEncode(value)
  5481. else
  5482. good, jval = true, "null"
  5483. end
  5484. if not good or (jval == "null" and value ~= nil) then
  5485. local typ = typeof(value)
  5486. if typ == "Color3" then
  5487. value = (library.rainbowflags[cflag] and "rainbow") or Color3ToHex(value)
  5488. end
  5489. value = tostring(value)
  5490. good, jval = JSONEncode(value)
  5491. if not good or (jval == "null" and value ~= nil) then
  5492. warn("Could not save value:", value, debug.traceback(""))
  5493. end
  5494. end
  5495. if good and jval then
  5496. saving[cflag] = value
  5497. end
  5498. end
  5499. local ret = nil
  5500. local good, content = JSONEncode(saving)
  5501. if good and content then
  5502. if not get then
  5503. if not isfolder(common_string) then
  5504. makefolder(common_string)
  5505. end
  5506. writefile(rawfile, content)
  5507. else
  5508. ret = content
  5509. end
  5510. end
  5511. if postsave then
  5512. local x, e = pcall(postsave, rawfile, library_flags[flagName])
  5513. if not x and e then
  5514. warn("Error while calling the Post-Save callback:", e, debug.traceback(""))
  5515. end
  5516. end
  5517. return ret
  5518. end
  5519. local function loadstuff(s, jsonmode, silent)
  5520. if not s or type(s) ~= "string" then
  5521. s = nil
  5522. end
  5523. local filename = "json__load"
  5524. if not jsonmode then
  5525. local filenameddst = convertfilename(s or dropdownSelection.Text, nil, "")
  5526. if #filenameddst == 0 then
  5527. return
  5528. end
  5529. filename = string.format("%s/%s.txt", common_string, filenameddst)
  5530. end
  5531. if loadcallback then
  5532. local x, e = pcall(loadcallback, (jsonmode and s) or filename, library_flags[flagName])
  5533. if not x and e then
  5534. warn("Error while calling the Pre-Load callback:", e, debug.traceback(""))
  5535. end
  5536. end
  5537. if jsonmode or not isfile or isfile(filename) then
  5538. local content = (jsonmode and s) or (not jsonmode and readfile(filename))
  5539. if content and #content > 1 then
  5540. local good, jcontent = JSONDecode(content)
  5541. if good and jcontent then
  5542. for cflag, val in next, jcontent do
  5543. if val and type(val) == "string" and #val > 7 and #val < 64 and string.sub(val, 1, 5) == "Enum." then
  5544. local e = string.find(val, ".", 6, true)
  5545. if e then
  5546. local en = Enum[string.sub(val, 6, e - 1)]
  5547. en = en and en[string.sub(val, e + 1)]
  5548. if en then
  5549. val = en
  5550. else
  5551. warn("Tried & failed to convert '" .. val .. "' to EnumItem")
  5552. end
  5553. end
  5554. end
  5555. local data = elements[cflag]
  5556. if data and data.Type ~= "Persistence" then
  5557. if silent and data.RawSet then
  5558. data:RawSet(val)
  5559. elseif data.Set then
  5560. data:Set(val)
  5561. else
  5562. library_flags[cflag] = val
  5563. end
  5564. end
  5565. end
  5566. end
  5567. end
  5568. end
  5569. if postload then
  5570. local x, e = pcall(postload, filename, library_flags[flagName])
  5571. if not x and e then
  5572. warn("Error while calling the Post-Load callback:", e, debug.traceback(""))
  5573. end
  5574. end
  5575. end
  5576. local fram = nil
  5577. do
  5578. local buttons, offset = {}, 0
  5579. for _, options in next, {{
  5580. Name = "Save" .. ((suffix and (" " .. tostring(suffix))) or ""),
  5581. Callback = savestuff
  5582. }, {
  5583. Name = "Load" .. ((suffix and (" " .. tostring(suffix))) or ""),
  5584. Callback = loadstuff
  5585. }} do
  5586. local buttonName, callback = options.Name, options.Callback
  5587. local realButton = Instance_new("TextButton")
  5588. realButton.Name = "realButton"
  5589. realButton.BackgroundColor3 = Color3.new(1, 1, 1)
  5590. realButton.BackgroundTransparency = 1
  5591. realButton.Size = UDim2.fromScale(1, 1)
  5592. realButton.ZIndex = 5
  5593. realButton.Font = Enum.Font.Code
  5594. realButton.Text = (buttonName and tostring(buttonName)) or "???"
  5595. realButton.TextColor3 = library.colors.elementText
  5596. colored[1 + #colored] = {realButton, "TextColor3", "elementText"}
  5597. realButton.TextSize = 14
  5598. local textsize = textToSize(realButton).X + 14
  5599. if newSection.Parent and (newSection.Parent.AbsoluteSize.X < (offset + textsize + 8)) then
  5600. offset, fram = 0, nil
  5601. end
  5602. local newButton = fram or Instance_new("Frame")
  5603. fram = newButton
  5604. local button = Instance_new("ImageLabel")
  5605. newButton.Name = removeSpaces((buttonName and buttonName:lower() or "???") .. "Holder")
  5606. newButton.Parent = sectionHolder
  5607. newButton.BackgroundColor3 = Color3.new(1, 1, 1)
  5608. newButton.BackgroundTransparency = 1
  5609. newButton.Size = UDim2.new(1, 0, 0, 24)
  5610. button.Name = "button"
  5611. button.Parent = newButton
  5612. button.Active = true
  5613. button.BackgroundColor3 = library.colors.topGradient
  5614. local colored_button_BackgroundColor3 = {button, "BackgroundColor3", "topGradient"}
  5615. colored[1 + #colored] = colored_button_BackgroundColor3
  5616. button.BorderColor3 = library.colors.elementBorder
  5617. colored[1 + #colored] = {button, "BorderColor3", "elementBorder"}
  5618. button.Position = UDim2.new(0.031, offset, 0.166)
  5619. button.Selectable = true
  5620. button.Size = UDim2.fromOffset(28, 18)
  5621. button.Image = "rbxassetid://2454009026"
  5622. button.ImageColor3 = library.colors.bottomGradient
  5623. local colored_button_ImageColor3 = {button, "ImageColor3", "bottomGradient"}
  5624. colored[1 + #colored] = colored_button_ImageColor3
  5625. local buttonInner = Instance_new("ImageLabel")
  5626. buttonInner.Name = "buttonInner"
  5627. buttonInner.Parent = button
  5628. buttonInner.Active = true
  5629. buttonInner.AnchorPoint = Vector2.new(0.5, 0.5)
  5630. buttonInner.BackgroundColor3 = library.colors.topGradient
  5631. colored[1 + #colored] = {buttonInner, "BackgroundColor3", "topGradient"}
  5632. buttonInner.BorderColor3 = library.colors.elementBorder
  5633. colored[1 + #colored] = {buttonInner, "BorderColor3", "elementBorder"}
  5634. buttonInner.Position = UDim2.fromScale(0.5, 0.5)
  5635. buttonInner.Selectable = true
  5636. buttonInner.Size = UDim2.new(1, -4, 1, -4)
  5637. buttonInner.Image = "rbxassetid://2454009026"
  5638. buttonInner.ImageColor3 = library.colors.bottomGradient
  5639. colored[1 + #colored] = {buttonInner, "ImageColor3", "bottomGradient"}
  5640. button.Size = UDim2.fromOffset(textsize, 18)
  5641. realButton.Parent = button
  5642. offset = offset + textsize + 6
  5643. sectionFunctions:Update()
  5644. local presses = 0
  5645. library.signals[1 + #library.signals] = realButton.MouseButton1Click:Connect(function()
  5646. if not library.colorpicker and not submenuOpen then
  5647. presses = 1 + presses
  5648. task.spawn(callback, presses)
  5649. end
  5650. end)
  5651. library.signals[1 + #library.signals] = button.MouseEnter:Connect(function()
  5652. colored_button_BackgroundColor3[3] = "main"
  5653. colored_button_BackgroundColor3[4] = 1.5
  5654. colored_button_ImageColor3[3] = "main"
  5655. colored_button_ImageColor3[4] = 2.5
  5656. tweenService:Create(button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  5657. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  5658. ImageColor3 = darkenColor(library.colors.main, 2.5)
  5659. }):Play()
  5660. end)
  5661. library.signals[1 + #library.signals] = button.MouseLeave:Connect(function()
  5662. colored_button_BackgroundColor3[3] = "topGradient"
  5663. colored_button_BackgroundColor3[4] = nil
  5664. colored_button_ImageColor3[3] = "bottomGradient"
  5665. colored_button_ImageColor3[4] = nil
  5666. tweenService:Create(button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  5667. BackgroundColor3 = library.colors.topGradient,
  5668. ImageColor3 = library.colors.bottomGradient
  5669. }):Play()
  5670. end)
  5671. end
  5672. end
  5673. local default = library_flags[flagName]
  5674. function update()
  5675. dropdownName, custom_workspace, persistiveflags, suffix, callback, loadcallback, savecallback, postload, postsave = options.Name or dropdownName, options.Workspace or library.WorkspaceName, options.Persistive or options.Flags or "all", options.Suffix, options.Callback, options.LoadCallback, options.SaveCallback, options.PostLoadCallback, options.PostSaveCallback
  5676. local sstr = tostring(library_flags[flagName])
  5677. if dropdownSelection.Text ~= sstr then
  5678. dropdownSelection.Text = sstr
  5679. end
  5680. dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
  5681. return sstr
  5682. end
  5683. local objectdata = {
  5684. Options = options,
  5685. Name = flagName,
  5686. Flag = flagName,
  5687. Type = "Persistence",
  5688. Default = default,
  5689. Parent = sectionFunctions,
  5690. Instance = dropdownSelection,
  5691. Set = Set,
  5692. Remove = function()
  5693. local relod = nil
  5694. if newDropdown then
  5695. newDropdown.Parent = nil
  5696. relod = true
  5697. end
  5698. if fram then
  5699. fram.Parent = nil
  5700. relod = true
  5701. end
  5702. if relod then
  5703. sectionFunctions:Update()
  5704. end
  5705. end,
  5706. SaveFile = function(t, str, ret)
  5707. if t ~= nil and type(t) ~= "table" then
  5708. str, ret = t, str
  5709. end
  5710. if type(str) == "string" then
  5711. str = str:match("(.+)%..+$") or str
  5712. end
  5713. return savestuff(str, ret)
  5714. end,
  5715. LoadFile = function(t, str, jsonmode)
  5716. if t ~= nil and type(t) ~= "table" then
  5717. str, jsonmode = t, str
  5718. end
  5719. if isfile and isfile(str) then
  5720. return loadstuff(readfile(str), true)
  5721. elseif not jsonmode and type(str) == "string" then
  5722. str = str:match("(.+)%..+$") or str
  5723. end
  5724. return loadstuff(str, jsonmode)
  5725. end,
  5726. LoadJSON = function(_, json)
  5727. return loadstuff(json, true)
  5728. end,
  5729. LoadFileRaw = function(t, str, jsonmode)
  5730. if t ~= nil and type(t) ~= "table" then
  5731. str, jsonmode = t, str
  5732. end
  5733. if isfile and isfile(str) then
  5734. return loadstuff(readfile(str), true, true)
  5735. elseif not jsonmode and type(str) == "string" then
  5736. str = str:match("(.+)%..+$") or str
  5737. end
  5738. return loadstuff(str, jsonmode, true)
  5739. end,
  5740. LoadJSONRaw = function(_, json)
  5741. return loadstuff(json, true, true)
  5742. end,
  5743. GetJSON = function(t, clipboard)
  5744. if nil == clipboard and t ~= nil then
  5745. clipboard = t
  5746. end
  5747. local json = savestuff(nil, true)
  5748. local clipfunc = (clipboard and type(clipboard) == "function" and clipboard) or setclipboard
  5749. if clipboard and clipfunc then
  5750. clipfunc(json)
  5751. end
  5752. return json
  5753. end,
  5754. RawSet = function(t, str)
  5755. if nil == str and t ~= nil then
  5756. str = t
  5757. end
  5758. selectedOption = str
  5759. last_v = library_flags[flagName]
  5760. library_flags[flagName] = str
  5761. if options.Location then
  5762. options.Location[options.LocationFlag or flagName] = str
  5763. end
  5764. update()
  5765. return str
  5766. end,
  5767. Get = function()
  5768. return library_flags[flagName]
  5769. end,
  5770. Update = update,
  5771. Reset = function()
  5772. return Set(nil, default)
  5773. end
  5774. }
  5775. tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
  5776. return objectdata
  5777. end
  5778. else
  5779. function sectionFunctions.AddPersistence()
  5780. if not library.warnedpersistance then
  5781. library.warnedpersistance = 1
  5782. warn(debug.traceback("Persistance not supported"))
  5783. end
  5784. function sectionFunctions.AddPersistence()
  5785. end
  5786. end
  5787. end
  5788. sectionFunctions.NewPersistence = sectionFunctions.AddPersistence
  5789. sectionFunctions.CreatePersistence = sectionFunctions.AddPersistence
  5790. sectionFunctions.Persistence = sectionFunctions.AddPersistence
  5791. sectionFunctions.CreateSaveLoad = sectionFunctions.AddPersistence
  5792. sectionFunctions.SaveLoad = sectionFunctions.AddPersistence
  5793. sectionFunctions.SL = sectionFunctions.AddPersistence
  5794. function sectionFunctions:AddDropdown(options, ...)
  5795. options = (options and type(options) == "string" and resolvevararg("Dropdown", options, ...)) or options
  5796. local dropdownName, listt, val, callback, flagName = assert(options.Name, "Missing Name for new searchbox."), assert(options.List, "Missing List for new searchbox."), options.Value, options.Callback, options.Flag or (function()
  5797. library.unnameddropdown = 1 + (library.unnameddropdown or 0)
  5798. return "Dropdown" .. tostring(library.unnameddropdown)
  5799. end)()
  5800. if elements[flagName] ~= nil then
  5801. warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
  5802. end
  5803. local newDropdown = Instance_new("Frame")
  5804. local dropdown = Instance_new("ImageLabel")
  5805. local dropdownInner = Instance_new("ImageLabel")
  5806. local dropdownToggle = Instance_new("ImageButton")
  5807. local dropdownSelection = Instance_new("TextLabel")
  5808. local dropdownHeadline = Instance_new("TextLabel")
  5809. local dropdownHolderFrame = Instance_new("ImageLabel")
  5810. local dropdownHolderInner = Instance_new("ImageLabel")
  5811. local realDropdownHolder = Instance_new("ScrollingFrame")
  5812. local realDropdownHolderList = Instance_new("UIListLayout")
  5813. local dropdownEnabled = false
  5814. local multiselect = options.MultiSelect or options.Multi or options.Multiple
  5815. local addcallback = options.ItemAdded or options.AddedCallback
  5816. local delcallback = options.ItemRemoved or options.RemovedCallback
  5817. local clrcallback = options.ItemsCleared or options.ClearedCallback
  5818. local modcallback = options.ItemChanged or options.ChangedCallback
  5819. local blankstring = not multiselect and (options.BlankValue or options.NoValueString or options.Nothing)
  5820. local resolvelist = getresolver(listt, options.Filter, options.Method)
  5821. local list = resolvelist()
  5822. if next(list) then
  5823. else
  5824. local EmptyVal = options.EmptyValue
  5825. if EmptyVal ~= nil then
  5826. table.insert(list, 1, EmptyVal)
  5827. end
  5828. end
  5829. local selectedOption = list[1]
  5830. local passed_multiselect = multiselect and type(multiselect)
  5831. if blankstring and val == nil then
  5832. val = blankstring
  5833. end
  5834. if val ~= nil then
  5835. selectedOption = val
  5836. end
  5837. if multiselect and (not selectedOption or type(selectedOption) ~= "table") then
  5838. selectedOption = {}
  5839. end
  5840. local selectedObjects = {}
  5841. local optionCount = 0
  5842. newDropdown.Name = "newDropdown"
  5843. newDropdown.Parent = sectionHolder
  5844. newDropdown.BackgroundColor3 = Color3.new(1, 1, 1)
  5845. newDropdown.BackgroundTransparency = 1
  5846. newDropdown.Size = UDim2.new(1, 0, 0, 42)
  5847. dropdown.Name = "dropdown"
  5848. dropdown.Parent = newDropdown
  5849. dropdown.Active = true
  5850. dropdown.BackgroundColor3 = library.colors.topGradient
  5851. local colored_dropdown_BackgroundColor3 = {dropdown, "BackgroundColor3", "topGradient"}
  5852. colored[1 + #colored] = colored_dropdown_BackgroundColor3
  5853. dropdown.BorderColor3 = library.colors.elementBorder
  5854. colored[1 + #colored] = {dropdown, "BorderColor3", "elementBorder"}
  5855. dropdown.Position = UDim2.fromScale(0.027, 0.45)
  5856. dropdown.Selectable = true
  5857. dropdown.Size = UDim2.fromOffset(206, 18)
  5858. dropdown.Image = "rbxassetid://2454009026"
  5859. dropdown.ImageColor3 = library.colors.bottomGradient
  5860. local colored_dropdown_ImageColor3 = {dropdown, "ImageColor3", "bottomGradient"}
  5861. colored[1 + #colored] = colored_dropdown_ImageColor3
  5862. dropdownInner.Name = "dropdownInner"
  5863. dropdownInner.Parent = dropdown
  5864. dropdownInner.Active = true
  5865. dropdownInner.AnchorPoint = Vector2.new(0.5, 0.5)
  5866. dropdownInner.BackgroundColor3 = library.colors.topGradient
  5867. colored[1 + #colored] = {dropdownInner, "BackgroundColor3", "topGradient"}
  5868. dropdownInner.BorderColor3 = library.colors.elementBorder
  5869. colored[1 + #colored] = {dropdownInner, "BorderColor3", "elementBorder"}
  5870. dropdownInner.Position = UDim2.fromScale(0.5, 0.5)
  5871. dropdownInner.Selectable = true
  5872. dropdownInner.Size = UDim2.new(1, -4, 1, -4)
  5873. dropdownInner.Image = "rbxassetid://2454009026"
  5874. dropdownInner.ImageColor3 = library.colors.bottomGradient
  5875. colored[1 + #colored] = {dropdownInner, "ImageColor3", "bottomGradient"}
  5876. dropdownToggle.Name = "dropdownToggle"
  5877. dropdownToggle.Parent = dropdown
  5878. dropdownToggle.BackgroundColor3 = Color3.new(1, 1, 1)
  5879. dropdownToggle.BackgroundTransparency = 1
  5880. dropdownToggle.Position = UDim2.fromScale(0.9, 0.17)
  5881. dropdownToggle.Rotation = 90
  5882. dropdownToggle.Size = UDim2.fromOffset(12, 12)
  5883. dropdownToggle.ZIndex = 2
  5884. dropdownToggle.Image = "rbxassetid://71659683"
  5885. dropdownToggle.ImageColor3 = Color3.fromRGB(171, 171, 171)
  5886. dropdownSelection.Name = "dropdownSelection"
  5887. dropdownSelection.Parent = dropdown
  5888. dropdownSelection.Active = true
  5889. dropdownSelection.BackgroundColor3 = Color3.new(1, 1, 1)
  5890. dropdownSelection.BackgroundTransparency = 1
  5891. dropdownSelection.Position = UDim2.new(0.0295)
  5892. dropdownSelection.Selectable = true
  5893. dropdownSelection.Size = UDim2.fromScale(0.97, 1)
  5894. dropdownSelection.ZIndex = 5
  5895. dropdownSelection.Font = Enum.Font.Code
  5896. dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or (multiselect and tostring(blankstring or "Select Item(s)")) or (selectedOption and tostring(selectedOption)) or tostring(blankstring or "No Blank String")
  5897. dropdownSelection.TextColor3 = library.colors.otherElementText
  5898. colored[1 + #colored] = {dropdownSelection, "TextColor3", "otherElementText"}
  5899. dropdownSelection.TextSize = 14
  5900. dropdownSelection.TextXAlignment = Enum.TextXAlignment.Left
  5901. dropdownHeadline.Name = "dropdownHeadline"
  5902. dropdownHeadline.Parent = newDropdown
  5903. dropdownHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
  5904. dropdownHeadline.BackgroundTransparency = 1
  5905. dropdownHeadline.Position = UDim2.fromScale(0.034, 0.03)
  5906. dropdownHeadline.Size = UDim2.fromOffset(167, 11)
  5907. dropdownHeadline.Font = Enum.Font.Code
  5908. dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
  5909. dropdownHeadline.TextColor3 = library.colors.elementText
  5910. colored[1 + #colored] = {dropdownHeadline, "TextColor3", "elementText"}
  5911. dropdownHeadline.TextSize = 14
  5912. dropdownHeadline.TextXAlignment = Enum.TextXAlignment.Left
  5913. dropdownHolderFrame.Name = "dropdownHolderFrame"
  5914. dropdownHolderFrame.Parent = newDropdown
  5915. dropdownHolderFrame.Active = true
  5916. dropdownHolderFrame.BackgroundColor3 = library.colors.topGradient
  5917. colored[1 + #colored] = {dropdownHolderFrame, "BackgroundColor3", "topGradient"}
  5918. dropdownHolderFrame.BorderColor3 = library.colors.elementBorder
  5919. colored[1 + #colored] = {dropdownHolderFrame, "BorderColor3", "elementBorder"}
  5920. dropdownHolderFrame.Position = UDim2.fromScale(0.025, 1.012)
  5921. dropdownHolderFrame.Selectable = true
  5922. dropdownHolderFrame.Size = UDim2.fromOffset(206, 22)
  5923. dropdownHolderFrame.Visible = false
  5924. dropdownHolderFrame.Image = "rbxassetid://2454009026"
  5925. dropdownHolderFrame.ImageColor3 = library.colors.bottomGradient
  5926. colored[1 + #colored] = {dropdownHolderFrame, "ImageColor3", "bottomGradient"}
  5927. dropdownHolderInner.Name = "dropdownHolderInner"
  5928. dropdownHolderInner.Parent = dropdownHolderFrame
  5929. dropdownHolderInner.Active = true
  5930. dropdownHolderInner.AnchorPoint = Vector2.new(0.5, 0.5)
  5931. dropdownHolderInner.BackgroundColor3 = library.colors.topGradient
  5932. colored[1 + #colored] = {dropdownHolderInner, "BackgroundColor3", "topGradient"}
  5933. dropdownHolderInner.BorderColor3 = library.colors.elementBorder
  5934. colored[1 + #colored] = {dropdownHolderInner, "BorderColor3", "elementBorder"}
  5935. dropdownHolderInner.Position = UDim2.fromScale(0.5, 0.5)
  5936. dropdownHolderInner.Selectable = true
  5937. dropdownHolderInner.Size = UDim2.new(1, -4, 1, -4)
  5938. dropdownHolderInner.Image = "rbxassetid://2454009026"
  5939. dropdownHolderInner.ImageColor3 = library.colors.bottomGradient
  5940. colored[1 + #colored] = {dropdownHolderInner, "ImageColor3", "bottomGradient"}
  5941. realDropdownHolder.Name = "realDropdownHolder"
  5942. realDropdownHolder.Parent = dropdownHolderInner
  5943. realDropdownHolder.BackgroundColor3 = Color3.new(1, 1, 1)
  5944. realDropdownHolder.BackgroundTransparency = 1
  5945. realDropdownHolder.Selectable = false
  5946. realDropdownHolder.Size = UDim2.fromScale(1, 1)
  5947. realDropdownHolder.CanvasSize = UDim2.new()
  5948. realDropdownHolder.ScrollBarThickness = 5
  5949. realDropdownHolder.ScrollingDirection = Enum.ScrollingDirection.Y
  5950. realDropdownHolder.AutomaticCanvasSize = Enum.AutomaticSize.Y
  5951. realDropdownHolder.ScrollBarImageTransparency = 0.5
  5952. realDropdownHolder.ScrollBarImageColor3 = library.colors.section
  5953. colored[1 + #colored] = {realDropdownHolder, "ScrollBarImageColor3", "section"}
  5954. realDropdownHolderList.Name = "realDropdownHolderList"
  5955. realDropdownHolderList.Parent = realDropdownHolder
  5956. realDropdownHolderList.HorizontalAlignment = Enum.HorizontalAlignment.Center
  5957. realDropdownHolderList.SortOrder = Enum.SortOrder.LayoutOrder
  5958. sectionFunctions:Update()
  5959. local showing = false
  5960. local function UpdateDropdownHolder()
  5961. if optionCount >= 6 then
  5962. realDropdownHolder.CanvasSize = UDim2:fromOffset(realDropdownHolderList.AbsoluteContentSize.Y + 2)
  5963. elseif optionCount <= 5 then
  5964. dropdownHolderFrame.Size = UDim2.fromOffset(206, realDropdownHolderList.AbsoluteContentSize.Y + 4)
  5965. end
  5966. end
  5967. local validate = nil
  5968. local SetupValidation = nil
  5969. do
  5970. local Signals = {}
  5971. local Setup = nil
  5972. function SetupValidation()
  5973. for k, v in next, Signals do
  5974. v = v and v:Disconnect()
  5975. Signals[k] = nil
  5976. end
  5977. if options.AutoValidate and list and (typeof(list) == "Instance") then
  5978. local Val = library_flags[flagName] or selectedOption
  5979. if multiselect then
  5980. for _, v in next, Val do
  5981. Setup(v)
  5982. end
  5983. else
  5984. Setup(Val)
  5985. end
  5986. end
  5987. end
  5988. local gpcs = game.GetPropertyChangedSignal
  5989. function Setup(v)
  5990. if typeof(v) == "Instance" then
  5991. local Signal = nil
  5992. Signal = gpcs(v, "Parent"):Connect(function()
  5993. if options.AutoValidate then
  5994. if list and (v.Parent ~= list) then
  5995. Signal = (Signal and Signal:Disconnect() and nil) or nil
  5996. validate()
  5997. end
  5998. else
  5999. for k, v in next, Signals do
  6000. v = v and v:Disconnect()
  6001. Signals[k] = nil
  6002. end
  6003. end
  6004. end)
  6005. end
  6006. end
  6007. end
  6008. local restorezindex = {}
  6009. local Set = (multiselect and function(t, dat)
  6010. if nil == dat and t ~= nil then
  6011. dat = t
  6012. end
  6013. local lastv = library_flags[flagName]
  6014. if not lastv or selectedOption ~= lastv then
  6015. if lastv and type(lastv) == "table" then
  6016. selectedOption = library_flags[flagName]
  6017. else
  6018. library_flags[flagName] = selectedOption
  6019. end
  6020. warn("Attempting to use new table for", flagName, " Please use :Set(), as setting through flags table may cause errors", debug.traceback(""))
  6021. lastv = library_flags[flagName]
  6022. end
  6023. local cloned = {unpack(selectedOption)}
  6024. if not dat then
  6025. if #selectedOption ~= 0 then
  6026. table.clear(selectedOption)
  6027. if callback then
  6028. task.spawn(callback, selectedOption, cloned)
  6029. end
  6030. end
  6031. return selectedOption
  6032. elseif type(dat) ~= "table" then
  6033. warn("Expected table for argument #1 on Set for MultiSelect dropdown. Got", dat, debug.traceback(""))
  6034. return selectedOption
  6035. end
  6036. for k = table.pack(unpack(dat)).n, 1, -1 do
  6037. if dat[k] == nil then
  6038. table.remove(dat, k)
  6039. end
  6040. end
  6041. local proceed = #cloned ~= #dat
  6042. table.clear(selectedOption)
  6043. for k, v in next, dat do
  6044. selectedOption[k] = v
  6045. if not proceed and cloned[k] ~= v then
  6046. proceed = 1
  6047. end
  6048. end
  6049. dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or tostring(blankstring or "Select Item(s)")
  6050. if proceed and callback then
  6051. task.spawn(callback, selectedOption, cloned)
  6052. end
  6053. if options.AutoValidate then
  6054. SetupValidation()
  6055. end
  6056. return selectedOption
  6057. end) or function(t, str)
  6058. if nil == str and t ~= nil then
  6059. str = t
  6060. end
  6061. local last_v = library_flags[flagName]
  6062. selectedOption = str
  6063. library_flags[flagName] = str
  6064. if options.Location then
  6065. options.Location[options.LocationFlag or flagName] = str
  6066. end
  6067. local sstr = (selectedOption and tostring(selectedOption)) or blankstring or "No Blank String"
  6068. if dropdownSelection.Text ~= sstr then
  6069. dropdownSelection.Text = sstr
  6070. end
  6071. if callback and (last_v ~= str or options.AllowDuplicateCalls) then
  6072. task.spawn(callback, str, last_v)
  6073. end
  6074. if options.AutoValidate then
  6075. SetupValidation()
  6076. end
  6077. return str
  6078. end
  6079. if val ~= nil then
  6080. Set(val)
  6081. else
  6082. library_flags[flagName] = selectedOption
  6083. if options.Location then
  6084. options.Location[options.LocationFlag or flagName] = selectedOption
  6085. end
  6086. if options.AutoValidate then
  6087. SetupValidation()
  6088. end
  6089. end
  6090. local function AddOptions(optionsTable)
  6091. if options.Sort then
  6092. local didstuff, dosort = nil, options.Sort
  6093. if type(dosort) == "function" then
  6094. local g, h = pcall(table.sort, optionsTable, dosort)
  6095. if g then
  6096. didstuff = true
  6097. elseif h then
  6098. warn("Error sorting list:", h, debug.traceback(""))
  6099. end
  6100. elseif (dosort ~= 1) and (dosort ~= true) then
  6101. warn("Potential mistake for passed Sort argument:", dosort, debug.traceback(""))
  6102. end
  6103. if not didstuff then
  6104. table.sort(optionsTable, library.defaultSort)
  6105. end
  6106. end
  6107. if blankstring and ((optionsTable[1] ~= blankstring) or table.find(optionsTable, blankstring, 2)) then
  6108. local exists = table.find(optionsTable, blankstring)
  6109. if exists then
  6110. for _ = 1, 35 do
  6111. table.remove(optionsTable, exists)
  6112. exists = table.find(optionsTable, blankstring)
  6113. if not exists then
  6114. break
  6115. end
  6116. end
  6117. end
  6118. table.insert(optionsTable, 1, blankstring)
  6119. end
  6120. optionCount = 0
  6121. realDropdownHolderList.Parent = nil
  6122. realDropdownHolder:ClearAllChildren()
  6123. realDropdownHolderList.Parent = realDropdownHolder
  6124. for _, v in next, optionsTable do
  6125. optionCount = optionCount + 1
  6126. local newOption = Instance_new("ImageLabel")
  6127. local optionButton = Instance_new("TextButton")
  6128. if selectedOption == v then
  6129. selectedObjects[1] = newOption
  6130. selectedObjects[2] = optionButton
  6131. end
  6132. newOption.Name = "Frame"
  6133. newOption.Parent = realDropdownHolder
  6134. local togged = (not multiselect and selectedOption == v) or (multiselect and table.find(selectedOption, v))
  6135. newOption.BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient
  6136. newOption.BorderSizePixel = 0
  6137. newOption.Size = UDim2.fromOffset(202, 18)
  6138. newOption.Image = "rbxassetid://2454009026"
  6139. newOption.ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
  6140. local stringed = tostring(v)
  6141. optionButton.Name = stringed
  6142. optionButton.Parent = newOption
  6143. optionButton.AnchorPoint = Vector2.new(0.5, 0.5)
  6144. optionButton.BackgroundColor3 = Color3.new(1, 1, 1)
  6145. optionButton.BackgroundTransparency = 1
  6146. optionButton.Position = UDim2.fromScale(0.5, 0.5)
  6147. optionButton.Size = UDim2.new(1, -10, 1)
  6148. optionButton.ZIndex = 5
  6149. optionButton.Font = Enum.Font.Code
  6150. optionButton.Text = (togged and (" " .. stringed)) or stringed
  6151. optionButton.TextColor3 = (togged and library.colors.main) or library.colors.otherElementText
  6152. optionButton.TextSize = 14
  6153. optionButton.TextXAlignment = Enum.TextXAlignment.Left
  6154. library.signals[1 + #library.signals] = optionButton.MouseButton1Click:Connect(function()
  6155. if not library.colorpicker then
  6156. restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
  6157. restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
  6158. restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
  6159. if multiselect then
  6160. local cloned = {unpack(selectedOption)}
  6161. local togged = table.find(selectedOption, v)
  6162. if togged then
  6163. table.remove(selectedOption, togged)
  6164. else
  6165. selectedOption[1 + #selectedOption] = v
  6166. end
  6167. togged = table.find(selectedOption, v)
  6168. optionButton.Text = (togged and (" " .. stringed)) or stringed
  6169. newOption.BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient
  6170. newOption.ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
  6171. optionButton.TextColor3 = (togged and library.colors.main) or library.colors.otherElementText
  6172. dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or tostring(blankstring or "Select Item(s)")
  6173. if callback then
  6174. task.spawn(callback, selectedOption, cloned)
  6175. end
  6176. if togged then
  6177. if addcallback then
  6178. task.spawn(addcallback, v, selectedOption)
  6179. end
  6180. elseif delcallback then
  6181. task.spawn(delcallback, v, selectedOption)
  6182. end
  6183. if modcallback then
  6184. task.spawn(modcallback, v, togged, selectedOption)
  6185. end
  6186. if #selectedOption == 0 and clrcallback then
  6187. task.spawn(clrcallback, selectedOption, cloned)
  6188. end
  6189. return
  6190. else
  6191. if selectedOption ~= v then
  6192. local last_v = library_flags[flagName]
  6193. selectedObjects[1].BackgroundColor3 = library.colors.topGradient
  6194. selectedObjects[1].ImageColor3 = library.colors.bottomGradient
  6195. selectedObjects[2].Text = selectedObjects[2].Name
  6196. selectedObjects[2].TextColor3 = library.colors.otherElementText
  6197. selectedOption = v
  6198. dropdownSelection.Text = stringed
  6199. selectedObjects[1] = newOption
  6200. selectedObjects[2] = optionButton
  6201. newOption.BackgroundColor3 = library.colors.selectedOption
  6202. newOption.ImageColor3 = library.colors.unselectedOption
  6203. optionButton.Text = " " .. stringed
  6204. optionButton.TextColor3 = library.colors.main
  6205. dropdownHolderFrame.Visible = false
  6206. dropdownToggle.Rotation = 90
  6207. dropdownEnabled = false
  6208. newDropdown.ZIndex = 1
  6209. colored_dropdown_BackgroundColor3[3] = "topGradient"
  6210. colored_dropdown_BackgroundColor3[4] = nil
  6211. colored_dropdown_ImageColor3[3] = "bottomGradient"
  6212. colored_dropdown_ImageColor3[4] = nil
  6213. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  6214. BackgroundColor3 = library.colors.topGradient,
  6215. ImageColor3 = library.colors.bottomGradient
  6216. }):Play()
  6217. library_flags[flagName] = selectedOption
  6218. if options.Location then
  6219. options.Location[options.LocationFlag or flagName] = selectedOption
  6220. end
  6221. submenuOpen = nil
  6222. showing = false
  6223. if callback then
  6224. task.spawn(callback, selectedOption, last_v)
  6225. end
  6226. else
  6227. showing = false
  6228. submenuOpen = nil
  6229. dropdownToggle.Rotation = 90
  6230. newDropdown.ZIndex = 1
  6231. sectionHolder.ZIndex = 1
  6232. colored_dropdown_BackgroundColor3[3] = "topGradient"
  6233. colored_dropdown_BackgroundColor3[4] = nil
  6234. colored_dropdown_ImageColor3[3] = "bottomGradient"
  6235. colored_dropdown_ImageColor3[4] = nil
  6236. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  6237. BackgroundColor3 = library.colors.topGradient,
  6238. ImageColor3 = library.colors.bottomGradient
  6239. }):Play()
  6240. dropdownHolderFrame.Visible = false
  6241. end
  6242. end
  6243. for ins, z in next, restorezindex do
  6244. ins.ZIndex = z
  6245. end
  6246. end
  6247. end)
  6248. library.signals[1 + #library.signals] = optionButton.MouseEnter:Connect(function()
  6249. tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  6250. BackgroundColor3 = library.colors.hoveredOptionTop,
  6251. ImageColor3 = library.colors.hoveredOptionBottom
  6252. }):Play()
  6253. end)
  6254. library.signals[1 + #library.signals] = optionButton.MouseLeave:Connect(function()
  6255. local togged = (not multiselect and selectedOption == v) or (multiselect and table.find(selectedOption, v))
  6256. tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  6257. BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient,
  6258. ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
  6259. }):Play()
  6260. end)
  6261. UpdateDropdownHolder()
  6262. end
  6263. end
  6264. local precisionscrolling, update = nil
  6265. local function display(dropdownEnabled)
  6266. list = resolvelist()
  6267. if next(list) then
  6268. else
  6269. local EmptyVal = options.EmptyValue
  6270. if EmptyVal ~= nil then
  6271. table.insert(list, 1, EmptyVal)
  6272. end
  6273. end
  6274. if dropdownEnabled then
  6275. AddOptions(list)
  6276. submenuOpen = dropdown
  6277. dropdownToggle.Rotation = 270
  6278. restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
  6279. restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
  6280. restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
  6281. newSection.ZIndex = 50 + newSection.ZIndex
  6282. newDropdown.ZIndex = 2
  6283. sectionHolder.ZIndex = 2
  6284. colored_dropdown_BackgroundColor3[3] = "main"
  6285. colored_dropdown_BackgroundColor3[4] = 1.5
  6286. colored_dropdown_ImageColor3[3] = "main"
  6287. colored_dropdown_ImageColor3[4] = 2.5
  6288. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  6289. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  6290. ImageColor3 = darkenColor(library.colors.main, 2.5)
  6291. }):Play()
  6292. dropdownHolderFrame.Visible = true
  6293. if not options.DisablePrecisionScrolling then
  6294. local upkey = options.ScrollUpButton or library.scrollupbutton or shared.scrollupbutton or Enum.KeyCode.Up
  6295. local downkey = options.ScrollDownButton or library.scrolldownbutton or shared.scrolldownbutton or Enum.KeyCode.Down
  6296. precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or userInputService.InputBegan:Connect(function(input)
  6297. if input.UserInputType == Enum.UserInputType.Keyboard then
  6298. local code = input.KeyCode
  6299. local isup = code == upkey
  6300. local isdown = code == downkey
  6301. if isup or isdown then
  6302. local txt = userInputService:GetFocusedTextBox()
  6303. if not txt or txt == dropdownSelection then
  6304. while wait_check() and userInputService:IsKeyDown(code) do
  6305. realDropdownHolder.CanvasPosition = Vector2:new(math.clamp(realDropdownHolder.CanvasPosition.Y + ((isup and -5) or 5), 0, realDropdownHolder.AbsoluteCanvasSize.Y))
  6306. end
  6307. end
  6308. end
  6309. end
  6310. end)
  6311. library.signals[1 + #library.signals] = precisionscrolling
  6312. end
  6313. else
  6314. submenuOpen = nil
  6315. dropdownToggle.Rotation = 90
  6316. colored_dropdown_BackgroundColor3[3] = "topGradient"
  6317. colored_dropdown_BackgroundColor3[4] = nil
  6318. colored_dropdown_ImageColor3[3] = "bottomGradient"
  6319. colored_dropdown_ImageColor3[4] = nil
  6320. tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
  6321. BackgroundColor3 = library.colors.topGradient,
  6322. ImageColor3 = library.colors.bottomGradient
  6323. }):Play()
  6324. dropdownHolderFrame.Visible = false
  6325. for ins, z in next, restorezindex do
  6326. ins.ZIndex = z
  6327. end
  6328. precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or nil
  6329. end
  6330. if not multiselect and (not next(list) or not table.find(list, library_flags[flagName])) then
  6331. Set(list[1])
  6332. end
  6333. showing = dropdownEnabled
  6334. if showing or dropdownEnabled then
  6335. else
  6336. delay(0.01, update)
  6337. end
  6338. end
  6339. library.signals[1 + #library.signals] = newDropdown.InputEnded:Connect(function(input)
  6340. if not library.colorpicker and input.UserInputType == Enum.UserInputType.MouseButton1 then
  6341. showing = not showing
  6342. display(showing)
  6343. end
  6344. end)
  6345. library.signals[1 + #library.signals] = newDropdown.MouseEnter:Connect(function()
  6346. colored_dropdown_BackgroundColor3[3] = "main"
  6347. colored_dropdown_BackgroundColor3[4] = 1.5
  6348. colored_dropdown_ImageColor3[3] = "main"
  6349. colored_dropdown_ImageColor3[4] = 2.5
  6350. tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  6351. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  6352. ImageColor3 = darkenColor(library.colors.main, 2.5)
  6353. }):Play()
  6354. end)
  6355. library.signals[1 + #library.signals] = newDropdown.MouseLeave:Connect(function()
  6356. if not dropdownEnabled then
  6357. colored_dropdown_BackgroundColor3[3] = "topGradient"
  6358. colored_dropdown_BackgroundColor3[4] = nil
  6359. colored_dropdown_ImageColor3[3] = "bottomGradient"
  6360. colored_dropdown_ImageColor3[4] = nil
  6361. tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  6362. BackgroundColor3 = library.colors.topGradient,
  6363. ImageColor3 = library.colors.bottomGradient
  6364. }):Play()
  6365. end
  6366. end)
  6367. library.signals[1 + #library.signals] = dropdownToggle.MouseButton1Click:Connect(function()
  6368. if not library.colorpicker then
  6369. showing = not showing
  6370. display(showing)
  6371. end
  6372. end)
  6373. AddOptions(list)
  6374. local default = library_flags[flagName]
  6375. function update()
  6376. dropdownName, callback = options.Name or dropdownName, options.Callback
  6377. local sstr = (passed_multiselect == "string" and multiselect) or (library_flags[flagName] and tostring(library_flags[flagName])) or (selectedOption and tostring(selectedOption)) or blankstring or "nil"
  6378. if dropdownSelection.Text ~= sstr then
  6379. dropdownSelection.Text = sstr
  6380. end
  6381. dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
  6382. return sstr
  6383. end
  6384. function validate(fallbackValue)
  6385. if list and table.find(list, library_flags[flagName]) then
  6386. update()
  6387. return true
  6388. end
  6389. if fallbackValue ~= nil then
  6390. if fallbackValue == "__DEFAULT" then
  6391. fallbackValue = fallbackValue
  6392. end
  6393. else
  6394. fallbackValue = list[1]
  6395. end
  6396. return Set((multiselect and {fallbackValue}) or fallbackValue)
  6397. end
  6398. local objectdata = {
  6399. Options = options,
  6400. Name = flagName,
  6401. Flag = flagName,
  6402. Type = "Dropdown",
  6403. Default = default,
  6404. Parent = sectionFunctions,
  6405. Instance = dropdownSelection,
  6406. Get = function()
  6407. return library_flags[flagName]
  6408. end,
  6409. Set = Set,
  6410. Remove = function()
  6411. if newDropdown then
  6412. newDropdown.Parent = nil
  6413. sectionFunctions:Update()
  6414. end
  6415. end,
  6416. RawSet = ((multiselect and function(t, dat)
  6417. if nil == dat and t ~= nil then
  6418. dat = t
  6419. end
  6420. local lastv = library_flags[flagName]
  6421. if not lastv or selectedOption ~= lastv then
  6422. if lastv and type(lastv) == "table" then
  6423. selectedOption = library_flags[flagName]
  6424. else
  6425. library_flags[flagName] = selectedOption
  6426. end
  6427. warn("Attempting to use new table for", flagName, " Please use :Set(), as setting through flags table may cause errors", debug.traceback(""))
  6428. lastv = library_flags[flagName]
  6429. end
  6430. local cloned = {unpack(selectedOption)}
  6431. if not dat then
  6432. if #selectedOption ~= 0 then
  6433. table.clear(selectedOption)
  6434. end
  6435. return selectedOption
  6436. elseif type(dat) ~= "table" then
  6437. warn("Expected table for argument #1 on Set for MultiSelect dropdown. Got", dat, debug.traceback(""))
  6438. return selectedOption
  6439. end
  6440. for k = table.pack(unpack(dat)).n, 1, -1 do
  6441. if dat[k] == nil then
  6442. table.remove(dat, k)
  6443. end
  6444. end
  6445. table.clear(selectedOption)
  6446. for k, v in next, dat do
  6447. selectedOption[k] = v
  6448. end
  6449. return selectedOption
  6450. end) or function(t, str)
  6451. if nil == str and t ~= nil then
  6452. str = t
  6453. end
  6454. selectedOption = str
  6455. library_flags[flagName] = str
  6456. if options.Location then
  6457. options.Location[options.LocationFlag or flagName] = str
  6458. end
  6459. update()
  6460. return str
  6461. end),
  6462. Update = update,
  6463. Reset = function()
  6464. return Set(nil, default)
  6465. end
  6466. }
  6467. function objectdata.UpdateList(t, listt, updateValues)
  6468. if (nil == listt and t ~= nil) or (type(t) == "table" and type(listt) ~= "table") then
  6469. listt, updateValues = t, listt
  6470. end
  6471. if listt == objectdata then
  6472. listt = nil
  6473. end
  6474. resolvelist = getresolver(listt or options.List, options.Filter, options.Method)
  6475. list = resolvelist()
  6476. if next(list) then
  6477. else
  6478. local EmptyVal = options.EmptyValue
  6479. if EmptyVal ~= nil then
  6480. table.insert(list, 1, EmptyVal)
  6481. end
  6482. end
  6483. if updateValues then
  6484. validate()
  6485. end
  6486. if showing then
  6487. display(false)
  6488. display(true)
  6489. end
  6490. return list
  6491. end
  6492. tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
  6493. return objectdata
  6494. end
  6495. sectionFunctions.AddDropDown = sectionFunctions.AddDropdown
  6496. sectionFunctions.NewDropDown = sectionFunctions.AddDropdown
  6497. sectionFunctions.NewDropdown = sectionFunctions.AddDropdown
  6498. sectionFunctions.CreateDropdown = sectionFunctions.AddDropdown
  6499. sectionFunctions.CreateDropdown = sectionFunctions.AddDropdown
  6500. sectionFunctions.DropDown = sectionFunctions.AddDropdown
  6501. sectionFunctions.Dropdown = sectionFunctions.AddDropdown
  6502. sectionFunctions.DD = sectionFunctions.AddDropdown
  6503. sectionFunctions.Dd = sectionFunctions.AddDropdown
  6504. function sectionFunctions:AddColorpicker(options, ...)
  6505. options = (options and type(options) == "string" and resolvevararg("Colorpicker", options, ...)) or options
  6506. if options.Random == true then
  6507. options.Value = "random"
  6508. elseif options.Rainbow == true then
  6509. options.Value = "rainbow"
  6510. end
  6511. local colorPickerName, presetColor, callback, flagName = assert(options.Name, "Missing Name for new colorpicker."), options.Value, options.Callback, options.Flag or (function()
  6512. library.unnamedcolorpicker = 1 + (library.unnamedcolorpicker or 0)
  6513. return "Colorpicker" .. tostring(library.unnamedcolorpicker)
  6514. end)()
  6515. if elements[flagName] ~= nil then
  6516. warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
  6517. end
  6518. local designers = options.__designer
  6519. options.__designer = nil
  6520. local rainbowColorMode = false
  6521. if presetColor == "random" then
  6522. presetColor = Color3.new(math.random(), math.random(), math.random())
  6523. elseif presetColor == "rainbow" then
  6524. presetColor = Color3.new(1, 1, 1)
  6525. rainbowColorMode = true
  6526. end
  6527. local newColorPicker = Instance_new("Frame")
  6528. local colorPicker = Instance_new("ImageLabel")
  6529. local colorPickerInner = Instance_new("ImageLabel")
  6530. local colorPickerHeadline = Instance_new("TextLabel")
  6531. local colorPickerButton = Instance_new("TextButton")
  6532. local colorPickerHolderFrame = Instance_new("ImageLabel")
  6533. local colorPickerHolderInner = Instance_new("ImageLabel")
  6534. local color = Instance_new("ImageLabel")
  6535. local selectorColor = Instance_new("Frame")
  6536. local hue = Instance_new("ImageLabel")
  6537. local hueGradient = Instance_new("UIGradient")
  6538. local selectorHue = Instance_new("Frame")
  6539. local randomColor = Instance_new("ImageLabel")
  6540. local randomColorInner = Instance_new("ImageLabel")
  6541. local randomColorButton = Instance_new("ImageButton")
  6542. local hexInputBox = Instance_new("TextBox")
  6543. local hexInput = Instance_new("ImageLabel")
  6544. local hexInputInner = Instance_new("ImageLabel")
  6545. local rainbow = Instance_new("ImageLabel")
  6546. local rainbowInner = Instance_new("ImageLabel")
  6547. local rainbowButton = Instance_new("ImageButton")
  6548. local startingColor = presetColor or Color3.new(1, 1, 1)
  6549. local colorPickerEnabled = false
  6550. local colorH, colorS, colorV = 1, 1, 1
  6551. local colorInput, hueInput = nil, nil
  6552. local oldBackgroundColor = Color3.new()
  6553. local oldImageColor = oldBackgroundColor
  6554. local oldColor = oldBackgroundColor
  6555. local rainbowColorValue = 0
  6556. newColorPicker.Name = "newColorPicker"
  6557. newColorPicker.Parent = sectionHolder
  6558. newColorPicker.BackgroundColor3 = Color3.new(1, 1, 1)
  6559. newColorPicker.BackgroundTransparency = 1
  6560. newColorPicker.Size = UDim2.new(1, 0, 0, 19)
  6561. colorPicker.Name = "colorPicker"
  6562. colorPicker.Parent = newColorPicker
  6563. colorPicker.Active = true
  6564. colorPicker.BackgroundColor3 = library.colors.topGradient
  6565. local colored_colorPicker_BackgroundColor3 = {colorPicker, "BackgroundColor3", "topGradient"}
  6566. colored[1 + #colored] = colored_colorPicker_BackgroundColor3
  6567. colorPicker.BorderColor3 = library.colors.elementBorder
  6568. colored[1 + #colored] = {colorPicker, "BorderColor3", "elementBorder"}
  6569. colorPicker.Position = UDim2.fromScale(0.842, 0.113)
  6570. colorPicker.Selectable = true
  6571. colorPicker.Size = UDim2.fromOffset(24, 12)
  6572. colorPicker.Image = "rbxassetid://2454009026"
  6573. colorPicker.ImageColor3 = library.colors.bottomGradient
  6574. local colored_colorPicker_ImageColor3 = {colorPicker, "ImageColor3", "bottomGradient"}
  6575. colored[1 + #colored] = colored_colorPicker_ImageColor3
  6576. colorPickerInner.Name = "colorPickerInner"
  6577. colorPickerInner.Parent = colorPicker
  6578. colorPickerInner.Active = true
  6579. colorPickerInner.AnchorPoint = Vector2.new(0.5, 0.5)
  6580. colorPickerInner.BorderColor3 = library.colors.elementBorder
  6581. colored[1 + #colored] = {colorPickerInner, "BorderColor3", "elementBorder"}
  6582. colorPickerInner.Position = UDim2.fromScale(0.5, 0.5)
  6583. colorPickerInner.Selectable = true
  6584. colorPickerInner.Size = UDim2.new(1, -4, 1, -4)
  6585. colorPickerInner.Image = "rbxassetid://2454009026"
  6586. colorPickerInner.BackgroundColor3 = darkenColor(startingColor, 1.5)
  6587. colorPickerInner.ImageColor3 = darkenColor(startingColor, 2.5)
  6588. colorPickerHeadline.Name = "colorPickerHeadline"
  6589. colorPickerHeadline.Parent = newColorPicker
  6590. colorPickerHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
  6591. colorPickerHeadline.BackgroundTransparency = 1
  6592. colorPickerHeadline.Position = UDim2.fromScale(0.034, 0.113)
  6593. colorPickerHeadline.Size = UDim2.fromOffset(173, 11)
  6594. colorPickerHeadline.Font = Enum.Font.Code
  6595. colorPickerHeadline.Text = colorPickerName or "???"
  6596. colorPickerHeadline.TextColor3 = library.colors.elementText
  6597. colored[1 + #colored] = {colorPickerHeadline, "TextColor3", "elementText"}
  6598. colorPickerHeadline.TextSize = 14
  6599. colorPickerHeadline.TextXAlignment = Enum.TextXAlignment.Left
  6600. colorPickerButton.Name = "colorPickerButton"
  6601. colorPickerButton.Parent = newColorPicker
  6602. colorPickerButton.BackgroundColor3 = Color3.new(1, 1, 1)
  6603. colorPickerButton.BackgroundTransparency = 1
  6604. colorPickerButton.Size = UDim2.fromScale(1, 1)
  6605. colorPickerButton.ZIndex = 5
  6606. colorPickerButton.Font = Enum.Font.SourceSans
  6607. colorPickerButton.Text = ""
  6608. colorPickerButton.TextColor3 = Color3.new()
  6609. colorPickerButton.TextSize = 14
  6610. colorPickerButton.TextTransparency = 1
  6611. colorPickerButton.BorderColor3 = library.colors.elementBorder
  6612. local colored_colorPickerButton_BorderColor3 = {colorPickerButton, "BorderColor3", "elementBorder"}
  6613. colored[1 + #colored] = colored_colorPickerButton_BorderColor3
  6614. local function UpdateColorPicker(force, rainbsow)
  6615. local last_vv = library_flags[flagName]
  6616. local newColor = force or Color3.fromHSV(colorH, colorS, colorV)
  6617. if not force then
  6618. colorH, colorS, colorV = newColor:ToHSV()
  6619. end
  6620. colorPickerInner.BackgroundColor3 = darkenColor(newColor, 1.5)
  6621. colorPickerInner.ImageColor3 = darkenColor(newColor, 2.5)
  6622. color.BackgroundColor3 = Color3.fromHSV(colorH, 1, 1)
  6623. library_flags[flagName] = newColor
  6624. if options.Location then
  6625. options.Location[options.LocationFlag or flagName] = newColor
  6626. end
  6627. hexInputBox.Text = Color3ToHex(newColor)
  6628. if force then
  6629. color.BackgroundColor3 = force
  6630. selectorColor.Position = UDim2.new(force and select(3, Color3.toHSV(force)))
  6631. end
  6632. local pos = 1 - (Color3.toHSV(newColor))
  6633. local scalex = selectorHue.Position.X.Scale
  6634. if scalex ~= pos and not (((pos == 0) or (pos == 1)) and ((scalex == 1) or (scalex == 0))) then
  6635. selectorHue.Position = UDim2.new(pos)
  6636. end
  6637. if callback and last_vv ~= newColor then
  6638. task.spawn(callback, newColor, last_vv, rainbsow)
  6639. end
  6640. end
  6641. library.signals[1 + #library.signals] = colorPickerButton.MouseButton1Click:Connect(function()
  6642. if submenuOpen == colorPicker or submenuOpen == nil then
  6643. colorPickerEnabled = not colorPickerEnabled
  6644. library.colorpicker = colorPickerEnabled
  6645. colorPickerHolderFrame.Visible = colorPickerEnabled
  6646. if colorPickerEnabled then
  6647. for _, v in next, colorpickerconflicts do
  6648. v.Visible = false
  6649. end
  6650. submenuOpen = colorPicker
  6651. newColorPicker.ZIndex = 2
  6652. newSection.ZIndex = 100 + newSection.ZIndex
  6653. colorPickerButton.BorderColor3 = library.colors.main
  6654. colored_colorPickerButton_BorderColor3[3] = "main"
  6655. UpdateColorPicker()
  6656. else
  6657. for _, v in next, colorpickerconflicts do
  6658. v.Visible = true
  6659. end
  6660. submenuOpen = nil
  6661. newColorPicker.ZIndex = 0
  6662. newSection.ZIndex = newSection.ZIndex - 100
  6663. colorPickerButton.BorderColor3 = library.colors.elementBorder
  6664. colored_colorPickerButton_BorderColor3[3] = "elementBorder"
  6665. end
  6666. end
  6667. end)
  6668. colorPickerHolderFrame.Name = "colorPickerHolderFrame"
  6669. colorPickerHolderFrame.Parent = newColorPicker
  6670. colorPickerHolderFrame.Active = true
  6671. colorPickerHolderFrame.BackgroundColor3 = library.colors.topGradient
  6672. colored[1 + #colored] = {colorPickerHolderFrame, "BackgroundColor3", "topGradient"}
  6673. colorPickerHolderFrame.BorderColor3 = library.colors.elementBorder
  6674. colored[1 + #colored] = {colorPickerHolderFrame, "BorderColor3", "elementBorder"}
  6675. colorPickerHolderFrame.Selectable = true
  6676. colorPickerHolderFrame.Position = UDim2.fromScale(0.025, 1.012)
  6677. colorPickerHolderFrame.Size = UDim2.fromOffset(206, 250)
  6678. if math.ceil(colorPickerHolderFrame.AbsolutePosition.Y + colorPickerHolderFrame.AbsoluteSize.Y) > floor(newTabHolder.AbsoluteSize.Y + newTabHolder.AbsolutePosition.Y) then
  6679. colorPickerHolderFrame.Position = UDim2.new(0.025, 0, 1.012, -colorPickerHolderFrame.AbsoluteSize.Y - colorPickerButton.AbsoluteSize.Y - 2)
  6680. end
  6681. colorPickerHolderFrame.Visible = false
  6682. colorPickerHolderFrame.Image = "rbxassetid://2454009026"
  6683. colorPickerHolderFrame.ImageColor3 = library.colors.bottomGradient
  6684. colored[1 + #colored] = {colorPickerHolderFrame, "ImageColor3", "bottomGradient"}
  6685. colorPickerHolderInner.Name = "colorPickerHolderInner"
  6686. colorPickerHolderInner.Parent = colorPickerHolderFrame
  6687. colorPickerHolderInner.Active = true
  6688. colorPickerHolderInner.AnchorPoint = Vector2.new(0.5, 0.5)
  6689. colorPickerHolderInner.BackgroundColor3 = library.colors.topGradient
  6690. colored[1 + #colored] = {colorPickerHolderInner, "BackgroundColor3", "topGradient"}
  6691. colorPickerHolderInner.BorderColor3 = library.colors.elementBorder
  6692. colored[1 + #colored] = {colorPickerHolderInner, "BorderColor3", "elementBorder"}
  6693. colorPickerHolderInner.Position = UDim2.fromScale(0.5, 0.5)
  6694. colorPickerHolderInner.Selectable = true
  6695. colorPickerHolderInner.Size = UDim2.new(1, -4, 1, -4)
  6696. colorPickerHolderInner.Image = "rbxassetid://2454009026"
  6697. colorPickerHolderInner.ImageColor3 = library.colors.bottomGradient
  6698. colored[1 + #colored] = {colorPickerHolderInner, "ImageColor3", "bottomGradient"}
  6699. color.Name = "color"
  6700. color.Parent = colorPickerHolderInner
  6701. color.BackgroundColor3 = startingColor
  6702. color.BorderSizePixel = 0
  6703. color.Position = UDim2.fromOffset(5, 5)
  6704. color.Size = UDim2.new(1, -10, 0, 192)
  6705. color.Image = "rbxassetid://4155801252"
  6706. selectorColor.Name = "selectorColor"
  6707. selectorColor.Parent = color
  6708. selectorColor.AnchorPoint = Vector2.new(0.5, 0.5)
  6709. selectorColor.BackgroundColor3 = Color3.fromRGB(144, 144, 144)
  6710. selectorColor.BorderColor3 = Color3.fromRGB(69, 65, 70)
  6711. selectorColor.Position = UDim2.new(startingColor and select(3, Color3.toHSV(startingColor)))
  6712. selectorColor.Size = UDim2.fromOffset(4, 4)
  6713. hue.Name = "hue"
  6714. hue.Parent = colorPickerHolderInner
  6715. hue.BackgroundColor3 = Color3.new(1, 1, 1)
  6716. hue.BorderSizePixel = 0
  6717. hue.Position = UDim2.fromOffset(5, 202)
  6718. hue.Size = UDim2.new(1, -10, 0, 14)
  6719. hue.Image = "rbxassetid://3570695787"
  6720. hue.ScaleType = Enum.ScaleType.Slice
  6721. hue.SliceScale = 0.01
  6722. hueGradient.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 4)), ColorSequenceKeypoint.new(0.17, Color3.fromRGB(235, 7, 255)), ColorSequenceKeypoint.new(0.33, Color3:fromRGB(9, 189)), ColorSequenceKeypoint.new(0.5, Color3:fromRGB(193, 196)), ColorSequenceKeypoint.new(0.66, Color3:new(1)), ColorSequenceKeypoint.new(0.84, Color3.fromRGB(255, 247)), ColorSequenceKeypoint.new(1, Color3.new(1))})
  6723. hueGradient.Name = "hueGradient"
  6724. hueGradient.Parent = hue
  6725. selectorHue.Name = "selectorHue"
  6726. selectorHue.Parent = hue
  6727. selectorHue.BackgroundColor3 = Color3:fromRGB(125, 255)
  6728. selectorHue.BackgroundTransparency = 0.2
  6729. selectorHue.BorderColor3 = Color3:fromRGB(84, 91)
  6730. selectorHue.Position = UDim2.new(1 - (Color3.toHSV(startingColor)))
  6731. selectorHue.Size = UDim2:new(2, 1)
  6732. hexInput.Name = "hexInput"
  6733. hexInput.Parent = colorPickerHolderInner
  6734. hexInput.Active = true
  6735. hexInput.BackgroundColor3 = library.colors.topGradient
  6736. colored[1 + #colored] = {hexInput, "BackgroundColor3", "topGradient"}
  6737. hexInput.BorderColor3 = library.colors.elementBorder
  6738. colored[1 + #colored] = {hexInput, "BorderColor3", "elementBorder"}
  6739. hexInput.Position = UDim2.fromOffset(5, 223)
  6740. hexInput.Selectable = true
  6741. hexInput.Size = UDim2.fromOffset(150, 18)
  6742. hexInput.Image = "rbxassetid://2454009026"
  6743. hexInput.ImageColor3 = library.colors.bottomGradient
  6744. colored[1 + #colored] = {hexInput, "ImageColor3", "bottomGradient"}
  6745. hexInputInner.Name = "hexInputInner"
  6746. hexInputInner.Parent = hexInput
  6747. hexInputInner.Active = true
  6748. hexInputInner.AnchorPoint = Vector2.new(0.5, 0.5)
  6749. hexInputInner.BackgroundColor3 = library.colors.topGradient
  6750. colored[1 + #colored] = {hexInputInner, "BackgroundColor3", "topGradient"}
  6751. hexInputInner.BorderColor3 = library.colors.elementBorder
  6752. colored[1 + #colored] = {hexInputInner, "BorderColor3", "elementBorder"}
  6753. hexInputInner.Position = UDim2.fromScale(0.5, 0.5)
  6754. hexInputInner.Selectable = true
  6755. hexInputInner.Size = UDim2.new(1, -4, 1, -4)
  6756. hexInputInner.Image = "rbxassetid://2454009026"
  6757. hexInputInner.ImageColor3 = library.colors.bottomGradient
  6758. colored[1 + #colored] = {hexInputInner, "ImageColor3", "bottomGradient"}
  6759. hexInputBox.Name = "hexInputBox"
  6760. hexInputBox.Parent = hexInput
  6761. hexInputBox.BackgroundColor3 = Color3.new(1, 1, 1)
  6762. hexInputBox.BackgroundTransparency = 1
  6763. hexInputBox.Size = UDim2.fromScale(1, 1)
  6764. hexInputBox.ZIndex = 5
  6765. hexInputBox.Font = Enum.Font.Code
  6766. hexInputBox.PlaceholderText = "Hex Input"
  6767. hexInputBox.Text = Color3ToHex(startingColor)
  6768. hexInputBox.TextColor3 = library.colors.elementText
  6769. colored[1 + #colored] = {hexInputBox, "TextColor3", "elementText"}
  6770. hexInputBox.TextSize = 14
  6771. hexInputBox.ClearTextOnFocus = false
  6772. randomColor.Name = "randomColor"
  6773. randomColor.Parent = colorPickerHolderInner
  6774. randomColor.Active = true
  6775. randomColor.BackgroundColor3 = library.colors.topGradient
  6776. colored[1 + #colored] = {randomColor, "BackgroundColor3", "topGradient"}
  6777. randomColor.BorderColor3 = library.colors.elementBorder
  6778. colored[1 + #colored] = {randomColor, "BorderColor3", "elementBorder"}
  6779. randomColor.Position = UDim2.fromOffset(158, 223)
  6780. randomColor.Selectable = true
  6781. randomColor.Size = UDim2.fromOffset(18, 18)
  6782. randomColor.Image = "rbxassetid://2454009026"
  6783. randomColor.ImageColor3 = library.colors.bottomGradient
  6784. colored[1 + #colored] = {randomColor, "ImageColor3", "bottomGradient"}
  6785. randomColorInner.Name = "randomColorInner"
  6786. randomColorInner.Parent = randomColor
  6787. randomColorInner.Active = true
  6788. randomColorInner.AnchorPoint = Vector2.new(0.5, 0.5)
  6789. randomColorInner.BackgroundColor3 = library.colors.topGradient
  6790. colored[1 + #colored] = {randomColorInner, "BackgroundColor3", "topGradient"}
  6791. randomColorInner.BorderColor3 = library.colors.elementBorder
  6792. colored[1 + #colored] = {randomColorInner, "BorderColor3", "elementBorder"}
  6793. randomColorInner.Position = UDim2.fromScale(0.5, 0.5)
  6794. randomColorInner.Selectable = true
  6795. randomColorInner.Size = UDim2.new(1, -4, 1, -4)
  6796. randomColorInner.Image = "rbxassetid://2454009026"
  6797. randomColorInner.ImageColor3 = library.colors.bottomGradient
  6798. colored[1 + #colored] = {randomColorInner, "ImageColor3", "bottomGradient"}
  6799. randomColorButton.Name = "randomColorButton"
  6800. randomColorButton.Parent = randomColor
  6801. randomColorButton.BackgroundColor3 = Color3.new(1, 1, 1)
  6802. randomColorButton.BackgroundTransparency = 1
  6803. randomColorButton.Size = UDim2.fromScale(1, 1)
  6804. randomColorButton.ZIndex = 5
  6805. randomColorButton.Image = "rbxassetid://7484765651"
  6806. rainbow.Name = "rainbow"
  6807. rainbow.Parent = colorPickerHolderInner
  6808. rainbow.Active = true
  6809. rainbow.BackgroundColor3 = library.colors.topGradient
  6810. colored[1 + #colored] = {rainbow, "BackgroundColor3", "topGradient"}
  6811. rainbow.BorderColor3 = library.colors.elementBorder
  6812. colored[1 + #colored] = {rainbow, "BorderColor3", "elementBorder"}
  6813. rainbow.Position = UDim2.fromOffset(158 + 18 + 4, 223)
  6814. rainbow.Selectable = true
  6815. rainbow.Size = UDim2.fromOffset(18, 18)
  6816. rainbow.Image = "rbxassetid://2454009026"
  6817. rainbow.ImageColor3 = library.colors.bottomGradient
  6818. colored[1 + #colored] = {rainbow, "ImageColor3", "bottomGradient"}
  6819. rainbowInner.Name = "rainbowInner"
  6820. rainbowInner.Parent = randomColor
  6821. rainbowInner.Active = true
  6822. rainbowInner.AnchorPoint = Vector2.new(0.5, 0.5)
  6823. rainbowInner.BackgroundColor3 = library.colors.topGradient
  6824. colored[1 + #colored] = {rainbowInner, "BackgroundColor3", "topGradient"}
  6825. rainbowInner.BorderColor3 = library.colors.elementBorder
  6826. colored[1 + #colored] = {rainbowInner, "BorderColor3", "elementBorder"}
  6827. rainbowInner.Position = UDim2.fromScale(0.5, 0.5)
  6828. rainbowInner.Selectable = true
  6829. rainbowInner.Size = UDim2.new(1, -4, 1, -4)
  6830. rainbowInner.Image = "rbxassetid://2454009026"
  6831. rainbowInner.ImageColor3 = library.colors.bottomGradient
  6832. colored[1 + #colored] = {rainbowInner, "ImageColor3", "bottomGradient"}
  6833. rainbowButton.Name = "rainbowButton"
  6834. rainbowButton.Parent = rainbow
  6835. rainbowButton.BackgroundColor3 = Color3.new(1, 1, 1)
  6836. rainbowButton.BackgroundTransparency = 1
  6837. rainbowButton.Size = UDim2.fromScale(1, 1)
  6838. rainbowButton.ZIndex = 5
  6839. rainbowButton.Image = "rbxassetid://7484772919"
  6840. local indexwith = (designers and "rainbows") or "rainbowsg"
  6841. local function setrainbow(t, rainbowColorMod)
  6842. if nil == rainbowColorMod and t ~= nil then
  6843. rainbowColorMod = t
  6844. end
  6845. if rainbowColorMod == nil or type(rainbowColorMod) ~= "boolean" then
  6846. rainbowColorMode = not rainbowColorMode
  6847. else
  6848. rainbowColorMode = rainbowColorMod
  6849. end
  6850. if colorInput then
  6851. colorInput = (colorInput:Disconnect() and nil) or nil
  6852. end
  6853. if hueInput then
  6854. hueInput = (hueInput:Disconnect() and nil) or nil
  6855. end
  6856. pcall(function()
  6857. if destroyrainbows and library.rainbows <= 0 then
  6858. destroyrainbows = nil
  6859. end
  6860. if destroyrainbowsg and library.rainbowsg <= 0 then
  6861. destroyrainbowsg = nil
  6862. end
  6863. end)
  6864. if rainbowColorMode then
  6865. pcall(function()
  6866. if not library.rainbowflags[flagName] then
  6867. library[indexwith] = 1 + library[indexwith]
  6868. end
  6869. library.rainbowflags[flagName] = true
  6870. oldImageColor = colorPickerInner.ImageColor3
  6871. oldBackgroundColor = colorPickerInner.BackgroundColor3
  6872. oldColor = color.BackgroundColor3
  6873. pcall(function()
  6874. local common_float = 1 / 255
  6875. while wait_check() and rainbowColorMode and (options.Value == "rainbow" or ((not designers and not destroyrainbowsg) or (designers and not destroyrainbows))) do
  6876. rainbowColorValue = common_float + rainbowColorValue
  6877. if rainbowColorValue > 1 then
  6878. rainbowColorValue = 0
  6879. end
  6880. colorH = rainbowColorValue
  6881. UpdateColorPicker(Color3.fromHSV(rainbowColorValue, 1, 1), true)
  6882. end
  6883. end)
  6884. end)
  6885. pcall(function()
  6886. rainbowColorMode = nil
  6887. if library.rainbowflags[flagName] then
  6888. library[indexwith] = library[indexwith] - 1
  6889. end
  6890. library.rainbowflags[flagName] = nil
  6891. end)
  6892. end
  6893. UpdateColorPicker(library_flags[flagName])
  6894. end
  6895. library.signals[1 + #library.signals] = randomColorButton.MouseButton1Click:Connect(function()
  6896. if rainbowColorMode then
  6897. setrainbow(false)
  6898. end
  6899. UpdateColorPicker(Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255)))
  6900. end)
  6901. library.signals[1 + #library.signals] = rainbowButton.MouseButton1Click:Connect(setrainbow)
  6902. sectionFunctions:Update()
  6903. library.signals[1 + #library.signals] = newColorPicker.MouseEnter:Connect(function()
  6904. tweenService:Create(colorPicker, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  6905. BackgroundColor3 = darkenColor(library.colors.main, 1.5),
  6906. ImageColor3 = darkenColor(library.colors.main, 2.5)
  6907. }):Play()
  6908. colored_colorPicker_BackgroundColor3[3] = "main"
  6909. colored_colorPicker_BackgroundColor3[4] = 1.5
  6910. colored_colorPicker_ImageColor3[3] = "main"
  6911. colored_colorPicker_ImageColor3[4] = 2.5
  6912. end)
  6913. library.signals[1 + #library.signals] = newColorPicker.MouseLeave:Connect(function()
  6914. if not colorPickerEnabled then
  6915. tweenService:Create(colorPicker, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
  6916. BackgroundColor3 = library.colors.topGradient,
  6917. ImageColor3 = library.colors.bottomGradient
  6918. }):Play()
  6919. colored_colorPicker_BackgroundColor3[3] = "topGradient"
  6920. colored_colorPicker_BackgroundColor3[4] = nil
  6921. colored_colorPicker_ImageColor3[3] = "bottomGradient"
  6922. colored_colorPicker_ImageColor3[4] = nil
  6923. end
  6924. end)
  6925. hexInputBox.FocusLost:Connect(function()
  6926. if #hexInputBox.Text > 5 then
  6927. local last_vv = library_flags[flagName]
  6928. local not_fucked, clr = pcall(Color3FromHex, hexInputBox.Text)
  6929. UpdateColorPicker((not_fucked and clr) or last_vv)
  6930. end
  6931. end)
  6932. colorH = 1 - (math.clamp(selectorHue.AbsolutePosition.X - hue.AbsolutePosition.X, 0, hue.AbsoluteSize.X) / hue.AbsoluteSize.X)
  6933. colorS = (math.clamp(selectorColor.AbsolutePosition.X - color.AbsolutePosition.X, 0, color.AbsoluteSize.X) / color.AbsoluteSize.X)
  6934. colorV = 1 - (math.clamp(selectorColor.AbsolutePosition.Y - color.AbsolutePosition.Y, 0, color.AbsoluteSize.Y) / color.AbsoluteSize.Y)
  6935. library.signals[1 + #library.signals] = color.InputBegan:Connect(function(input)
  6936. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  6937. isDraggingSomething = true
  6938. colorInput = (colorInput and colorInput:Disconnect() and nil) or runService.RenderStepped:Connect(function()
  6939. local colorX = (math.clamp(mouse.X - color.AbsolutePosition.X, 0, color.AbsoluteSize.X) / color.AbsoluteSize.X)
  6940. local colorY = (math.clamp(mouse.Y - color.AbsolutePosition.Y, 0, color.AbsoluteSize.Y) / color.AbsoluteSize.Y)
  6941. selectorColor.Position = UDim2.fromScale(colorX, colorY)
  6942. colorS = colorX
  6943. colorV = 1 - colorY
  6944. UpdateColorPicker()
  6945. end)
  6946. library.signals[1 + #library.signals] = colorInput
  6947. end
  6948. end)
  6949. library.signals[1 + #library.signals] = color.InputEnded:Connect(function(input)
  6950. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  6951. if colorInput then
  6952. isDraggingSomething = false
  6953. colorInput:Disconnect()
  6954. end
  6955. end
  6956. end)
  6957. library.signals[1 + #library.signals] = hue.InputBegan:Connect(function(input)
  6958. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  6959. if hueInput then
  6960. hueInput:Disconnect()
  6961. end
  6962. isDraggingSomething = true
  6963. hueInput = runService.RenderStepped:Connect(function()
  6964. local hueX = math.clamp(mouse.X - hue.AbsolutePosition.X, 0, hue.AbsoluteSize.X) / hue.AbsoluteSize.X
  6965. selectorHue.Position = UDim2.new(hueX)
  6966. colorH = 1 - hueX
  6967. UpdateColorPicker()
  6968. end)
  6969. library.signals[1 + #library.signals] = hueInput
  6970. end
  6971. end)
  6972. library.signals[1 + #library.signals] = hue.InputEnded:Connect(function(input)
  6973. if hueInput and input.UserInputType == Enum.UserInputType.MouseButton1 then
  6974. isDraggingSomething = false
  6975. hueInput:Disconnect()
  6976. end
  6977. end)
  6978. if rainbowColorMode then
  6979. spawn(function()
  6980. rainbowColorMode = nil
  6981. setrainbow(true)
  6982. end)
  6983. end
  6984. local function Set(t, clr)
  6985. if clr == nil and t ~= nil then
  6986. clr = t
  6987. end
  6988. if clr == "rainbow" then
  6989. if not rainbowColorMode then
  6990. task.spawn(setrainbow, true)
  6991. end
  6992. return
  6993. elseif clr == "random" then
  6994. clr = Color3.new(math.random(), math.random(), math.random())
  6995. elseif type(clr) == "string" and tonumber(clr, 16) then
  6996. clr = Color3FromHex(clr)
  6997. end
  6998. task.spawn(setrainbow, false)
  6999. local last_v = library_flags[flagName]
  7000. library_flags[flagName] = clr
  7001. if options.Location then
  7002. options.Location[options.LocationFlag or flagName] = clr
  7003. end
  7004. color.BackgroundColor3 = clr
  7005. selectorColor.Position = UDim2.new(clr and select(3, Color3.toHSV(clr)))
  7006. selectorHue.Position = UDim2.new(1 - (Color3.toHSV(clr)))
  7007. colorPickerInner.BackgroundColor3 = darkenColor(clr, 1.5)
  7008. colorPickerInner.ImageColor3 = darkenColor(clr, 2.5)
  7009. hexInputBox.Text = Color3ToHex(clr)
  7010. colorH, colorS, colorV = Color3.toHSV(clr)
  7011. if callback and (last_v ~= clr or options.AllowDuplicateCalls) then
  7012. task.spawn(callback, clr, last_v)
  7013. end
  7014. return clr
  7015. end
  7016. if presetColor ~= nil then
  7017. Set(presetColor)
  7018. else
  7019. library_flags[flagName] = startingColor
  7020. if options.Location then
  7021. options.Location[options.LocationFlag or flagName] = startingColor
  7022. end
  7023. end
  7024. local default = options.Value or startingColor or library_flags[flagName]
  7025. local function update()
  7026. colorPickerName, callback = options.Name or colorPickerName, options.Callback
  7027. local clr = library_flags[flagName]
  7028. color.BackgroundColor3 = clr
  7029. selectorColor.Position = UDim2.new(clr and select(3, Color3.toHSV(clr)))
  7030. selectorHue.Position = UDim2.new(1 - (Color3.toHSV(clr)))
  7031. colorPickerInner.BackgroundColor3 = darkenColor(clr, 1.5)
  7032. colorPickerInner.ImageColor3 = darkenColor(clr, 2.5)
  7033. hexInputBox.Text = Color3ToHex(clr)
  7034. colorPickerHeadline.Text = colorPickerName or "???"
  7035. return clr
  7036. end
  7037. local objectdata = {
  7038. Options = options,
  7039. Name = flagName,
  7040. Flag = flagName,
  7041. Type = "Colorpicker",
  7042. Default = default,
  7043. Parent = sectionFunctions,
  7044. Instance = newColorPicker,
  7045. SetRainbow = setrainbow,
  7046. Get = function()
  7047. return library_flags[flagName]
  7048. end,
  7049. GetRainbow = function()
  7050. return rainbowColorMode
  7051. end,
  7052. Set = Set,
  7053. Remove = function()
  7054. if newColorPicker then
  7055. newColorPicker.Parent = nil
  7056. sectionFunctions:Update()
  7057. end
  7058. end,
  7059. RawSet = function(t, clr)
  7060. if clr == nil and t ~= nil then
  7061. clr = t
  7062. end
  7063. if clr == "rainbow" then
  7064. if not rainbowColorMode then
  7065. task.spawn(setrainbow, true)
  7066. end
  7067. return clr
  7068. elseif clr == "random" then
  7069. clr = Color3.new(math.random(), math.random(), math.random())
  7070. elseif clr and type(clr) == "string" and tonumber(clr, 16) then
  7071. clr = Color3FromHex(clr)
  7072. end
  7073. task.spawn(setrainbow, false)
  7074. library_flags[flagName] = clr
  7075. if options.Location then
  7076. options.Location[options.LocationFlag or flagName] = clr
  7077. end
  7078. return clr
  7079. end,
  7080. Update = update,
  7081. Reset = function()
  7082. return Set(nil, default)
  7083. end
  7084. }
  7085. tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
  7086. return objectdata
  7087. end
  7088. sectionFunctions.AddColorPicker = sectionFunctions.AddColorpicker
  7089. sectionFunctions.NewColorpicker = sectionFunctions.AddColorpicker
  7090. sectionFunctions.NewColorPicker = sectionFunctions.AddColorpicker
  7091. sectionFunctions.CreateColorPicker = sectionFunctions.AddColorpicker
  7092. sectionFunctions.CreateColorpicker = sectionFunctions.AddColorpicker
  7093. sectionFunctions.ColorPicker = sectionFunctions.AddColorpicker
  7094. sectionFunctions.Colorpicker = sectionFunctions.AddColorpicker
  7095. sectionFunctions.Cp = sectionFunctions.AddColorpicker
  7096. sectionFunctions.CP = sectionFunctions.AddColorpicker
  7097. return sectionFunctions
  7098. end
  7099. tabFunctions.AddSection = tabFunctions.CreateSection
  7100. tabFunctions.NewSection = tabFunctions.CreateSection
  7101. tabFunctions.Section = tabFunctions.CreateSection
  7102. tabFunctions.Sec = tabFunctions.CreateSection
  7103. tabFunctions.S = tabFunctions.CreateSection
  7104. function tabFunctions:UpdateAll()
  7105. local target = self or tabFunctions
  7106. if target and type(target) == "table" and target.Flags then
  7107. for _, e in next, target.Flags do
  7108. if e and type(e) == "table" and e.Update then
  7109. pcall(e.Update)
  7110. end
  7111. end
  7112. end
  7113. end
  7114.  
  7115.  
  7116.  
  7117.  
  7118.  
  7119.  
  7120.  
  7121.  
  7122.  
  7123.  
  7124. return tabFunctions
  7125. end
  7126. windowFunctions.AddTab = windowFunctions.CreateTab
  7127. windowFunctions.NewTab = windowFunctions.CreateTab
  7128. windowFunctions.Tab = windowFunctions.CreateTab
  7129. windowFunctions.T = windowFunctions.CreateTab
  7130. function windowFunctions:CreateDesigner(options, ...)
  7131. options = (options and type(options) == "string" and resolvevararg("Tab", options, ...)) or options
  7132. assert(shared.bypasstablimit or (library.Designer == nil), "Designer already exists")
  7133. options = options or {}
  7134. options.Image = options.Image or 7483871523
  7135. options.LastTab = true
  7136. local designer = windowFunctions:CreateTab(options)
  7137. local colorsection = designer:CreateSection({
  7138. Name = "Colors"
  7139. })
  7140. local backgroundsection = designer:CreateSection({
  7141. Name = "Background",
  7142. Side = "right"
  7143. })
  7144. local detailssection = designer:CreateSection({
  7145. Name = "More Info"
  7146. })
  7147. local filessection = designer:CreateSection({
  7148. Name = "Profiles",
  7149. Side = "right"
  7150. })
  7151. local settingssection = designer:CreateSection({
  7152. Name = "Settings",
  7153. Side = "right"
  7154. })
  7155. local designerelements = {}
  7156. library.designerelements = designerelements
  7157. for _, v in next, {{"Main", "main"}, {"Background", "background"}, {"Outer Border", "outerBorder"}, {"Inner Border", "innerBorder"}, {"Top Gradient", "topGradient"}, {"Bottom Gradient", "bottomGradient"}, {"Section Background", "sectionBackground"}, {"Section", "section"}, {"Element Text", "elementText"}, {"Other Element Text", "otherElementText"}, {"Tab Text", "tabText"}, {"Element Border", "elementBorder"}, {"Selected Option", "selectedOption"}, {"Unselected Option", "unselectedOption"}, {"Hovered Option Top", "hoveredOptionTop"}, {"Unhovered Option Top", "unhoveredOptionTop"}, {"Hovered Option Bottom", "hoveredOptionBottom"}, {"Unhovered Option Bottom", "unhoveredOptionBottom"}} do
  7158. local nam, codename = v[1], v[2]
  7159. local cflag = "__Designer.Colors." .. codename
  7160. designerelements[codename] = {
  7161. Return = colorsection:AddColorpicker({
  7162. Name = nam,
  7163. Flag = cflag,
  7164. Value = library.colors[codename],
  7165. Callback = function(v, y)
  7166. library.colors[codename] = v or y
  7167. end,
  7168. __designer = 1
  7169. }),
  7170. Flag = cflag
  7171. }
  7172. end
  7173. local flags = {}
  7174. local persistoptions = {
  7175. Name = "Workspace Profile",
  7176. Flag = "__Designer.Background.WorkspaceProfile",
  7177. Flags = true,
  7178. Suffix = "Config",
  7179. Workspace = library.WorkspaceName or "Unnamed Workspace",
  7180. Desginer = true
  7181. }
  7182. local daaata = {{"AddTextbox", "__Designer.Textbox.ImageAssetID", backgroundsection, {
  7183. Name = "Image Asset ID",
  7184. Placeholder = "rbxassetid://4427304036",
  7185. Flag = "__Designer.Background.ImageAssetID",
  7186. Value = "rbxassetid://16492669948",
  7187. Callback = updatecolorsnotween
  7188. }}, {"AddColorpicker", "__Designer.Colorpicker.ImageColor", backgroundsection, {
  7189. Name = "Image Color",
  7190. Flag = "__Designer.Background.ImageColor",
  7191. Value = Color3.new(1, 1, 1),
  7192. Callback = updatecolorsnotween,
  7193. __designer = 1
  7194. }}, {"AddSlider", "__Designer.Slider.ImageTransparency", backgroundsection, {
  7195. Name = "Image Transparency",
  7196. Flag = "__Designer.Background.ImageTransparency",
  7197. Value = 95,
  7198. Min = 0,
  7199. Max = 100,
  7200. Format = "Image Transparency: %s%%",
  7201. Textbox = true,
  7202. Callback = updatecolorsnotween
  7203. }}, {"AddToggle", "__Designer.Toggle.UseBackgroundImage", backgroundsection, {
  7204. Name = "Use Background Image",
  7205. Flag = "__Designer.Background.UseBackgroundImage",
  7206. Value = true,
  7207. Callback = updatecolorsnotween
  7208. }}, {"AddPersistence", "__Designer.Persistence.ThemeFile", filessection, {
  7209. Name = "Theme Profile",
  7210. Flag = "__Designer.Files.ThemeFile",
  7211. Workspace = "Elite Lib Themes",
  7212. Flags = flags,
  7213. Suffix = "Theme",
  7214. Desginer = true
  7215. }}, {"AddTextbox", "__Designer.Textbox.WorkspaceName", filessection, {
  7216. Name = "Workspace Name",
  7217. Value = library.WorkspaceName or "Unnamed Workspace",
  7218. Flag = "__Designer.Files.WorkspaceFile",
  7219. Callback = function(n, o)
  7220. persistoptions.Workspace = n or o
  7221. end
  7222. }}, {"AddPersistence", "__Designer.Persistence.WorkspaceProfile", filessection, persistoptions}, {"AddButton", "__Designer.Button.TerminateGUI", settingssection, {{
  7223. Name = "Terminate GUI",
  7224. Callback = library.unload
  7225. }, {
  7226. Name = "Reset GUI",
  7227. Callback = resetall
  7228. }, {
  7229. Name = "Reset Designer",
  7230. Callback = function()
  7231. destroyrainbows = true
  7232. pcall(function()
  7233. for k, v in next, elements do
  7234. if v and k and v.Set and (v.Default ~= nil) and (library_flags[k] ~= v.Default) and (string.sub(k, 1, 11) == "__Designer.") then
  7235. v:Set(v.Default)
  7236. end
  7237. end
  7238. end)
  7239. end
  7240. }}}, {"AddKeybind", "__Designer.Keybind.ShowHideKey", settingssection, {
  7241. Name = "Show/Hide Key",
  7242. Location = library.configuration,
  7243. Flag = "__Designer.Settings.ShowHideKey",
  7244. LocationFlag = "hideKeybind",
  7245. Value = library.configuration.hideKeybind,
  7246. CoreBinding = true,
  7247. Callback = function()
  7248. lasthidebing = os.clock()
  7249. end
  7250. }}, {"AddLabel", "__Designer.Label.Version", settingssection, {
  7251. Name = "Script Version: " .. tostring(library.Version or "?")
  7252. }}}
  7253. if setclipboard and daaata[8] then
  7254. local common_table = daaata[8][4]
  7255. if common_table then
  7256. common_table[1 + #common_table] = {
  7257. Name = "Copy Theme",
  7258. Callback = function()
  7259. local working_with = {}
  7260. if #flags > 0 then
  7261. for k, cflag in next, flags do
  7262. if k > 0 then
  7263. local data = elements[cflag]
  7264. if data and (data.Type ~= "Persistence") and (string.sub(cflag, 1, 11) == "__Designer.") then
  7265. working_with[cflag] = data
  7266. end
  7267. end
  7268. end
  7269. end
  7270. local saving = {}
  7271. for cflag in next, working_with do
  7272. local value = library_flags[cflag]
  7273. local good, jval = nil, nil
  7274. if value ~= nil then
  7275. good, jval = JSONEncode(value)
  7276. else
  7277. good, jval = true, "null"
  7278. end
  7279. if not good or ((jval == "null") and (value ~= nil)) then
  7280. local typ = typeof(value)
  7281. if typ == "Color3" then
  7282. value = (library.rainbowflags[cflag] and "rainbow") or Color3ToHex(value)
  7283. end
  7284. value = tostring(value)
  7285. good, jval = JSONEncode(value)
  7286. if not good or ((jval == "null") and (value ~= nil)) then
  7287. warn("Could not save value:", value, debug.traceback(""))
  7288. end
  7289. end
  7290. if good and jval then
  7291. saving[cflag] = value
  7292. end
  7293. end
  7294. local good, content = JSONEncode(saving)
  7295. if good and content then
  7296. setclipboard(content)
  7297. end
  7298. end
  7299. }
  7300. common_table = nil
  7301. end
  7302. end
  7303. if options.Credit ~= false then
  7304. daaata[1 + #daaata] = {"AddLabel", "__Designer.Label.Creator", detailssection, {
  7305. Text = " Elite Hub Dev"
  7306. }}
  7307. elseif "Gee, thanks for your support." then
  7308. end
  7309. if options.Info then
  7310. local typ = type(options.Info)
  7311. if typ == "string" then
  7312. daaata[1 + #daaata] = {"AddLabel", "__Designer.Label.Creator", detailssection, {
  7313. Text = options.Info
  7314. }}
  7315. elseif typ == "table" and #options.Info > 0 then
  7316. for _, v in next, options.Info do
  7317. daaata[1 + #daaata] = {"AddLabel", "__Designer.Label.Creator", detailssection, {
  7318. Text = tostring(v)
  7319. }}
  7320. end
  7321. end
  7322. end
  7323. for _, v in next, daaata do
  7324. designerelements[v[2]] = v[3][v[1]](v[3], v[4])
  7325. end
  7326. designerelements["__Designer.Textbox.WorkspaceName"]:Set(library.WorkspaceName or "Unnamed Workspace")
  7327. for k, v in next, elements do
  7328. if v and k and string.sub(k, 1, 11) == "__Designer." and v.Type and v.Type ~= "Persistence" then
  7329. flags[1 + #flags] = k
  7330. end
  7331. end
  7332. if library.Backdrop then
  7333. library.Backdrop.Image = resolveid(library_flags["__Designer.Background.ImageAssetID"], "__Designer.Background.ImageAssetID") or ""
  7334. library.Backdrop.Visible = library_flags["__Designer.Background.UseBackgroundImage"] and true
  7335. library.Backdrop.ImageTransparency = (library_flags["__Designer.Background.ImageTransparency"] or 95) / 100
  7336. library.Backdrop.ImageColor3 = library_flags["__Designer.Background.ImageColor"] or Color3.new(1, 1, 1)
  7337. end
  7338. local function setbackground(t, Asset, Transparency, Visible)
  7339. if Visible == nil and t ~= nil and type(t) ~= "table" then
  7340. Asset, Transparency, Visible = t, Transparency, Visible
  7341. end
  7342. if Visible == 0 or ((Asset == 0 or Asset == false) and Visible == nil and Transparency == nil) then
  7343. Visible = false
  7344. elseif Visible == 1 or ((Asset == 1 or Asset == true) and Visible == nil and Transparency == nil) then
  7345. Visible = true
  7346. elseif Asset == nil and Transparency == nil and Visible == nil then
  7347. Visible = not library_flags["__Designer.Background.UseBackgroundImage"]
  7348. end
  7349. local temp = Asset and type(Asset)
  7350. if Transparency == nil and Visible == nil and temp == "number" and ((Asset ~= 1 and Asset ~= 0) or (Asset > 0 and Asset <= 100)) then
  7351. Transparency, Asset, temp = Asset, nil
  7352. end
  7353. if temp and ((temp == "number" and Asset > 1) or temp == "string") then
  7354. designerelements["__Designer.Textbox.ImageAssetID"]:Set(Asset)
  7355. end
  7356. temp = tonumber(Transparency)
  7357. temp = (temp >= 0 and temp <= 1 and temp * 100) or temp
  7358. if temp then
  7359. designerelements["__Designer.Slider.ImageTransparency"]:Set(temp)
  7360. end
  7361. if Visible ~= nil then
  7362. designerelements["__Designer.Toggle.UseBackgroundImage"]:Set(Visible and true)
  7363. end
  7364. return Asset, Transparency, Visible
  7365. end
  7366. local bk = options.Background or options.Backdrop or options.Grahpic
  7367. if bk then
  7368. if type(bk) == "table" then
  7369. setbackground(bk.Asset or bk[1], bk.Transparency or bk[2], bk.Visible or bk[3])
  7370. else
  7371. setbackground(bk, 0, 1)
  7372. end
  7373. end
  7374. library.Designer = {
  7375. Options = options,
  7376. Parent = windowFunctions,
  7377. Name = "Designer",
  7378. Flag = "Designer",
  7379. Type = "Designer",
  7380. Instance = designer,
  7381. SetBackground = setbackground,
  7382. Remove = designer.Remove
  7383. }
  7384. library.SetBackground = setbackground
  7385. local savestuff = library.elements["__Designer.Background.WorkspaceProfile"]
  7386. if savestuff then
  7387. library.LoadFile = savestuff.LoadFile
  7388. library.LoadFileRaw = savestuff.LoadFileRaw
  7389. library.LoadJSON = savestuff.LoadJSON
  7390. library.LoadJSONRaw = savestuff.LoadJSONRaw
  7391. library.SaveFile = savestuff.SaveFile
  7392. library.GetJSON = savestuff.GetJSON
  7393. end
  7394. spawn(updatecolorsnotween)
  7395. local dorlod = nil
  7396. if options.HideTheme then
  7397. designer.Remove()
  7398. dorlod = true
  7399. elseif options.LockTheme then
  7400. if colorsection then
  7401. colorsection.Remove()
  7402. dorlod = true
  7403. end
  7404. if backgroundsection then
  7405. backgroundsection.Remove()
  7406. dorlod = true
  7407. end
  7408. if designerelements then
  7409. local thing = designerelements["__Designer.Persistence.ThemeFile"]
  7410. if thing then
  7411. thing.Remove()
  7412. dorlod = true
  7413. end
  7414. thing = designerelements["__Designer.Button.TerminateGUI"]
  7415. thing = thing and thing[3]
  7416. if thing then
  7417. thing.Remove()
  7418. dorlod = true
  7419. end
  7420. end
  7421. end
  7422. if dorlod then
  7423. windowFunctions:UpdateAll()
  7424. end
  7425. return library.Designer
  7426. end
  7427. windowFunctions.AddDesigner = windowFunctions.CreateDesigner
  7428. windowFunctions.NewDesigner = windowFunctions.CreateDesigner
  7429. windowFunctions.Designer = windowFunctions.CreateDesigner
  7430. windowFunctions.D = windowFunctions.CreateDesigner
  7431. function windowFunctions:UpdateAll()
  7432. local target = self or windowFunctions
  7433. if target and type(target) == "table" and target.Flags then
  7434. for _, e in next, target.Flags do
  7435. if e and type(e) == "table" then
  7436. if e.Update then
  7437. pcall(e.Update)
  7438. end
  7439. if e.UpdateAll then
  7440. pcall(e.Update)
  7441. end
  7442. end
  7443. end
  7444. pcall(function()
  7445. if library.Backdrop then
  7446. library.Backdrop.Visible = library_flags["__Designer.Background.UseBackgroundImage"] and true
  7447. library.Backdrop.Image = resolveid(library_flags["__Designer.Background.ImageAssetID"], "__Designer.Background.ImageAssetID") or ""
  7448. library.Backdrop.ImageColor3 = library_flags["__Designer.Background.ImageColor"] or Color3.new(1, 1, 1)
  7449. library.Backdrop.ImageTransparency = (library_flags["__Designer.Background.ImageTransparency"] or 95) / 100
  7450. end
  7451. end)
  7452. end
  7453. end
  7454. library.UpdateAll = windowFunctions.UpdateAll
  7455. if options.Themeable or options.DefaultTheme or options.Theme then
  7456. spawn(function()
  7457. local os_clock = os.clock
  7458. local starttime = os_clock()
  7459. while os_clock() - starttime < 12 do
  7460. if homepage then
  7461. windowFunctions.GoHome = homepage
  7462. local x, e = pcall(homepage)
  7463. if not x and e then
  7464. warn("Error going to Homepage:", e)
  7465. end
  7466. x, e = nil
  7467. break
  7468. end
  7469. task.wait()
  7470. end
  7471. local whatDoILookLike = options.Themeable or options.DefaultTheme or options.Theme
  7472. if type(whatDoILookLike) == "table" then
  7473. whatDoILookLike.LockTheme = whatDoILookLike.LockTheme or options.LockTheme or nil
  7474. whatDoILookLike.HideTheme = whatDoILookLike.HideTheme or options.HideTheme or nil
  7475. else
  7476. whatDoILookLike = nil
  7477. end
  7478. windowFunctions:CreateDesigner(whatDoILookLike)
  7479. if options.DefaultTheme or options.Theme then
  7480. spawn(function()
  7481. local content = options.DefaultTheme or options.Theme or options.JSON or options.ThemeJSON
  7482. if content and type(content) == "string" and #content > 1 then
  7483. local good, jcontent = JSONDecode(content)
  7484. if good and jcontent then
  7485. for cflag, val in next, jcontent do
  7486. local data = elements[cflag]
  7487. if data and (data.Type ~= "Persistence") then
  7488. if data.Set then
  7489. data:Set(val)
  7490. elseif data.RawSet then
  7491. data:RawSet(val)
  7492. else
  7493. library.flags[cflag] = val
  7494. end
  7495. end
  7496. end
  7497. end
  7498. end
  7499. end)
  7500. end
  7501. os_clock, starttime = nil
  7502. end)
  7503. end
  7504. return windowFunctions
  7505. end
  7506. library.NewWindow = library.CreateWindow
  7507. library.AddWindow = library.CreateWindow
  7508. library.Window = library.CreateWindow
  7509. library.W = library.CreateWindow
  7510.  
  7511.  
  7512.  
  7513.  
  7514.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement