NoTextForSpeech

Dex

Feb 10th, 2026
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 479.21 KB | None | 0 0
  1. getgenv().decompile = function(script_instance)
  2. local bytecode = getscriptbytecode(script_instance)
  3. local encoded = crypt.base64encode(bytecode)
  4. return request(
  5. {
  6. Url = "http://10.0.2.2:3000/luau/decompile",
  7. Method = "POST",
  8. Body = encoded
  9. }
  10. ).Body
  11. end
  12.  
  13. -- https://github.com/LorekeeperZinnia/Dex
  14.  
  15. --[[
  16. Dex
  17. Created by Moon
  18. Modified for Infinite Yield
  19.  
  20. Dex is a debugging suite designed to help the user debug games and find any potential vulnerabilities.
  21. ]]
  22.  
  23. local nodes = {}
  24. local selection
  25.  
  26. local function missing(t, f, fallback)
  27. if type(f) == t then return f end
  28. return fallback
  29. end
  30.  
  31. local cloneref = missing("function", cloneref, function(...) return ... end)
  32. local service = setmetatable({}, {
  33. __index = function(self, name)
  34. self[name] = cloneref(game:GetService(name))
  35. return self[name]
  36. end
  37. })
  38.  
  39. -- prevent environment implosion from references
  40. -- mainly from the executor not having some game properties in their game variable
  41. -- so we gotta use vanilla game
  42. local oldgame = game
  43. local game = workspace.Parent
  44.  
  45. local EmbeddedModules = {
  46. Explorer = function()
  47. --[[
  48. Explorer App Module
  49.  
  50. The main explorer interface
  51. ]]
  52.  
  53. -- Common Locals
  54. local Main,Lib,Apps,Settings -- Main Containers
  55. local Explorer, Properties, ScriptViewer, Notebook -- Major Apps
  56. local API,RMD,env,service,plr,create,createSimple -- Main Locals
  57.  
  58. local function initDeps(data)
  59. Main = data.Main
  60. Lib = data.Lib
  61. Apps = data.Apps
  62. Settings = data.Settings
  63.  
  64. API = data.API
  65. RMD = data.RMD
  66. env = data.env
  67. service = data.service
  68. plr = data.plr
  69. create = data.create
  70. createSimple = data.createSimple
  71. end
  72.  
  73. local function initAfterMain()
  74. Explorer = Apps.Explorer
  75. Properties = Apps.Properties
  76. ScriptViewer = Apps.ScriptViewer
  77. Notebook = Apps.Notebook
  78. end
  79.  
  80. local function main()
  81. local Explorer = {}
  82. local tree,listEntries,explorerOrders,searchResults,specResults = {},{},{},{},{}
  83. local expanded
  84. local entryTemplate,treeFrame,toolBar,descendantAddedCon,descendantRemovingCon,itemChangedCon
  85. local ffa = game.FindFirstAncestorWhichIsA
  86. local getDescendants = game.GetDescendants
  87. local getTextSize = service.TextService.GetTextSize
  88. local updateDebounce,refreshDebounce = false,false
  89. local nilNode = {Obj = Instance.new("Folder")}
  90. local idCounter = 0
  91. local scrollV,scrollH,clipboard
  92. local renameBox,renamingNode,searchFunc
  93. local sortingEnabled,autoUpdateSearch
  94. local table,math = table,math
  95. local nilMap,nilCons = {},{}
  96. local connectSignal = game.DescendantAdded.Connect
  97. local addObject,removeObject,moveObject = nil,nil,nil
  98.  
  99. addObject = function(root)
  100. if nodes[root] then return end
  101.  
  102. local isNil = false
  103. local rootParObj = ffa(root,"Instance")
  104. local par = nodes[rootParObj]
  105.  
  106. -- Nil Handling
  107. if not par then
  108. if nilMap[root] then
  109. nilCons[root] = nilCons[root] or {
  110. connectSignal(root.ChildAdded,addObject),
  111. connectSignal(root.AncestryChanged,moveObject),
  112. }
  113. par = nilNode
  114. isNil = true
  115. else
  116. return
  117. end
  118. elseif nilMap[rootParObj] or par == nilNode then
  119. nilMap[root] = true
  120. nilCons[root] = nilCons[root] or {
  121. connectSignal(root.ChildAdded,addObject),
  122. connectSignal(root.AncestryChanged,moveObject),
  123. }
  124. isNil = true
  125. end
  126.  
  127. local newNode = {Obj = root, Parent = par}
  128. nodes[root] = newNode
  129.  
  130. -- Automatic sorting if expanded
  131. if sortingEnabled and expanded[par] and par.Sorted then
  132. local left,right = 1,#par
  133. local floor = math.floor
  134. local sorter = Explorer.NodeSorter
  135. local pos = (right == 0 and 1)
  136.  
  137. if not pos then
  138. while true do
  139. if left >= right then
  140. if sorter(newNode,par[left]) then
  141. pos = left
  142. else
  143. pos = left+1
  144. end
  145. break
  146. end
  147.  
  148. local mid = floor((left+right)/2)
  149. if sorter(newNode,par[mid]) then
  150. right = mid-1
  151. else
  152. left = mid+1
  153. end
  154. end
  155. end
  156.  
  157. table.insert(par,pos,newNode)
  158. else
  159. par[#par+1] = newNode
  160. par.Sorted = nil
  161. end
  162.  
  163. local insts = getDescendants(root)
  164. for i = 1,#insts do
  165. local obj = insts[i]
  166. if nodes[obj] then continue end -- Deferred
  167.  
  168. local par = nodes[ffa(obj,"Instance")]
  169. if not par then continue end
  170. local newNode = {Obj = obj, Parent = par}
  171. nodes[obj] = newNode
  172. par[#par+1] = newNode
  173.  
  174. -- Nil Handling
  175. if isNil then
  176. nilMap[obj] = true
  177. nilCons[obj] = nilCons[obj] or {
  178. connectSignal(obj.ChildAdded,addObject),
  179. connectSignal(obj.AncestryChanged,moveObject),
  180. }
  181. end
  182. end
  183.  
  184. if searchFunc and autoUpdateSearch then
  185. searchFunc({newNode})
  186. end
  187.  
  188. if not updateDebounce and Explorer.IsNodeVisible(par) then
  189. if expanded[par] then
  190. Explorer.PerformUpdate()
  191. elseif not refreshDebounce then
  192. Explorer.PerformRefresh()
  193. end
  194. end
  195. end
  196.  
  197. removeObject = function(root)
  198. local node = nodes[root]
  199. if not node then return end
  200.  
  201. -- Nil Handling
  202. if nilMap[node.Obj] then
  203. moveObject(node.Obj)
  204. return
  205. end
  206.  
  207. local par = node.Parent
  208. if par then
  209. par.HasDel = true
  210. end
  211.  
  212. local function recur(root)
  213. for i = 1,#root do
  214. local node = root[i]
  215. if not node.Del then
  216. nodes[node.Obj] = nil
  217. if #node > 0 then recur(node) end
  218. end
  219. end
  220. end
  221. recur(node)
  222. node.Del = true
  223. nodes[root] = nil
  224.  
  225. if par and not updateDebounce and Explorer.IsNodeVisible(par) then
  226. if expanded[par] then
  227. Explorer.PerformUpdate()
  228. elseif not refreshDebounce then
  229. Explorer.PerformRefresh()
  230. end
  231. end
  232. end
  233.  
  234. moveObject = function(obj)
  235. local node = nodes[obj]
  236. if not node then return end
  237.  
  238. local oldPar = node.Parent
  239. local newPar = nodes[ffa(obj,"Instance")]
  240. if oldPar == newPar then return end
  241.  
  242. -- Nil Handling
  243. if not newPar then
  244. if nilMap[obj] then
  245. newPar = nilNode
  246. else
  247. return
  248. end
  249. elseif nilMap[newPar.Obj] or newPar == nilNode then
  250. nilMap[obj] = true
  251. nilCons[obj] = nilCons[obj] or {
  252. connectSignal(obj.ChildAdded,addObject),
  253. connectSignal(obj.AncestryChanged,moveObject),
  254. }
  255. end
  256.  
  257. if oldPar then
  258. local parPos = table.find(oldPar,node)
  259. if parPos then table.remove(oldPar,parPos) end
  260. end
  261.  
  262. node.Id = nil
  263. node.Parent = newPar
  264.  
  265. if sortingEnabled and expanded[newPar] and newPar.Sorted then
  266. local left,right = 1,#newPar
  267. local floor = math.floor
  268. local sorter = Explorer.NodeSorter
  269. local pos = (right == 0 and 1)
  270.  
  271. if not pos then
  272. while true do
  273. if left >= right then
  274. if sorter(node,newPar[left]) then
  275. pos = left
  276. else
  277. pos = left+1
  278. end
  279. break
  280. end
  281.  
  282. local mid = floor((left+right)/2)
  283. if sorter(node,newPar[mid]) then
  284. right = mid-1
  285. else
  286. left = mid+1
  287. end
  288. end
  289. end
  290.  
  291. table.insert(newPar,pos,node)
  292. else
  293. newPar[#newPar+1] = node
  294. newPar.Sorted = nil
  295. end
  296.  
  297. if searchFunc and searchResults[node] then
  298. local currentNode = node.Parent
  299. while currentNode and (not searchResults[currentNode] or expanded[currentNode] == 0) do
  300. expanded[currentNode] = true
  301. searchResults[currentNode] = true
  302. currentNode = currentNode.Parent
  303. end
  304. end
  305.  
  306. if not updateDebounce and (Explorer.IsNodeVisible(newPar) or Explorer.IsNodeVisible(oldPar)) then
  307. if expanded[newPar] or expanded[oldPar] then
  308. Explorer.PerformUpdate()
  309. elseif not refreshDebounce then
  310. Explorer.PerformRefresh()
  311. end
  312. end
  313. end
  314.  
  315. Explorer.ViewWidth = 0
  316. Explorer.Index = 0
  317. Explorer.EntryIndent = 20
  318. Explorer.FreeWidth = 32
  319. Explorer.GuiElems = {}
  320.  
  321. Explorer.InitRenameBox = function()
  322. renameBox = create({{1,"TextBox",{BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderColor3=Color3.new(0.062745101749897,0.51764708757401,1),BorderMode=2,ClearTextOnFocus=false,Font=3,Name="RenameBox",PlaceholderColor3=Color3.new(0.69803923368454,0.69803923368454,0.69803923368454),Position=UDim2.new(0,26,0,2),Size=UDim2.new(0,200,0,16),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,TextXAlignment=0,Visible=false,ZIndex=2}}})
  323.  
  324. renameBox.Parent = Explorer.Window.GuiElems.Content.List
  325.  
  326. renameBox.FocusLost:Connect(function()
  327. if not renamingNode then return end
  328.  
  329. pcall(function() renamingNode.Obj.Name = renameBox.Text end)
  330. renamingNode = nil
  331. Explorer.Refresh()
  332. end)
  333.  
  334. renameBox.Focused:Connect(function()
  335. renameBox.SelectionStart = 1
  336. renameBox.CursorPosition = #renameBox.Text + 1
  337. end)
  338. end
  339.  
  340. Explorer.SetRenamingNode = function(node)
  341. renamingNode = node
  342. renameBox.Text = tostring(node.Obj)
  343. renameBox:CaptureFocus()
  344. Explorer.Refresh()
  345. end
  346.  
  347. Explorer.SetSortingEnabled = function(val)
  348. sortingEnabled = val
  349. Settings.Explorer.Sorting = val
  350. end
  351.  
  352. Explorer.UpdateView = function()
  353. local maxNodes = math.ceil(treeFrame.AbsoluteSize.Y / 20)
  354. local maxX = treeFrame.AbsoluteSize.X
  355. local totalWidth = Explorer.ViewWidth + Explorer.FreeWidth
  356.  
  357. scrollV.VisibleSpace = maxNodes
  358. scrollV.TotalSpace = #tree + 1
  359. scrollH.VisibleSpace = maxX
  360. scrollH.TotalSpace = totalWidth
  361.  
  362. scrollV.Gui.Visible = #tree + 1 > maxNodes
  363. scrollH.Gui.Visible = totalWidth > maxX
  364.  
  365. local oldSize = treeFrame.Size
  366. treeFrame.Size = UDim2.new(1,(scrollV.Gui.Visible and -16 or 0),1,(scrollH.Gui.Visible and -39 or -23))
  367. if oldSize ~= treeFrame.Size then
  368. Explorer.UpdateView()
  369. else
  370. scrollV:Update()
  371. scrollH:Update()
  372.  
  373. renameBox.Size = UDim2.new(0,maxX-100,0,16)
  374.  
  375. if scrollV.Gui.Visible and scrollH.Gui.Visible then
  376. scrollV.Gui.Size = UDim2.new(0,16,1,-39)
  377. scrollH.Gui.Size = UDim2.new(1,-16,0,16)
  378. Explorer.Window.GuiElems.Content.ScrollCorner.Visible = true
  379. else
  380. scrollV.Gui.Size = UDim2.new(0,16,1,-23)
  381. scrollH.Gui.Size = UDim2.new(1,0,0,16)
  382. Explorer.Window.GuiElems.Content.ScrollCorner.Visible = false
  383. end
  384.  
  385. Explorer.Index = scrollV.Index
  386. end
  387. end
  388.  
  389. Explorer.NodeSorter = function(a,b)
  390. if a.Del or b.Del then return false end -- Ghost node
  391.  
  392. local aClass = a.Class
  393. local bClass = b.Class
  394. if not aClass then aClass = a.Obj.ClassName a.Class = aClass end
  395. if not bClass then bClass = b.Obj.ClassName b.Class = bClass end
  396.  
  397. local aOrder = explorerOrders[aClass]
  398. local bOrder = explorerOrders[bClass]
  399. if not aOrder then aOrder = RMD.Classes[aClass] and tonumber(RMD.Classes[aClass].ExplorerOrder) or 9999 explorerOrders[aClass] = aOrder end
  400. if not bOrder then bOrder = RMD.Classes[bClass] and tonumber(RMD.Classes[bClass].ExplorerOrder) or 9999 explorerOrders[bClass] = bOrder end
  401.  
  402. if aOrder ~= bOrder then
  403. return aOrder < bOrder
  404. else
  405. local aName,bName = tostring(a.Obj),tostring(b.Obj)
  406. if aName ~= bName then
  407. return aName < bName
  408. elseif aClass ~= bClass then
  409. return aClass < bClass
  410. else
  411. local aId = a.Id if not aId then aId = idCounter idCounter = (idCounter+0.001)%999999999 a.Id = aId end
  412. local bId = b.Id if not bId then bId = idCounter idCounter = (idCounter+0.001)%999999999 b.Id = bId end
  413. return aId < bId
  414. end
  415. end
  416. end
  417.  
  418. Explorer.Update = function()
  419. table.clear(tree)
  420. local maxNameWidth,maxDepth,count = 0,1,1
  421. local nameCache = {}
  422. local font = Enum.Font.SourceSans
  423. local size = Vector2.new(math.huge,20)
  424. local useNameWidth = Settings.Explorer.UseNameWidth
  425. local tSort = table.sort
  426. local sortFunc = Explorer.NodeSorter
  427. local isSearching = (expanded == Explorer.SearchExpanded)
  428. local textServ = service.TextService
  429.  
  430. local function recur(root,depth)
  431. if depth > maxDepth then maxDepth = depth end
  432. depth = depth + 1
  433. if sortingEnabled and not root.Sorted then
  434. tSort(root,sortFunc)
  435. root.Sorted = true
  436. end
  437. for i = 1,#root do
  438. local n = root[i]
  439.  
  440. if (isSearching and not searchResults[n]) or n.Del then continue end
  441.  
  442. if useNameWidth then
  443. local nameWidth = n.NameWidth
  444. if not nameWidth then
  445. local objName = tostring(n.Obj)
  446. nameWidth = nameCache[objName]
  447. if not nameWidth then
  448. nameWidth = getTextSize(textServ,objName,14,font,size).X
  449. nameCache[objName] = nameWidth
  450. end
  451. n.NameWidth = nameWidth
  452. end
  453. if nameWidth > maxNameWidth then
  454. maxNameWidth = nameWidth
  455. end
  456. end
  457.  
  458. tree[count] = n
  459. count = count + 1
  460. if expanded[n] and #n > 0 then
  461. recur(n,depth)
  462. end
  463. end
  464. end
  465.  
  466. recur(nodes[game],1)
  467.  
  468. -- Nil Instances
  469. if env.getnilinstances then
  470. if not (isSearching and not searchResults[nilNode]) then
  471. tree[count] = nilNode
  472. count = count + 1
  473. if expanded[nilNode] then
  474. recur(nilNode,2)
  475. end
  476. end
  477. end
  478.  
  479. Explorer.MaxNameWidth = maxNameWidth
  480. Explorer.MaxDepth = maxDepth
  481. Explorer.ViewWidth = useNameWidth and Explorer.EntryIndent*maxDepth + maxNameWidth + 26 or Explorer.EntryIndent*maxDepth + 226
  482. Explorer.UpdateView()
  483. end
  484.  
  485. Explorer.StartDrag = function(offX,offY)
  486. if Explorer.Dragging then return end
  487. for i,v in next, selection.List do
  488. local Obj = v.Obj
  489. if Obj.Parent == game or Obj:IsA("Player") then
  490. return
  491. end
  492. end
  493. Explorer.Dragging = true
  494.  
  495. local dragTree = treeFrame:Clone()
  496. dragTree:ClearAllChildren()
  497.  
  498. for i,v in pairs(listEntries) do
  499. local node = tree[i + Explorer.Index]
  500. if node and selection.Map[node] then
  501. local clone = v:Clone()
  502. clone.Active = false
  503. clone.Indent.Expand.Visible = false
  504. clone.Parent = dragTree
  505. end
  506. end
  507.  
  508. local newGui = Instance.new("ScreenGui")
  509. newGui.DisplayOrder = Main.DisplayOrders.Menu
  510. dragTree.Parent = newGui
  511. Lib.ShowGui(newGui)
  512.  
  513. local dragOutline = create({
  514. {1,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Name="DragSelect",Size=UDim2.new(1,0,1,0),}},
  515. {2,"Frame",{BackgroundColor3=Color3.new(1,1,1),BorderSizePixel=0,Name="Line",Parent={1},Size=UDim2.new(1,0,0,1),ZIndex=2,}},
  516. {3,"Frame",{BackgroundColor3=Color3.new(1,1,1),BorderSizePixel=0,Name="Line",Parent={1},Position=UDim2.new(0,0,1,-1),Size=UDim2.new(1,0,0,1),ZIndex=2,}},
  517. {4,"Frame",{BackgroundColor3=Color3.new(1,1,1),BorderSizePixel=0,Name="Line",Parent={1},Size=UDim2.new(0,1,1,0),ZIndex=2,}},
  518. {5,"Frame",{BackgroundColor3=Color3.new(1,1,1),BorderSizePixel=0,Name="Line",Parent={1},Position=UDim2.new(1,-1,0,0),Size=UDim2.new(0,1,1,0),ZIndex=2,}},
  519. })
  520. dragOutline.Parent = treeFrame
  521.  
  522. local mouse = Main.Mouse or service.Players.LocalPlayer:GetMouse()
  523. local function move()
  524. local posX = mouse.X - offX
  525. local posY = mouse.Y - offY
  526. dragTree.Position = UDim2.new(0,posX,0,posY)
  527.  
  528. for i = 1,#listEntries do
  529. local entry = listEntries[i]
  530. if Lib.CheckMouseInGui(entry) then
  531. dragOutline.Position = UDim2.new(0,entry.Indent.Position.X.Offset-scrollH.Index,0,entry.Position.Y.Offset)
  532. dragOutline.Size = UDim2.new(0,entry.Size.X.Offset-entry.Indent.Position.X.Offset,0,20)
  533. dragOutline.Visible = true
  534. return
  535. end
  536. end
  537. dragOutline.Visible = false
  538. end
  539. move()
  540.  
  541. local input = service.UserInputService
  542. local mouseEvent,releaseEvent
  543.  
  544. mouseEvent = input.InputChanged:Connect(function(input)
  545. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  546. move()
  547. end
  548. end)
  549.  
  550. releaseEvent = input.InputEnded:Connect(function(input)
  551. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  552. releaseEvent:Disconnect()
  553. mouseEvent:Disconnect()
  554. newGui:Destroy()
  555. dragOutline:Destroy()
  556. Explorer.Dragging = false
  557.  
  558. for i = 1,#listEntries do
  559. if Lib.CheckMouseInGui(listEntries[i]) then
  560. local node = tree[i + Explorer.Index]
  561. if node then
  562. if selection.Map[node] then return end
  563. local newPar = node.Obj
  564. local sList = selection.List
  565. for i = 1,#sList do
  566. local n = sList[i]
  567. pcall(function() n.Obj.Parent = newPar end)
  568. end
  569. Explorer.ViewNode(sList[1])
  570. end
  571. break
  572. end
  573. end
  574. end
  575. end)
  576. end
  577.  
  578. Explorer.NewListEntry = function(index)
  579. local newEntry = entryTemplate:Clone()
  580. newEntry.Position = UDim2.new(0,0,0,20*(index-1))
  581.  
  582. local isRenaming = false
  583.  
  584. newEntry.InputBegan:Connect(function(input)
  585. local node = tree[index + Explorer.Index]
  586. if not node or selection.Map[node] or (input.UserInputType ~= Enum.UserInputType.MouseMovement and input.UserInputType ~= Enum.UserInputType.Touch) then return end
  587.  
  588. newEntry.Indent.BackgroundColor3 = Settings.Theme.Button
  589. newEntry.Indent.BorderSizePixel = 0
  590. newEntry.Indent.BackgroundTransparency = 0
  591. end)
  592.  
  593. newEntry.InputEnded:Connect(function(input)
  594. local node = tree[index + Explorer.Index]
  595. if not node or selection.Map[node] or (input.UserInputType ~= Enum.UserInputType.MouseMovement and input.UserInputType ~= Enum.UserInputType.Touch) then return end
  596.  
  597. newEntry.Indent.BackgroundTransparency = 1
  598. end)
  599.  
  600. newEntry.MouseButton1Down:Connect(function()
  601.  
  602. end)
  603.  
  604. newEntry.MouseButton1Up:Connect(function()
  605.  
  606. end)
  607.  
  608. newEntry.InputBegan:Connect(function(input)
  609. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  610. local releaseEvent, mouseEvent
  611.  
  612. local mouse = Main.Mouse or plr:GetMouse()
  613. local startX, startY
  614.  
  615. if input.UserInputType == Enum.UserInputType.Touch then
  616. startX = input.Position.X
  617. startY = input.Position.Y
  618. else
  619. startX = mouse.X
  620. startY = mouse.Y
  621. end
  622.  
  623. local listOffsetX = startX - treeFrame.AbsolutePosition.X
  624. local listOffsetY = startY - treeFrame.AbsolutePosition.Y
  625.  
  626. releaseEvent = service.UserInputService.InputEnded:Connect(function(input)
  627. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  628. releaseEvent:Disconnect()
  629. mouseEvent:Disconnect()
  630. end
  631. end)
  632.  
  633. mouseEvent = service.UserInputService.InputChanged:Connect(function(input)
  634. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  635. local currentX, currentY
  636.  
  637. if input.UserInputType == Enum.UserInputType.Touch then
  638. currentX = input.Position.X
  639. currentY = input.Position.Y
  640. else
  641. currentX = mouse.X
  642. currentY = mouse.Y
  643. end
  644.  
  645. local deltaX = currentX - startX
  646. local deltaY = currentY - startY
  647. local dist = math.sqrt(deltaX^2 + deltaY^2)
  648.  
  649. if dist > 5 then
  650. releaseEvent:Disconnect()
  651. mouseEvent:Disconnect()
  652. isRenaming = false
  653. Explorer.StartDrag(listOffsetX, listOffsetY)
  654. end
  655. end
  656. end)
  657. end
  658. end)
  659.  
  660. newEntry.MouseButton2Down:Connect(function()
  661.  
  662. end)
  663.  
  664. newEntry.Indent.Expand.InputBegan:Connect(function(input)
  665. local node = tree[index + Explorer.Index]
  666. if not node or (input.UserInputType ~= Enum.UserInputType.MouseMovement and input.UserInputType ~= Enum.UserInputType.Touch) then return end
  667.  
  668. if input.UserInputType == Enum.UserInputType.Touch then
  669. Explorer.MiscIcons:DisplayByKey(newEntry.Indent.Expand.Icon, expanded[node] and "Collapse_Over" or "Expand_Over")
  670. elseif input.UserInputType == Enum.UserInputType.MouseMovement then
  671. Explorer.MiscIcons:DisplayByKey(newEntry.Indent.Expand.Icon, expanded[node] and "Collapse_Over" or "Expand_Over")
  672. end
  673. end)
  674.  
  675. newEntry.Indent.Expand.InputEnded:Connect(function(input)
  676. local node = tree[index + Explorer.Index]
  677. if not node or (input.UserInputType ~= Enum.UserInputType.MouseMovement and input.UserInputType ~= Enum.UserInputType.Touch) then return end
  678.  
  679. if input.UserInputType == Enum.UserInputType.Touch then
  680. Explorer.MiscIcons:DisplayByKey(newEntry.Indent.Expand.Icon, expanded[node] and "Collapse" or "Expand")
  681. elseif input.UserInputType == Enum.UserInputType.MouseMovement then
  682. Explorer.MiscIcons:DisplayByKey(newEntry.Indent.Expand.Icon, expanded[node] and "Collapse" or "Expand")
  683. end
  684. end)
  685.  
  686. newEntry.Indent.Expand.MouseButton1Down:Connect(function()
  687. local node = tree[index + Explorer.Index]
  688. if not node or #node == 0 then return end
  689.  
  690. expanded[node] = not expanded[node]
  691. Explorer.Update()
  692. Explorer.Refresh()
  693. end)
  694.  
  695. newEntry.Parent = treeFrame
  696. return newEntry
  697. end
  698.  
  699. Explorer.Refresh = function()
  700. local maxNodes = math.max(math.ceil((treeFrame.AbsoluteSize.Y) / 20), 0)
  701. local renameNodeVisible = false
  702. local isa = game.IsA
  703.  
  704. for i = 1,maxNodes do
  705. local entry = listEntries[i]
  706. if not listEntries[i] then entry = Explorer.NewListEntry(i) listEntries[i] = entry Explorer.ClickSystem:Add(entry) end
  707.  
  708. local node = tree[i + Explorer.Index]
  709. if node then
  710. local obj = node.Obj
  711. local depth = Explorer.EntryIndent*Explorer.NodeDepth(node)
  712.  
  713. entry.Visible = true
  714. entry.Position = UDim2.new(0,-scrollH.Index,0,entry.Position.Y.Offset)
  715. entry.Size = UDim2.new(0,Explorer.ViewWidth,0,20)
  716. entry.Indent.EntryName.Text = tostring(node.Obj)
  717. entry.Indent.Position = UDim2.new(0,depth,0,0)
  718. entry.Indent.Size = UDim2.new(1,-depth,1,0)
  719.  
  720. entry.Indent.EntryName.TextTruncate = (Settings.Explorer.UseNameWidth and Enum.TextTruncate.None or Enum.TextTruncate.AtEnd)
  721.  
  722. Explorer.MiscIcons:DisplayExplorerIcons(entry.Indent.Icon, obj.ClassName)
  723.  
  724. if selection.Map[node] then
  725. entry.Indent.BackgroundColor3 = Settings.Theme.ListSelection
  726. entry.Indent.BorderSizePixel = 0
  727. entry.Indent.BackgroundTransparency = 0
  728. else
  729. if Lib.CheckMouseInGui(entry) then
  730. entry.Indent.BackgroundColor3 = Settings.Theme.Button
  731. else
  732. entry.Indent.BackgroundTransparency = 1
  733. end
  734. end
  735.  
  736. if node == renamingNode then
  737. renameNodeVisible = true
  738. renameBox.Position = UDim2.new(0,depth+25-scrollH.Index,0,entry.Position.Y.Offset+2)
  739. renameBox.Visible = true
  740. end
  741.  
  742. if #node > 0 and expanded[node] ~= 0 then
  743. if Lib.CheckMouseInGui(entry.Indent.Expand) then
  744. Explorer.MiscIcons:DisplayByKey(entry.Indent.Expand.Icon, expanded[node] and "Collapse_Over" or "Expand_Over")
  745. else
  746. Explorer.MiscIcons:DisplayByKey(entry.Indent.Expand.Icon, expanded[node] and "Collapse" or "Expand")
  747. end
  748. entry.Indent.Expand.Visible = true
  749. else
  750. entry.Indent.Expand.Visible = false
  751. end
  752. else
  753. entry.Visible = false
  754. end
  755. end
  756.  
  757. if not renameNodeVisible then
  758. renameBox.Visible = false
  759. end
  760.  
  761. for i = maxNodes+1, #listEntries do
  762. Explorer.ClickSystem:Remove(listEntries[i])
  763. listEntries[i]:Destroy()
  764. listEntries[i] = nil
  765. end
  766. end
  767.  
  768. Explorer.PerformUpdate = function(instant)
  769. updateDebounce = true
  770. Lib.FastWait(not instant and 0.1)
  771. if not updateDebounce then return end
  772. updateDebounce = false
  773. if not Explorer.Window:IsVisible() then return end
  774. Explorer.Update()
  775. Explorer.Refresh()
  776. end
  777.  
  778. Explorer.ForceUpdate = function(norefresh)
  779. updateDebounce = false
  780. Explorer.Update()
  781. if not norefresh then Explorer.Refresh() end
  782. end
  783.  
  784. Explorer.PerformRefresh = function()
  785. refreshDebounce = true
  786. Lib.FastWait(0.1)
  787. refreshDebounce = false
  788. if updateDebounce or not Explorer.Window:IsVisible() then return end
  789. Explorer.Refresh()
  790. end
  791.  
  792. Explorer.IsNodeVisible = function(node)
  793. if not node then return end
  794.  
  795. local curNode = node.Parent
  796. while curNode do
  797. if not expanded[curNode] then return false end
  798. curNode = curNode.Parent
  799. end
  800. return true
  801. end
  802.  
  803. Explorer.NodeDepth = function(node)
  804. local depth = 0
  805.  
  806. if node == nilNode then
  807. return 1
  808. end
  809.  
  810. local curNode = node.Parent
  811. while curNode do
  812. if curNode == nilNode then depth = depth + 1 end
  813. curNode = curNode.Parent
  814. depth = depth + 1
  815. end
  816. return depth
  817. end
  818.  
  819. Explorer.SetupConnections = function()
  820. if descendantAddedCon then descendantAddedCon:Disconnect() end
  821. if descendantRemovingCon then descendantRemovingCon:Disconnect() end
  822. if itemChangedCon then itemChangedCon:Disconnect() end
  823.  
  824. if Main.Elevated then
  825. descendantAddedCon = game.DescendantAdded:Connect(addObject)
  826. descendantRemovingCon = game.DescendantRemoving:Connect(removeObject)
  827. else
  828. descendantAddedCon = game.DescendantAdded:Connect(function(obj) pcall(addObject,obj) end)
  829. descendantRemovingCon = game.DescendantRemoving:Connect(function(obj) pcall(removeObject,obj) end)
  830. end
  831.  
  832. if Settings.Explorer.UseNameWidth then
  833. itemChangedCon = game.ItemChanged:Connect(function(obj,prop)
  834. if prop == "Parent" and nodes[obj] then
  835. moveObject(obj)
  836. elseif prop == "Name" and nodes[obj] then
  837. nodes[obj].NameWidth = nil
  838. end
  839. end)
  840. else
  841. itemChangedCon = game.ItemChanged:Connect(function(obj,prop)
  842. if prop == "Parent" and nodes[obj] then
  843. moveObject(obj)
  844. end
  845. end)
  846. end
  847. end
  848.  
  849. Explorer.ViewNode = function(node)
  850. if not node then return end
  851.  
  852. Explorer.MakeNodeVisible(node)
  853. Explorer.ForceUpdate(true)
  854. local visibleSpace = scrollV.VisibleSpace
  855.  
  856. for i,v in next,tree do
  857. if v == node then
  858. local relative = i - 1
  859. if Explorer.Index > relative then
  860. scrollV.Index = relative
  861. elseif Explorer.Index + visibleSpace - 1 <= relative then
  862. scrollV.Index = relative - visibleSpace + 2
  863. end
  864. end
  865. end
  866.  
  867. scrollV:Update() Explorer.Index = scrollV.Index
  868. Explorer.Refresh()
  869. end
  870.  
  871. Explorer.ViewObj = function(obj)
  872. Explorer.ViewNode(nodes[obj])
  873. end
  874.  
  875. Explorer.MakeNodeVisible = function(node,expandRoot)
  876. if not node then return end
  877.  
  878. local hasExpanded = false
  879.  
  880. if expandRoot and not expanded[node] then
  881. expanded[node] = true
  882. hasExpanded = true
  883. end
  884.  
  885. local currentNode = node.Parent
  886. while currentNode do
  887. hasExpanded = true
  888. expanded[currentNode] = true
  889. currentNode = currentNode.Parent
  890. end
  891.  
  892. if hasExpanded and not updateDebounce then
  893. coroutine.wrap(Explorer.PerformUpdate)(true)
  894. end
  895. end
  896.  
  897. Explorer.ShowRightClick = function(MousePos)
  898. local Mouse = MousePos or Main.Mouse
  899. local context = Explorer.RightClickContext
  900. local absoluteSize = context.Gui.AbsoluteSize
  901. context.MaxHeight = (absoluteSize.Y <= 600 and (absoluteSize.Y - 40)) or nil
  902. context:Clear()
  903.  
  904. local sList = selection.List
  905. local sMap = selection.Map
  906. local emptyClipboard = #clipboard == 0
  907. local presentClasses = {}
  908. local apiClasses = API.Classes
  909.  
  910. for i = 1, #sList do
  911. local node = sList[i]
  912. local class = node.Class
  913. local obj = node.Obj
  914.  
  915. if not presentClasses.isViableDecompileScript then
  916. presentClasses.isViableDecompileScript = env.isViableDecompileScript(obj)
  917. end
  918. if not class then
  919. class = obj.ClassName
  920. node.Class = class
  921. end
  922.  
  923. local curClass = apiClasses[class]
  924. while curClass and not presentClasses[curClass.Name] do
  925. presentClasses[curClass.Name] = true
  926. curClass = curClass.Superclass
  927. end
  928. end
  929.  
  930. context:AddRegistered("CUT")
  931. context:AddRegistered("COPY")
  932. context:AddRegistered("PASTE", emptyClipboard)
  933. context:AddRegistered("DUPLICATE")
  934. context:AddRegistered("DELETE")
  935. context:AddRegistered("RENAME", #sList ~= 1)
  936.  
  937. context:AddDivider()
  938. context:AddRegistered("GROUP")
  939. context:AddRegistered("UNGROUP")
  940. context:AddRegistered("SELECT_CHILDREN")
  941. context:AddRegistered("JUMP_TO_PARENT")
  942. context:AddRegistered("EXPAND_ALL")
  943. context:AddRegistered("COLLAPSE_ALL")
  944.  
  945. context:AddDivider()
  946.  
  947. if expanded == Explorer.SearchExpanded then context:AddRegistered("CLEAR_SEARCH_AND_JUMP_TO") end
  948. if env.setclipboard then context:AddRegistered("COPY_PATH") end
  949. context:AddRegistered("INSERT_OBJECT")
  950. -- context:AddRegistered("SAVE_INST")
  951. -- context:AddRegistered("CALL_FUNCTION")
  952. -- context:AddRegistered("VIEW_CONNECTIONS")
  953. -- context:AddRegistered("GET_REFERENCES")
  954. -- context:AddRegistered("VIEW_API")
  955.  
  956. context:QueueDivider()
  957.  
  958. if presentClasses["BasePart"] or presentClasses["Model"] then
  959. context:AddRegistered("TELEPORT_TO")
  960. context:AddRegistered("VIEW_OBJECT")
  961. end
  962. if presentClasses["Tween"] then context:AddRegistered("PLAY_TWEEN") end
  963. if presentClasses["Animation"] then
  964. context:AddRegistered("LOAD_ANIMATION")
  965. context:AddRegistered("STOP_ANIMATION")
  966. end
  967.  
  968. if presentClasses["TouchTransmitter"] then context:AddRegistered("FIRE_TOUCHTRANSMITTER", firetouchinterest == nil) end
  969. if presentClasses["ClickDetector"] then context:AddRegistered("FIRE_CLICKDETECTOR", fireclickdetector == nil) end
  970. if presentClasses["ProximityPrompt"] then context:AddRegistered("FIRE_PROXIMITYPROMPT", fireproximityprompt == nil) end
  971.  
  972. if presentClasses["Player"] then context:AddRegistered("SELECT_CHARACTER")context:AddRegistered("VIEW_PLAYER") end
  973. if presentClasses["Players"] then
  974. context:AddRegistered("SELECT_LOCAL_PLAYER")
  975. context:AddRegistered("SELECT_ALL_CHARACTERS")
  976. end
  977.  
  978. if presentClasses["LuaSourceContainer"] then
  979. context:AddRegistered("VIEW_SCRIPT", not presentClasses.isViableDecompileScript or env.decompile == nil)
  980. context:AddRegistered("SAVE_SCRIPT", not presentClasses.isViableDecompileScript or env.decompile == nil or env.writefile == nil)
  981. context:AddRegistered("SAVE_BYTECODE", not presentClasses.isViableDecompileScript or env.getscriptbytecode == nil or env.writefile == nil)
  982. end
  983.  
  984. if sMap[nilNode] then
  985. context:AddRegistered("REFRESH_NIL")
  986. context:AddRegistered("HIDE_NIL")
  987. end
  988.  
  989. Explorer.LastRightClickX, Explorer.LastRightClickY = Mouse.X, Mouse.Y
  990. context:Show(Mouse.X, Mouse.Y)
  991. end
  992.  
  993. Explorer.InitRightClick = function()
  994. local context = Lib.ContextMenu.new()
  995.  
  996. context:Register("CUT",{Name = "Cut", IconMap = Explorer.MiscIcons, Icon = "Cut", DisabledIcon = "Cut_Disabled", Shortcut = "Ctrl+Z", OnClick = function()
  997. local destroy,clone = game.Destroy,game.Clone
  998. local sList,newClipboard = selection.List,{}
  999. local count = 1
  1000. for i = 1,#sList do
  1001. local inst = sList[i].Obj
  1002. local s,cloned = pcall(clone,inst)
  1003. if s and cloned then
  1004. newClipboard[count] = cloned
  1005. count = count + 1
  1006. end
  1007. pcall(destroy,inst)
  1008. end
  1009. clipboard = newClipboard
  1010. selection:Clear()
  1011. end})
  1012.  
  1013. context:Register("COPY",{Name = "Copy", IconMap = Explorer.MiscIcons, Icon = "Copy", DisabledIcon = "Copy_Disabled", Shortcut = "Ctrl+C", OnClick = function()
  1014. local clone = game.Clone
  1015. local sList,newClipboard = selection.List,{}
  1016. local count = 1
  1017. for i = 1,#sList do
  1018. local inst = sList[i].Obj
  1019. local s,cloned = pcall(clone,inst)
  1020. if s and cloned then
  1021. newClipboard[count] = cloned
  1022. count = count + 1
  1023. end
  1024. end
  1025. clipboard = newClipboard
  1026. end})
  1027.  
  1028. context:Register("PASTE",{Name = "Paste Into", IconMap = Explorer.MiscIcons, Icon = "Paste", DisabledIcon = "Paste_Disabled", Shortcut = "Ctrl+Shift+V", OnClick = function()
  1029. local sList = selection.List
  1030. local newSelection = {}
  1031. local count = 1
  1032. for i = 1,#sList do
  1033. local node = sList[i]
  1034. local inst = node.Obj
  1035. Explorer.MakeNodeVisible(node,true)
  1036. for c = 1,#clipboard do
  1037. local cloned = clipboard[c]:Clone()
  1038. if cloned then
  1039. cloned.Parent = inst
  1040. local clonedNode = nodes[cloned]
  1041. if clonedNode then newSelection[count] = clonedNode count = count + 1 end
  1042. end
  1043. end
  1044. end
  1045. selection:SetTable(newSelection)
  1046.  
  1047. if #newSelection > 0 then
  1048. Explorer.ViewNode(newSelection[1])
  1049. end
  1050. end})
  1051.  
  1052. context:Register("DUPLICATE",{Name = "Duplicate", IconMap = Explorer.MiscIcons, Icon = "Copy", DisabledIcon = "Copy_Disabled", Shortcut = "Ctrl+D", OnClick = function()
  1053. local clone = game.Clone
  1054. local sList = selection.List
  1055. local newSelection = {}
  1056. local count = 1
  1057. for i = 1,#sList do
  1058. local node = sList[i]
  1059. local inst = node.Obj
  1060. local instPar = node.Parent and node.Parent.Obj
  1061. Explorer.MakeNodeVisible(node)
  1062. local s,cloned = pcall(clone,inst)
  1063. if s and cloned then
  1064. cloned.Parent = instPar
  1065. local clonedNode = nodes[cloned]
  1066. if clonedNode then newSelection[count] = clonedNode count = count + 1 end
  1067. end
  1068. end
  1069.  
  1070. selection:SetTable(newSelection)
  1071. if #newSelection > 0 then
  1072. Explorer.ViewNode(newSelection[1])
  1073. end
  1074. end})
  1075.  
  1076. context:Register("DELETE",{Name = "Delete", IconMap = Explorer.MiscIcons, Icon = "Delete", DisabledIcon = "Delete_Disabled", Shortcut = "Del", OnClick = function()
  1077. local destroy = game.Destroy
  1078. local sList = selection.List
  1079. for i = 1,#sList do
  1080. pcall(destroy,sList[i].Obj)
  1081. end
  1082. selection:Clear()
  1083. end})
  1084.  
  1085. context:Register("RENAME",{Name = "Rename", IconMap = Explorer.MiscIcons, Icon = "Rename", DisabledIcon = "Rename_Disabled", Shortcut = "F2", OnClick = function()
  1086. local sList = selection.List
  1087. if sList[1] then
  1088. Explorer.SetRenamingNode(sList[1])
  1089. end
  1090. end})
  1091.  
  1092. context:Register("GROUP",{Name = "Group", IconMap = Explorer.MiscIcons, Icon = "Group", DisabledIcon = "Group_Disabled", Shortcut = "Ctrl+G", OnClick = function()
  1093. local sList = selection.List
  1094. if #sList == 0 then return end
  1095.  
  1096. local model = Instance.new("Model",sList[#sList].Obj.Parent)
  1097. for i = 1,#sList do
  1098. pcall(function() sList[i].Obj.Parent = model end)
  1099. end
  1100.  
  1101. if nodes[model] then
  1102. selection:Set(nodes[model])
  1103. Explorer.ViewNode(nodes[model])
  1104. end
  1105. end})
  1106.  
  1107. context:Register("UNGROUP",{Name = "Ungroup", IconMap = Explorer.MiscIcons, Icon = "Ungroup", DisabledIcon = "Ungroup_Disabled", Shortcut = "Ctrl+U", OnClick = function()
  1108. local newSelection = {}
  1109. local count = 1
  1110. local isa = game.IsA
  1111.  
  1112. local function ungroup(node)
  1113. local par = node.Parent.Obj
  1114. local ch = {}
  1115. local chCount = 1
  1116.  
  1117. for i = 1,#node do
  1118. local n = node[i]
  1119. newSelection[count] = n
  1120. ch[chCount] = n
  1121. count = count + 1
  1122. chCount = chCount + 1
  1123. end
  1124.  
  1125. for i = 1,#ch do
  1126. pcall(function() ch[i].Obj.Parent = par end)
  1127. end
  1128.  
  1129. node.Obj:Destroy()
  1130. end
  1131.  
  1132. for i,v in next,selection.List do
  1133. if isa(v.Obj,"Model") then
  1134. ungroup(v)
  1135. end
  1136. end
  1137.  
  1138. selection:SetTable(newSelection)
  1139. if #newSelection > 0 then
  1140. Explorer.ViewNode(newSelection[1])
  1141. end
  1142. end})
  1143.  
  1144. context:Register("SELECT_CHILDREN",{Name = "Select Children", IconMap = Explorer.MiscIcons, Icon = "SelectChildren", DisabledIcon = "SelectChildren_Disabled", OnClick = function()
  1145. local newSelection = {}
  1146. local count = 1
  1147. local sList = selection.List
  1148.  
  1149. for i = 1,#sList do
  1150. local node = sList[i]
  1151. for ind = 1,#node do
  1152. local cNode = node[ind]
  1153. if ind == 1 then Explorer.MakeNodeVisible(cNode) end
  1154.  
  1155. newSelection[count] = cNode
  1156. count = count + 1
  1157. end
  1158. end
  1159.  
  1160. selection:SetTable(newSelection)
  1161. if #newSelection > 0 then
  1162. Explorer.ViewNode(newSelection[1])
  1163. else
  1164. Explorer.Refresh()
  1165. end
  1166. end})
  1167.  
  1168. context:Register("JUMP_TO_PARENT",{Name = "Jump to Parent", IconMap = Explorer.MiscIcons, Icon = "JumpToParent", OnClick = function()
  1169. local newSelection = {}
  1170. local count = 1
  1171. local sList = selection.List
  1172.  
  1173. for i = 1,#sList do
  1174. local node = sList[i]
  1175. if node.Parent then
  1176. newSelection[count] = node.Parent
  1177. count = count + 1
  1178. end
  1179. end
  1180.  
  1181. selection:SetTable(newSelection)
  1182. if #newSelection > 0 then
  1183. Explorer.ViewNode(newSelection[1])
  1184. else
  1185. Explorer.Refresh()
  1186. end
  1187. end})
  1188.  
  1189. context:Register("TELEPORT_TO",{Name = "Teleport To", IconMap = Explorer.MiscIcons, Icon = "TeleportTo", OnClick = function()
  1190. local sList = selection.List
  1191. local plrRP = plr.Character and plr.Character:FindFirstChild("HumanoidRootPart")
  1192.  
  1193. if not plrRP then return end
  1194.  
  1195. for _,node in next, sList do
  1196. local Obj = node.Obj
  1197.  
  1198. if Obj:IsA("BasePart") then
  1199. if Obj.CanCollide then
  1200. plr.Character:MoveTo(Obj.Position)
  1201. else
  1202. plrRP.CFrame = CFrame.new(Obj.Position + Settings.Explorer.TeleportToOffset)
  1203. end
  1204. break
  1205. elseif Obj:IsA("Model") then
  1206. if Obj.PrimaryPart then
  1207. if Obj.PrimaryPart.CanCollide then
  1208. plr.Character:MoveTo(Obj.PrimaryPart.Position)
  1209. else
  1210. plrRP.CFrame = CFrame.new(Obj.PrimaryPart.Position + Settings.Explorer.TeleportToOffset)
  1211. end
  1212. break
  1213. else
  1214. local part = Obj:FindFirstChildWhichIsA("BasePart", true)
  1215. if part and nodes[part] then
  1216. if part.CanCollide then
  1217. plr.Character:MoveTo(part.Position)
  1218. else
  1219. plrRP.CFrame = CFrame.new(part.Position + Settings.Explorer.TeleportToOffset)
  1220. end
  1221. break
  1222. elseif Obj.WorldPivot then
  1223. plrRP.CFrame = Obj.WorldPivot
  1224. end
  1225. end
  1226. end
  1227. end
  1228. end})
  1229.  
  1230. local OldAnimation
  1231. context:Register("PLAY_TWEEN",{Name = "Play Tween", IconMap = Explorer.MiscIcons, Icon = "Play", OnClick = function()
  1232. local sList = selection.List
  1233.  
  1234. for i = 1, #sList do
  1235. local node = sList[i]
  1236. local Obj = node.Obj
  1237.  
  1238. if Obj:IsA("Tween") then Obj:Play() end
  1239. end
  1240. end})
  1241.  
  1242. local OldAnimation
  1243. context:Register("LOAD_ANIMATION",{Name = "Load Animation", IconMap = Explorer.MiscIcons, Icon = "Play", OnClick = function()
  1244. local sList = selection.List
  1245.  
  1246. local Humanoid = plr.Character and plr.Character:FindFirstChild("Humanoid")
  1247. if not Humanoid then return end
  1248.  
  1249. for i = 1, #sList do
  1250. local node = sList[i]
  1251. local Obj = node.Obj
  1252.  
  1253. if Obj:IsA("Animation") then
  1254. if OldAnimation then OldAnimation:Stop() end
  1255. OldAnimation = Humanoid:LoadAnimation(Obj)
  1256. OldAnimation:Play()
  1257. break
  1258. end
  1259. end
  1260. end})
  1261.  
  1262. context:Register("STOP_ANIMATION",{Name = "Stop Animation", IconMap = Explorer.MiscIcons, Icon = "Pause", OnClick = function()
  1263. local sList = selection.List
  1264.  
  1265. local Humanoid = plr.Character and plr.Character:FindFirstChild("Humanoid")
  1266. if not Humanoid then return end
  1267.  
  1268. for i = 1, #sList do
  1269. local node = sList[i]
  1270. local Obj = node.Obj
  1271.  
  1272. if Obj:IsA("Animation") then
  1273. if OldAnimation then OldAnimation:Stop() end
  1274. Humanoid:LoadAnimation(Obj):Stop()
  1275. break
  1276. end
  1277. end
  1278. end})
  1279.  
  1280. context:Register("EXPAND_ALL",{Name = "Expand All", OnClick = function()
  1281. local sList = selection.List
  1282.  
  1283. local function expand(node)
  1284. expanded[node] = true
  1285. for i = 1,#node do
  1286. if #node[i] > 0 then
  1287. expand(node[i])
  1288. end
  1289. end
  1290. end
  1291.  
  1292. for i = 1,#sList do
  1293. expand(sList[i])
  1294. end
  1295.  
  1296. Explorer.ForceUpdate()
  1297. end})
  1298.  
  1299. context:Register("COLLAPSE_ALL",{Name = "Collapse All", OnClick = function()
  1300. local sList = selection.List
  1301.  
  1302. local function expand(node)
  1303. expanded[node] = nil
  1304. for i = 1,#node do
  1305. if #node[i] > 0 then
  1306. expand(node[i])
  1307. end
  1308. end
  1309. end
  1310.  
  1311. for i = 1,#sList do
  1312. expand(sList[i])
  1313. end
  1314.  
  1315. Explorer.ForceUpdate()
  1316. end})
  1317.  
  1318. context:Register("CLEAR_SEARCH_AND_JUMP_TO",{Name = "Clear Search and Jump to", OnClick = function()
  1319. local newSelection = {}
  1320. local count = 1
  1321. local sList = selection.List
  1322.  
  1323. for i = 1,#sList do
  1324. newSelection[count] = sList[i]
  1325. count = count + 1
  1326. end
  1327.  
  1328. selection:SetTable(newSelection)
  1329. Explorer.ClearSearch()
  1330. if #newSelection > 0 then
  1331. Explorer.ViewNode(newSelection[1])
  1332. end
  1333. end})
  1334.  
  1335. -- this code is very bad but im lazy and it works so cope
  1336. local clth = function(str)
  1337. if str:sub(1, 28) == "game:GetService(\"Workspace\")" then str = str:gsub("game:GetService%(\"Workspace\"%)", "workspace", 1) end
  1338. if str:sub(1, 27 + #plr.Name) == "game:GetService(\"Players\")." .. plr.Name then str = str:gsub("game:GetService%(\"Players\"%)." .. plr.Name, "game:GetService(\"Players\").LocalPlayer", 1) end
  1339. return str
  1340. end
  1341.  
  1342. context:Register("COPY_PATH",{Name = "Copy Path", IconMap = Explorer.ClassIcons, Icon = 50, OnClick = function()
  1343. local sList = selection.List
  1344. if #sList == 1 then
  1345. env.setclipboard(clth(Explorer.GetInstancePath(sList[1].Obj)))
  1346. elseif #sList > 1 then
  1347. local resList = {"{"}
  1348. local count = 2
  1349. for i = 1,#sList do
  1350. local path = "\t"..clth(Explorer.GetInstancePath(sList[i].Obj))..","
  1351. if #path > 0 then
  1352. resList[count] = path
  1353. count = count+1
  1354. end
  1355. end
  1356. resList[count] = "}"
  1357. env.setclipboard(table.concat(resList,"\n"))
  1358. end
  1359. end})
  1360.  
  1361. context:Register("INSERT_OBJECT",{Name = "Insert Object", IconMap = Explorer.MiscIcons, Icon = "InsertObject", OnClick = function()
  1362. local mouse = Main.Mouse
  1363. local x,y = Explorer.LastRightClickX or mouse.X, Explorer.LastRightClickY or mouse.Y
  1364. Explorer.InsertObjectContext:Show(x,y)
  1365. end})
  1366.  
  1367. --[[context:Register("CALL_FUNCTION",{Name = "Call Function", IconMap = Explorer.ClassIcons, Icon = 66, OnClick = function()
  1368.  
  1369. end})
  1370.  
  1371. context:Register("GET_REFERENCES",{Name = "Get Lua References", IconMap = Explorer.ClassIcons, Icon = 34, OnClick = function()
  1372.  
  1373. end})
  1374.  
  1375. context:Register("SAVE_INST",{Name = "Save to File", IconMap = Explorer.MiscIcons, Icon = "Save", OnClick = function()
  1376.  
  1377. end})
  1378.  
  1379. context:Register("VIEW_CONNECTIONS",{Name = "View Connections", OnClick = function()
  1380.  
  1381. end})
  1382.  
  1383. context:Register("VIEW_API",{Name = "View API Page", IconMap = Explorer.MiscIcons, Icon = "Reference", OnClick = function()
  1384.  
  1385. end})]]
  1386.  
  1387. context:Register("VIEW_OBJECT",{Name = "View Object (Right click to reset)", IconMap = Explorer.ClassIcons, Icon = 5, OnClick = function()
  1388. local sList = selection.List
  1389. local isa = game.IsA
  1390.  
  1391. for i = 1,#sList do
  1392. local node = sList[i]
  1393.  
  1394. if isa(node.Obj,"BasePart") or isa(node.Obj, "Model") then
  1395. workspace.CurrentCamera.CameraSubject = node.Obj
  1396. break
  1397. end
  1398. end
  1399. end, OnRightClick = function()
  1400. workspace.CurrentCamera.CameraSubject = plr.Character
  1401. end})
  1402.  
  1403. context:Register("FIRE_TOUCHTRANSMITTER",{Name = "Fire TouchTransmitter", IconMap = Explorer.ClassIcons, Icon = 37, OnClick = function()
  1404. local hrp = plr.Character and plr.Character:FindFirstChild("HumanoidRootPart")
  1405. if not hrp then return end
  1406. for _, v in ipairs(selection.List) do if v.Obj and v.Obj:IsA("TouchTransmitter") then firetouchinterest(hrp, v.Obj.Parent, 0) end end
  1407. end})
  1408.  
  1409. context:Register("FIRE_CLICKDETECTOR",{Name = "Fire ClickDetector", IconMap = Explorer.ClassIcons, Icon = 41, OnClick = function()
  1410. local hrp = plr.Character and plr.Character:FindFirstChild("HumanoidRootPart")
  1411. if not hrp then return end
  1412. for _, v in ipairs(selection.List) do if v.Obj and v.Obj:IsA("ClickDetector") then fireclickdetector(v.Obj) end end
  1413. end})
  1414.  
  1415. context:Register("FIRE_PROXIMITYPROMPT",{Name = "Fire ProximityPrompt", IconMap = Explorer.ClassIcons, Icon = 124, OnClick = function()
  1416. local hrp = plr.Character and plr.Character:FindFirstChild("HumanoidRootPart")
  1417. if not hrp then return end
  1418. for _, v in ipairs(selection.List) do if v.Obj and v.Obj:IsA("ProximityPrompt") then fireproximityprompt(v.Obj) end end
  1419. end})
  1420.  
  1421. context:Register("VIEW_SCRIPT",{Name = "View Script", IconMap = Explorer.MiscIcons, Icon = "ViewScript", OnClick = function()
  1422. local scr = selection.List[1] and selection.List[1].Obj
  1423. if scr then ScriptViewer.ViewScript(scr) end
  1424. end})
  1425.  
  1426. context:Register("SAVE_SCRIPT",{Name = "Save Script", IconMap = Explorer.MiscIcons, Icon = "Save", OnClick = function()
  1427. for _, v in next, selection.List do
  1428. if v.Obj:IsA("LuaSourceContainer") and env.isViableDecompileScript(v.Obj) then
  1429. local success, source = pcall(env.decompile, v.Obj)
  1430. if not success or not source then source = ("-- DEX - %s failed to decompile %s"):format(env.executor, v.Obj.ClassName) end
  1431. local fileName = ("%i.%s.%s.Source.txt"):format(game.PlaceId, v.Obj.ClassName, env.parsefile(v.Obj.Name))
  1432. env.writefile(fileName, source)
  1433. task.wait(0.2)
  1434. end
  1435. end
  1436. end})
  1437.  
  1438. context:Register("SAVE_BYTECODE",{Name = "Save Script Bytecode", IconMap = Explorer.MiscIcons, Icon = "Save", OnClick = function()
  1439. for _, v in next, selection.List do
  1440. if v.Obj:IsA("LuaSourceContainer") and env.isViableDecompileScript(v.Obj) then
  1441. local success, bytecode = pcall(getscriptbytecode, v.Obj)
  1442. if success and type(bytecode) == "string" then
  1443. local fileName = ("%i.%s.%s.Bytecode.txt"):format(game.PlaceId, v.Obj.ClassName, env.parsefile(v.Obj.Name))
  1444. env.writefile(fileName, bytecode)
  1445. task.wait(0.2)
  1446. end
  1447. end
  1448. end
  1449. end})
  1450.  
  1451. context:Register("SELECT_CHARACTER",{Name = "Select Character", IconMap = Explorer.ClassIcons, Icon = 9, OnClick = function()
  1452. local newSelection = {}
  1453. local count = 1
  1454. local sList = selection.List
  1455. local isa = game.IsA
  1456.  
  1457. for i = 1,#sList do
  1458. local node = sList[i]
  1459. if isa(node.Obj,"Player") and nodes[node.Obj.Character] then
  1460. newSelection[count] = nodes[node.Obj.Character]
  1461. count = count + 1
  1462. end
  1463. end
  1464.  
  1465. selection:SetTable(newSelection)
  1466. if #newSelection > 0 then
  1467. Explorer.ViewNode(newSelection[1])
  1468. else
  1469. Explorer.Refresh()
  1470. end
  1471. end})
  1472.  
  1473. context:Register("VIEW_PLAYER",{Name = "View Player", IconMap = Explorer.ClassIcons, Icon = 5, OnClick = function()
  1474. local newSelection = {}
  1475. local count = 1
  1476. local sList = selection.List
  1477. local isa = game.IsA
  1478.  
  1479. for i = 1,#sList do
  1480. local node = sList[i]
  1481. local Obj = node.Obj
  1482. if Obj:IsA("Player") and Obj.Character then
  1483. workspace.CurrentCamera.CameraSubject = Obj.Character
  1484. break
  1485. end
  1486. end
  1487. end})
  1488.  
  1489. context:Register("SELECT_LOCAL_PLAYER",{Name = "Select Local Player", IconMap = Explorer.ClassIcons, Icon = 9, OnClick = function()
  1490. pcall(function() if nodes[plr] then selection:Set(nodes[plr]) Explorer.ViewNode(nodes[plr]) end end)
  1491. end})
  1492.  
  1493. context:Register("SELECT_ALL_CHARACTERS",{Name = "Select All Characters", IconMap = Explorer.ClassIcons, Icon = 2, OnClick = function()
  1494. local newSelection = {}
  1495. local sList = selection.List
  1496.  
  1497. for i,v in next, service.Players:GetPlayers() do
  1498. if v.Character and nodes[v.Character] then
  1499. if i == 1 then Explorer.MakeNodeVisible(v.Character) end
  1500. table.insert(newSelection, nodes[v.Character])
  1501. end
  1502. end
  1503.  
  1504. selection:SetTable(newSelection)
  1505. if #newSelection > 0 then
  1506. Explorer.ViewNode(newSelection[1])
  1507. else
  1508. Explorer.Refresh()
  1509. end
  1510. end})
  1511.  
  1512. context:Register("REFRESH_NIL",{Name = "Refresh Nil Instances", OnClick = function()
  1513. Explorer.RefreshNilInstances()
  1514. end})
  1515.  
  1516. context:Register("HIDE_NIL",{Name = "Hide Nil Instances", OnClick = function()
  1517. Explorer.HideNilInstances()
  1518. end})
  1519.  
  1520. Explorer.RightClickContext = context
  1521. end
  1522.  
  1523. Explorer.HideNilInstances = function()
  1524. table.clear(nilMap)
  1525.  
  1526. local disconnectCon = Instance.new("Folder").ChildAdded:Connect(function() end).Disconnect
  1527. for i,v in next,nilCons do
  1528. disconnectCon(v[1])
  1529. disconnectCon(v[2])
  1530. end
  1531. table.clear(nilCons)
  1532.  
  1533. for i = 1,#nilNode do
  1534. coroutine.wrap(removeObject)(nilNode[i].Obj)
  1535. end
  1536.  
  1537. Explorer.Update()
  1538. Explorer.Refresh()
  1539. end
  1540.  
  1541. Explorer.RefreshNilInstances = function()
  1542. if not env.getnilinstances then return end
  1543.  
  1544. local nilInsts = env.getnilinstances()
  1545. local game = game
  1546. local getDescs = game.GetDescendants
  1547. --local newNilMap = {}
  1548. --local newNilRoots = {}
  1549. --local nilRoots = Explorer.NilRoots
  1550. --local connect = game.DescendantAdded.Connect
  1551. --local disconnect
  1552. --if not nilRoots then nilRoots = {} Explorer.NilRoots = nilRoots end
  1553.  
  1554. for i = 1,#nilInsts do
  1555. local obj = nilInsts[i]
  1556. if obj ~= game then
  1557. nilMap[obj] = true
  1558. --newNilRoots[obj] = true
  1559.  
  1560. local descs = getDescs(obj)
  1561. for j = 1,#descs do
  1562. nilMap[descs[j]] = true
  1563. end
  1564. end
  1565. end
  1566.  
  1567. -- Remove unmapped nil nodes
  1568. --[[for i = 1,#nilNode do
  1569. local node = nilNode[i]
  1570. if not newNilMap[node.Obj] then
  1571. nilMap[node.Obj] = nil
  1572. coroutine.wrap(removeObject)(node)
  1573. end
  1574. end]]
  1575.  
  1576. --nilMap = newNilMap
  1577.  
  1578. for i = 1,#nilInsts do
  1579. local obj = nilInsts[i]
  1580. local node = nodes[obj]
  1581. if not node then coroutine.wrap(addObject)(obj) end
  1582. end
  1583.  
  1584. --[[
  1585. -- Remove old root connections
  1586. for obj in next,nilRoots do
  1587. if not newNilRoots[obj] then
  1588. if not disconnect then disconnect = obj[1].Disconnect end
  1589. disconnect(obj[1])
  1590. disconnect(obj[2])
  1591. end
  1592. end
  1593.  
  1594. for obj in next,newNilRoots do
  1595. if not nilRoots[obj] then
  1596. nilRoots[obj] = {
  1597. connect(obj.DescendantAdded,addObject),
  1598. connect(obj.DescendantRemoving,removeObject)
  1599. }
  1600. end
  1601. end]]
  1602.  
  1603. --nilMap = newNilMap
  1604. --Explorer.NilRoots = newNilRoots
  1605.  
  1606. Explorer.Update()
  1607. Explorer.Refresh()
  1608. end
  1609.  
  1610. Explorer.GetInstancePath = function(obj)
  1611. local ffc = game.FindFirstChild
  1612. local getCh = game.GetChildren
  1613. local path = ""
  1614. local curObj = obj
  1615. local ts = tostring
  1616. local match = string.match
  1617. local gsub = string.gsub
  1618. local tableFind = table.find
  1619. local useGetCh = Settings.Explorer.CopyPathUseGetChildren
  1620. local formatLuaString = Lib.FormatLuaString
  1621.  
  1622. while curObj do
  1623. if curObj == game then
  1624. path = "game"..path
  1625. break
  1626. end
  1627.  
  1628. local className = curObj.ClassName
  1629. local curName = ts(curObj)
  1630. local indexName
  1631. if match(curName,"^[%a_][%w_]*$") then
  1632. indexName = "."..curName
  1633. else
  1634. local cleanName = formatLuaString(curName)
  1635. indexName = '["'..cleanName..'"]'
  1636. end
  1637.  
  1638. local parObj = curObj.Parent
  1639. if parObj then
  1640. local fc = ffc(parObj,curName)
  1641. if useGetCh and fc and fc ~= curObj then
  1642. local parCh = getCh(parObj)
  1643. local fcInd = tableFind(parCh,curObj)
  1644. indexName = ":GetChildren()["..fcInd.."]"
  1645. elseif parObj == game and API.Classes[className] and API.Classes[className].Tags.Service then
  1646. indexName = ':GetService("'..className..'")'
  1647. end
  1648. elseif parObj == nil then
  1649. local getnil = "local getNil = function(name, class) for _, v in next, getnilinstances() do if v.ClassName == class and v.Name == name then return v end end end"
  1650. local gotnil = "\n\ngetNil(\"%s\", \"%s\")"
  1651. indexName = getnil .. gotnil:format(curObj.Name, className)
  1652. end
  1653.  
  1654. path = indexName..path
  1655. curObj = parObj
  1656. end
  1657.  
  1658. return path
  1659. end
  1660.  
  1661. Explorer.DefaultProps = {
  1662. ["BasePart"] = {
  1663. Position = function(Obj)
  1664. local Player = service.Players.LocalPlayer
  1665. if Player.Character and Player.Character:FindFirstChild("HumanoidRootPart") then
  1666. Obj.Position = (Player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -10)).p
  1667. end
  1668. return Obj.Position
  1669. end,
  1670. Anchored = true
  1671. },
  1672. ["GuiObject"] = {
  1673. Position = function(Obj) return (Obj.Parent:IsA("ScreenGui") and UDim2.new(0.5, 0, 0.5, 0)) or Obj.Position end,
  1674. Active = true
  1675. }
  1676. }
  1677.  
  1678. Explorer.InitInsertObject = function()
  1679. local context = Lib.ContextMenu.new()
  1680. context.SearchEnabled = true
  1681. context.MaxHeight = 400
  1682. context:ApplyTheme({
  1683. ContentColor = Settings.Theme.Main2,
  1684. OutlineColor = Settings.Theme.Outline1,
  1685. DividerColor = Settings.Theme.Outline1,
  1686. TextColor = Settings.Theme.Text,
  1687. HighlightColor = Settings.Theme.ButtonHover
  1688. })
  1689.  
  1690. local classes = {}
  1691. for i,class in next,API.Classes do
  1692. local tags = class.Tags
  1693. if not tags.NotCreatable and not tags.Service then
  1694. local rmdEntry = RMD.Classes[class.Name]
  1695. classes[#classes+1] = {class,rmdEntry and rmdEntry.ClassCategory or "Uncategorized"}
  1696. end
  1697. end
  1698. table.sort(classes,function(a,b)
  1699. if a[2] ~= b[2] then
  1700. return a[2] < b[2]
  1701. else
  1702. return a[1].Name < b[1].Name
  1703. end
  1704. end)
  1705.  
  1706. local function defaultProps(obj)
  1707. for class, props in pairs(Explorer.DefaultProps) do
  1708. if obj:IsA(class) then
  1709. for prop, value in pairs(props) do
  1710. obj[prop] = (type(value) == "function" and value(obj)) or value
  1711. end
  1712. end
  1713. end
  1714. end
  1715.  
  1716. local function onClick(className)
  1717. local sList = selection.List
  1718. local instNew = Instance.new
  1719. for i = 1,#sList do
  1720. local node = sList[i]
  1721. local obj = node.Obj
  1722. Explorer.MakeNodeVisible(node, true)
  1723. local success, obj = pcall(instNew, className, obj)
  1724. if success and obj then defaultProps(obj) end
  1725. end
  1726. end
  1727.  
  1728. local lastCategory = ""
  1729. for i = 1,#classes do
  1730. local class = classes[i][1]
  1731. local rmdEntry = RMD.Classes[class.Name]
  1732. local iconInd = rmdEntry and tonumber(rmdEntry.ExplorerImageIndex) or 0
  1733. local category = classes[i][2]
  1734.  
  1735. if lastCategory ~= category then
  1736. context:AddDivider(category)
  1737. lastCategory = category
  1738. end
  1739. context:Add({Name = class.Name, IconMap = Explorer.ClassIcons, Icon = iconInd, OnClick = onClick})
  1740. end
  1741.  
  1742. Explorer.InsertObjectContext = context
  1743. end
  1744.  
  1745. Explorer._SearchFilters = {} do
  1746. local Filters = Explorer._SearchFilters
  1747.  
  1748. local function NewFilter(list, func)
  1749. for _,v in next, list do
  1750. Filters[v:lower() .. ":"] = func
  1751. end
  1752. end
  1753.  
  1754. local Only = {
  1755. remotes = {"RemoteEvent", "RemoteFunction", "BindableEvent", "BindableFunction"},
  1756. scripts = {"Script", "LocalScript", "ModuleScript"},
  1757. players = {"Player"}
  1758. }
  1759.  
  1760. NewFilter({"parent", "p"}, function(Obj, str) return Obj.Parent and (Obj.Parent.Name:lower()):find(str) end)
  1761. NewFilter({"class", "c"}, function(Obj, str) return (Obj.ClassName:lower()):find(str) end)
  1762. NewFilter({"isa", "i"}, function(Obj, str) return Obj:IsA(str) end)
  1763.  
  1764. NewFilter({"only", "o"}, function(Obj, str)
  1765. local Special = Only[str]
  1766. return Special and table.find(Special, Obj.ClassName)
  1767. end)
  1768. end
  1769.  
  1770. Explorer.DoSearch = function(query)
  1771. table.clear(Explorer.SearchExpanded)
  1772. table.clear(searchResults)
  1773. expanded = (#query == 0 and Explorer.Expanded) or Explorer.SearchExpanded
  1774.  
  1775. local tostr = tostring;
  1776. local tfind = table.find;
  1777.  
  1778. local Filters = Explorer._SearchFilters
  1779. local expandTable = Explorer.SearchExpanded
  1780.  
  1781. local allnodes = nodes[game]
  1782.  
  1783. local defaultSearch = (function(Obj, str) return (Obj.Name:lower()):find(str, 1, true) end)
  1784.  
  1785. local function searchTable(root, str, func)
  1786. local expandedpar = false
  1787. for _,node in ipairs(root) do
  1788. if func(node.Obj, str) then
  1789. expandTable[node] = 0
  1790. searchResults[node] = true
  1791. if not expandedpar then
  1792. local parnode = node.Parent
  1793. while parnode and (not searchResults[parnode] or expandTable[parnode] == 0) do
  1794. expanded[parnode] = true
  1795. searchResults[parnode] = true
  1796. parnode = parnode.Parent
  1797. end
  1798. expandedpar = true
  1799. end
  1800. end
  1801.  
  1802. if #node > 0 then searchTable(node, str, func) end
  1803. end
  1804. end
  1805.  
  1806. local function Search(query)
  1807. if query:len() == 0 then return end
  1808.  
  1809. local lower = query:lower()
  1810. local split = lower:split(":")
  1811. local Filter = (Filters[split[1] .. ":"]) or nil
  1812.  
  1813. if Filter then
  1814. searchTable(allnodes, (split[2] or ""), Filter)
  1815. else
  1816. searchTable(allnodes, (lower or ""), defaultSearch)
  1817. end
  1818. end
  1819.  
  1820. for _,v in ipairs(query:split(",")) do
  1821. if v:len() > 0 then
  1822. Search(v)
  1823. end
  1824. end
  1825.  
  1826. --[=[if #query > 0 then
  1827. local expandTable = Explorer.SearchExpanded
  1828. local specFilters
  1829.  
  1830. local lower = string.lower
  1831. local find = string.find
  1832. local tostring = tostring
  1833.  
  1834. local lowerQuery = lower(query)
  1835.  
  1836. local function defaultSearch(root)
  1837. local expandedpar = false
  1838. for i = 1,#root do
  1839. local node = root[i]
  1840. local obj = node.Obj
  1841.  
  1842. if find(lower(tostring(obj)),lowerQuery,1,true) then
  1843. expandTable[node] = 0
  1844. searchResults[node] = true
  1845. if not expandedpar then
  1846. local parnode = node.Parent
  1847. while parnode and (not searchResults[parnode] or expandTable[parnode] == 0) do
  1848. expanded[parnode] = true
  1849. searchResults[parnode] = true
  1850. parnode = parnode.Parent
  1851. end
  1852. expandedpar = true
  1853. end
  1854. elseif ExplorerSearch[lower(tostring(obj))] then
  1855.  
  1856. end
  1857.  
  1858. if #node > 0 then defaultSearch(node) end
  1859. end
  1860. end
  1861.  
  1862. if Main.Elevated then
  1863. local start = tick()
  1864. searchFunc,specFilters = Explorer.BuildSearchFunc(query)
  1865. --print("BUILD SEARCH",tick()-start)
  1866. else
  1867. searchFunc = defaultSearch
  1868. end
  1869.  
  1870. if specFilters then
  1871. table.clear(specResults)
  1872. for i = 1,#specFilters do -- Specific search filers that returns list of matches
  1873. local resMap = {}
  1874. specResults[i] = resMap
  1875. local objs = specFilters[i]()
  1876. for c = 1,#objs do
  1877. local node = nodes[objs[c]]
  1878. if node then
  1879. resMap[node] = true
  1880. end
  1881. end
  1882. end
  1883. end
  1884.  
  1885. if searchFunc then
  1886. local start = tick()
  1887. searchFunc(nodes[game])
  1888. searchFunc(nilNode)
  1889. --warn(tick()-start)
  1890. end
  1891. end]=]
  1892.  
  1893. Explorer.ForceUpdate()
  1894. end
  1895.  
  1896. Explorer.ClearSearch = function()
  1897. Explorer.GuiElems.SearchBar.Text = ""
  1898. expanded = Explorer.Expanded
  1899. searchFunc = nil
  1900. end
  1901.  
  1902. Explorer.InitSearch = function()
  1903. local TweenService = service.TweenService
  1904. local SearchFrame = Explorer.GuiElems.ToolBar.SearchFrame
  1905. local searchBox = SearchFrame.SearchBox
  1906. Explorer.GuiElems.SearchBar = searchBox
  1907.  
  1908. local TweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quint)
  1909. local Tweens = {
  1910. Start = TweenService:Create(SearchFrame.UIStroke, TweenInfo, { Color = Color3.fromRGB(0, 120, 215) }),
  1911. End = TweenService:Create(SearchFrame.UIStroke, TweenInfo, { Color = Color3.fromRGB(42, 42, 42) })
  1912. }
  1913.  
  1914. searchBox.FocusLost:Connect(function() Tweens.End:Play() end)
  1915. searchBox.Focused:Connect(function() Tweens.Start:Play() end)
  1916.  
  1917. Lib.ViewportTextBox.convert(searchBox)
  1918.  
  1919. searchBox.FocusLost:Connect(function()
  1920. Explorer.DoSearch(searchBox.Text)
  1921. end)
  1922. end
  1923.  
  1924. Explorer.InitEntryTemplate = function()
  1925. entryTemplate = create({
  1926. {1,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0,0,0),BackgroundTransparency=1,BorderColor3=Color3.new(0,0,0),Font=3,Name="Entry",Position=UDim2.new(0,1,0,1),Size=UDim2.new(0,250,0,20),Text="",TextSize=14,}},
  1927. {2,"Frame",{BackgroundColor3=Color3.new(0.04313725605607,0.35294118523598,0.68627452850342),BackgroundTransparency=1,BorderColor3=Color3.new(0.33725491166115,0.49019610881805,0.73725491762161),BorderSizePixel=0,Name="Indent",Parent={1},Position=UDim2.new(0,20,0,0),Size=UDim2.new(1,-20,1,0),}},
  1928. {3,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="EntryName",Parent={2},Position=UDim2.new(0,26,0,0),Size=UDim2.new(1,-26,1,0),Text="Workspace",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  1929. {4,"TextButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,ClipsDescendants=true,Font=3,Name="Expand",Parent={2},Position=UDim2.new(0,-20,0,0),Size=UDim2.new(0,20,0,20),Text="",TextSize=14,}},
  1930. {5,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://5642383285",ImageRectOffset=Vector2.new(144,16),ImageRectSize=Vector2.new(16,16),Name="Icon",Parent={4},Position=UDim2.new(0,2,0,2),ScaleType=4,Size=UDim2.new(0,16,0,16),}},
  1931. {6,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,ImageRectOffset=Vector2.new(304,0),ImageRectSize=Vector2.new(16,16),Name="Icon",Parent={2},Position=UDim2.new(0,4,0,2),ScaleType=4,Size=UDim2.new(0,16,0,16),}},
  1932. })
  1933.  
  1934. local sys = Lib.ClickSystem.new()
  1935. sys.AllowedButtons = {1,2}
  1936. sys.OnDown:Connect(function(item,combo,button)
  1937. local ind = table.find(listEntries,item)
  1938. if not ind then return end
  1939. local node = tree[ind + Explorer.Index]
  1940. if not node then return end
  1941.  
  1942. local entry = listEntries[ind]
  1943.  
  1944. if button == 1 then
  1945. if combo == 2 then
  1946. if node.Obj:IsA("LuaSourceContainer") then
  1947. ScriptViewer.ViewScript(node.Obj)
  1948. elseif #node > 0 and expanded[node] ~= 0 then
  1949. expanded[node] = not expanded[node]
  1950. Explorer.Update()
  1951. end
  1952. end
  1953.  
  1954. if Properties.SelectObject(node.Obj) then
  1955. sys.IsRenaming = false
  1956. return
  1957. end
  1958.  
  1959. sys.IsRenaming = selection.Map[node]
  1960.  
  1961. if Lib.IsShiftDown() then
  1962. if not selection.Piviot then return end
  1963.  
  1964. local fromIndex = table.find(tree,selection.Piviot)
  1965. local toIndex = table.find(tree,node)
  1966. if not fromIndex or not toIndex then return end
  1967. fromIndex,toIndex = math.min(fromIndex,toIndex),math.max(fromIndex,toIndex)
  1968.  
  1969. local sList = selection.List
  1970. for i = #sList,1,-1 do
  1971. local elem = sList[i]
  1972. if selection.ShiftSet[elem] then
  1973. selection.Map[elem] = nil
  1974. table.remove(sList,i)
  1975. end
  1976. end
  1977. selection.ShiftSet = {}
  1978. for i = fromIndex,toIndex do
  1979. local elem = tree[i]
  1980. if not selection.Map[elem] then
  1981. selection.ShiftSet[elem] = true
  1982. selection.Map[elem] = true
  1983. sList[#sList+1] = elem
  1984. end
  1985. end
  1986. selection.Changed:Fire()
  1987. elseif Lib.IsCtrlDown() then
  1988. selection.ShiftSet = {}
  1989. if selection.Map[node] then selection:Remove(node) else selection:Add(node) end
  1990. selection.Piviot = node
  1991. sys.IsRenaming = false
  1992. elseif not selection.Map[node] then
  1993. selection.ShiftSet = {}
  1994. selection:Set(node)
  1995. selection.Piviot = node
  1996. end
  1997. elseif button == 2 then
  1998. if Properties.SelectObject(node.Obj) then
  1999. return
  2000. end
  2001.  
  2002. if not Lib.IsCtrlDown() and not selection.Map[node] then
  2003. selection.ShiftSet = {}
  2004. selection:Set(node)
  2005. selection.Piviot = node
  2006. Explorer.Refresh()
  2007. end
  2008. end
  2009.  
  2010. Explorer.Refresh()
  2011. end)
  2012.  
  2013. sys.OnRelease:Connect(function(item,combo,button,position)
  2014. local ind = table.find(listEntries,item)
  2015. if not ind then return end
  2016. local node = tree[ind + Explorer.Index]
  2017. if not node then return end
  2018.  
  2019. if button == 1 then
  2020. if selection.Map[node] and not Lib.IsShiftDown() and not Lib.IsCtrlDown() then
  2021. selection.ShiftSet = {}
  2022. selection:Set(node)
  2023. selection.Piviot = node
  2024. Explorer.Refresh()
  2025. end
  2026.  
  2027. local id = sys.ClickId
  2028. Lib.FastWait(sys.ComboTime)
  2029. if combo == 1 and id == sys.ClickId and sys.IsRenaming and selection.Map[node] then
  2030. Explorer.SetRenamingNode(node)
  2031. end
  2032. elseif button == 2 then
  2033. Explorer.ShowRightClick(position)
  2034. end
  2035. end)
  2036. Explorer.ClickSystem = sys
  2037. end
  2038.  
  2039. Explorer.InitDelCleaner = function()
  2040. coroutine.wrap(function()
  2041. local fw = Lib.FastWait
  2042. while true do
  2043. local processed = false
  2044. local c = 0
  2045. for _,node in next,nodes do
  2046. if node.HasDel then
  2047. local delInd
  2048. for i = 1,#node do
  2049. if node[i].Del then
  2050. delInd = i
  2051. break
  2052. end
  2053. end
  2054. if delInd then
  2055. for i = delInd+1,#node do
  2056. local cn = node[i]
  2057. if not cn.Del then
  2058. node[delInd] = cn
  2059. delInd = delInd+1
  2060. end
  2061. end
  2062. for i = delInd,#node do
  2063. node[i] = nil
  2064. end
  2065. end
  2066. node.HasDel = false
  2067. processed = true
  2068. fw()
  2069. end
  2070. c = c + 1
  2071. if c > 10000 then
  2072. c = 0
  2073. fw()
  2074. end
  2075. end
  2076. if processed and not refreshDebounce then Explorer.PerformRefresh() end
  2077. fw(0.5)
  2078. end
  2079. end)()
  2080. end
  2081.  
  2082. Explorer.UpdateSelectionVisuals = function()
  2083. local holder = Explorer.SelectionVisualsHolder
  2084. local isa = game.IsA
  2085. local clone = game.Clone
  2086. if not holder then
  2087. holder = Instance.new("ScreenGui")
  2088. holder.Name = "ExplorerSelections"
  2089. holder.DisplayOrder = Main.DisplayOrders.Core
  2090. Lib.ShowGui(holder)
  2091. Explorer.SelectionVisualsHolder = holder
  2092. Explorer.SelectionVisualCons = {}
  2093.  
  2094. local guiTemplate = create({
  2095. {1,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Size=UDim2.new(0,100,0,100),}},
  2096. {2,"Frame",{BackgroundColor3=Color3.new(0.04313725605607,0.35294118523598,0.68627452850342),BorderSizePixel=0,Parent={1},Position=UDim2.new(0,-1,0,-1),Size=UDim2.new(1,2,0,1),}},
  2097. {3,"Frame",{BackgroundColor3=Color3.new(0.04313725605607,0.35294118523598,0.68627452850342),BorderSizePixel=0,Parent={1},Position=UDim2.new(0,-1,1,0),Size=UDim2.new(1,2,0,1),}},
  2098. {4,"Frame",{BackgroundColor3=Color3.new(0.04313725605607,0.35294118523598,0.68627452850342),BorderSizePixel=0,Parent={1},Position=UDim2.new(0,-1,0,0),Size=UDim2.new(0,1,1,0),}},
  2099. {5,"Frame",{BackgroundColor3=Color3.new(0.04313725605607,0.35294118523598,0.68627452850342),BorderSizePixel=0,Parent={1},Position=UDim2.new(1,0,0,0),Size=UDim2.new(0,1,1,0),}},
  2100. })
  2101. Explorer.SelectionVisualGui = guiTemplate
  2102.  
  2103. local boxTemplate = Instance.new("SelectionBox")
  2104. boxTemplate.LineThickness = 0.03
  2105. boxTemplate.Color3 = Color3.fromRGB(0, 170, 255)
  2106. Explorer.SelectionVisualBox = boxTemplate
  2107. end
  2108. holder:ClearAllChildren()
  2109.  
  2110. -- Updates theme
  2111. for i,v in pairs(Explorer.SelectionVisualGui:GetChildren()) do
  2112. v.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
  2113. end
  2114.  
  2115. local attachCons = Explorer.SelectionVisualCons
  2116. for i = 1,#attachCons do
  2117. attachCons[i].Destroy()
  2118. end
  2119. table.clear(attachCons)
  2120.  
  2121. local partEnabled = Settings.Explorer.PartSelectionBox
  2122. local guiEnabled = Settings.Explorer.GuiSelectionBox
  2123. if not partEnabled and not guiEnabled then return end
  2124.  
  2125. local svg = Explorer.SelectionVisualGui
  2126. local svb = Explorer.SelectionVisualBox
  2127. local attachTo = Lib.AttachTo
  2128. local sList = selection.List
  2129. local count = 1
  2130. local boxCount = 0
  2131. local workspaceNode = nodes[workspace]
  2132. for i = 1,#sList do
  2133. if boxCount > 1000 then break end
  2134. local node = sList[i]
  2135. local obj = node.Obj
  2136.  
  2137. if node ~= workspaceNode then
  2138. if isa(obj,"GuiObject") and guiEnabled then
  2139. local newVisual = clone(svg)
  2140. attachCons[count] = attachTo(newVisual,{Target = obj, Resize = true})
  2141. count = count + 1
  2142. newVisual.Parent = holder
  2143. boxCount = boxCount + 1
  2144. elseif isa(obj,"PVInstance") and partEnabled then
  2145. local newBox = clone(svb)
  2146. newBox.Adornee = obj
  2147. newBox.Parent = holder
  2148. boxCount = boxCount + 1
  2149. end
  2150. end
  2151. end
  2152. end
  2153.  
  2154. Explorer.Init = function()
  2155. Explorer.ClassIcons = Lib.IconMap.newLinear("rbxasset://textures/ClassImages.PNG", 16, 16)
  2156. Explorer.MiscIcons = Main.MiscIcons
  2157.  
  2158. clipboard = {}
  2159.  
  2160. selection = Lib.Set.new()
  2161. selection.ShiftSet = {}
  2162. selection.Changed:Connect(Properties.ShowExplorerProps)
  2163. Explorer.Selection = selection
  2164.  
  2165. Explorer.InitRightClick()
  2166. Explorer.InitInsertObject()
  2167. Explorer.SetSortingEnabled(Settings.Explorer.Sorting)
  2168. Explorer.Expanded = setmetatable({},{__mode = "k"})
  2169. Explorer.SearchExpanded = setmetatable({},{__mode = "k"})
  2170. expanded = Explorer.Expanded
  2171.  
  2172. nilNode.Obj.Name = "Nil Instances"
  2173. nilNode.Locked = true
  2174.  
  2175. local explorerItems = create({
  2176. {1,"Folder",{Name="ExplorerItems",}},
  2177. {2,"Frame",{BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),BorderSizePixel=0,Name="ToolBar",Parent={1},Size=UDim2.new(1,0,0,22),}},
  2178. {3,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.1176470592618,0.1176470592618,0.1176470592618),BorderSizePixel=0,Name="SearchFrame",Parent={2},Position=UDim2.new(0,3,0,1),Size=UDim2.new(1,-6,0,18),}},
  2179. {4,"TextBox",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,ClearTextOnFocus=false,Font=3,Name="SearchBox",Parent={3},PlaceholderColor3=Color3.new(0.39215689897537,0.39215689897537,0.39215689897537),PlaceholderText="Search workspace",Position=UDim2.new(0,4,0,0),Size=UDim2.new(1,-24,0,18),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,TextXAlignment=0,}},
  2180. {5,"UICorner",{CornerRadius=UDim.new(0,2),Parent={3},}},
  2181. {6,"UIStroke",{Thickness=1.4,Parent={3},Color=Color3.fromRGB(42,42,42)}},
  2182. {7,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Reset",Parent={3},Position=UDim2.new(1,-17,0,1),Size=UDim2.new(0,16,0,16),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,}},
  2183. {8,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://5034718129",ImageColor3=Color3.new(0.39215686917305,0.39215686917305,0.39215686917305),Parent={7},Size=UDim2.new(0,16,0,16),}},
  2184. {9,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Refresh",Parent={2},Position=UDim2.new(1,-20,0,1),Size=UDim2.new(0,18,0,18),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,Visible=false,}},
  2185. {10,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://5642310344",Parent={9},Position=UDim2.new(0,3,0,3),Size=UDim2.new(0,12,0,12),}},
  2186. {11,"Frame",{BackgroundColor3=Color3.new(0.15686275064945,0.15686275064945,0.15686275064945),BorderSizePixel=0,Name="ScrollCorner",Parent={1},Position=UDim2.new(1,-16,1,-16),Size=UDim2.new(0,16,0,16),Visible=false,}},
  2187. {12,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,ClipsDescendants=true,Name="List",Parent={1},Position=UDim2.new(0,0,0,23),Size=UDim2.new(1,0,1,-23),}}
  2188. })
  2189.  
  2190. toolBar = explorerItems.ToolBar
  2191. treeFrame = explorerItems.List
  2192.  
  2193. Explorer.GuiElems.ToolBar = toolBar
  2194. Explorer.GuiElems.TreeFrame = treeFrame
  2195.  
  2196. scrollV = Lib.ScrollBar.new()
  2197. scrollV.WheelIncrement = 3
  2198. scrollV.Gui.Position = UDim2.new(1,-16,0,23)
  2199. scrollV:SetScrollFrame(treeFrame)
  2200. scrollV.Scrolled:Connect(function()
  2201. Explorer.Index = scrollV.Index
  2202. Explorer.Refresh()
  2203. end)
  2204.  
  2205. scrollH = Lib.ScrollBar.new(true)
  2206. scrollH.Increment = 5
  2207. scrollH.WheelIncrement = Explorer.EntryIndent
  2208. scrollH.Gui.Position = UDim2.new(0,0,1,-16)
  2209. scrollH.Scrolled:Connect(function()
  2210. Explorer.Refresh()
  2211. end)
  2212.  
  2213. local window = Lib.Window.new()
  2214. Explorer.Window = window
  2215. window:SetTitle("Explorer")
  2216. window.GuiElems.Line.Position = UDim2.new(0,0,0,22)
  2217.  
  2218. Explorer.InitEntryTemplate()
  2219. toolBar.Parent = window.GuiElems.Content
  2220. treeFrame.Parent = window.GuiElems.Content
  2221. explorerItems.ScrollCorner.Parent = window.GuiElems.Content
  2222. scrollV.Gui.Parent = window.GuiElems.Content
  2223. scrollH.Gui.Parent = window.GuiElems.Content
  2224.  
  2225. -- Init stuff that requires the window
  2226. Explorer.InitRenameBox()
  2227. Explorer.InitSearch()
  2228. Explorer.InitDelCleaner()
  2229. selection.Changed:Connect(Explorer.UpdateSelectionVisuals)
  2230.  
  2231. -- Window events
  2232. window.GuiElems.Main:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
  2233. if Explorer.Active then
  2234. Explorer.UpdateView()
  2235. Explorer.Refresh()
  2236. end
  2237. end)
  2238. window.OnActivate:Connect(function()
  2239. Explorer.Active = true
  2240. Explorer.UpdateView()
  2241. Explorer.Update()
  2242. Explorer.Refresh()
  2243. end)
  2244. window.OnRestore:Connect(function()
  2245. Explorer.Active = true
  2246. Explorer.UpdateView()
  2247. Explorer.Update()
  2248. Explorer.Refresh()
  2249. end)
  2250. window.OnDeactivate:Connect(function() Explorer.Active = false end)
  2251. window.OnMinimize:Connect(function() Explorer.Active = false end)
  2252.  
  2253. -- Settings
  2254. autoUpdateSearch = Settings.Explorer.AutoUpdateSearch
  2255.  
  2256. -- Fill in nodes
  2257. nodes[game] = {Obj = game}
  2258. expanded[nodes[game]] = true
  2259.  
  2260. -- Nil Instances
  2261. if env.getnilinstances then
  2262. nodes[nilNode.Obj] = nilNode
  2263. end
  2264.  
  2265. Explorer.SetupConnections()
  2266.  
  2267. local insts = getDescendants(game)
  2268. if Main.Elevated then
  2269. for i = 1,#insts do
  2270. local obj = insts[i]
  2271. local par = nodes[ffa(obj,"Instance")]
  2272. if not par then continue end
  2273. local newNode = {
  2274. Obj = obj,
  2275. Parent = par,
  2276. }
  2277. nodes[obj] = newNode
  2278. par[#par+1] = newNode
  2279. end
  2280. else
  2281. for i = 1,#insts do
  2282. local obj = insts[i]
  2283. local s,parObj = pcall(ffa,obj,"Instance")
  2284. local par = nodes[parObj]
  2285. if not par then continue end
  2286. local newNode = {
  2287. Obj = obj,
  2288. Parent = par,
  2289. }
  2290. nodes[obj] = newNode
  2291. par[#par+1] = newNode
  2292. end
  2293. end
  2294. end
  2295.  
  2296. return Explorer
  2297. end
  2298.  
  2299. return {InitDeps = initDeps, InitAfterMain = initAfterMain, Main = main}
  2300. end,
  2301. Properties = function()
  2302. --[[
  2303. Properties App Module
  2304.  
  2305. The main properties interface
  2306. ]]
  2307.  
  2308. -- Common Locals
  2309. local Main,Lib,Apps,Settings -- Main Containers
  2310. local Explorer, Properties, ScriptViewer, Notebook -- Major Apps
  2311. local API,RMD,env,service,plr,create,createSimple -- Main Locals
  2312.  
  2313. local function initDeps(data)
  2314. Main = data.Main
  2315. Lib = data.Lib
  2316. Apps = data.Apps
  2317. Settings = data.Settings
  2318.  
  2319. API = data.API
  2320. RMD = data.RMD
  2321. env = data.env
  2322. service = data.service
  2323. plr = data.plr
  2324. create = data.create
  2325. createSimple = data.createSimple
  2326. end
  2327.  
  2328. local function initAfterMain()
  2329. Explorer = Apps.Explorer
  2330. Properties = Apps.Properties
  2331. ScriptViewer = Apps.ScriptViewer
  2332. Notebook = Apps.Notebook
  2333. end
  2334.  
  2335. local function main()
  2336. local Properties = {}
  2337.  
  2338. local window, toolBar, propsFrame
  2339. local scrollV, scrollH
  2340. local categoryOrder
  2341. local props,viewList,expanded,indexableProps,propEntries,autoUpdateObjs = {},{},{},{},{},{}
  2342. local inputBox,inputTextBox,inputProp
  2343. local checkboxes,propCons = {},{}
  2344. local table,string = table,string
  2345. local getPropChangedSignal = game.GetPropertyChangedSignal
  2346. local getAttributeChangedSignal = game.GetAttributeChangedSignal
  2347. local isa = game.IsA
  2348. local getAttribute = game.GetAttribute
  2349. local setAttribute = game.SetAttribute
  2350.  
  2351. Properties.GuiElems = {}
  2352. Properties.Index = 0
  2353. Properties.ViewWidth = 0
  2354. Properties.MinInputWidth = 100
  2355. Properties.EntryIndent = 16
  2356. Properties.EntryOffset = 4
  2357. Properties.NameWidthCache = {}
  2358. Properties.SubPropCache = {}
  2359. Properties.ClassLists = {}
  2360. Properties.SearchText = ""
  2361.  
  2362. Properties.AddAttributeProp = {Category = "Attributes", Class = "", Name = "", SpecialRow = "AddAttribute", Tags = {}}
  2363. Properties.SoundPreviewProp = {Category = "Data", ValueType = {Name = "SoundPlayer"}, Class = "Sound", Name = "Preview", Tags = {}}
  2364.  
  2365. Properties.IgnoreProps = {
  2366. ["DataModel"] = {
  2367. ["PrivateServerId"] = true,
  2368. ["PrivateServerOwnerId"] = true,
  2369. ["VIPServerId"] = true,
  2370. ["VIPServerOwnerId"] = true
  2371. }
  2372. }
  2373.  
  2374. Properties.ExpandableTypes = {
  2375. ["Vector2"] = true,
  2376. ["Vector3"] = true,
  2377. ["UDim"] = true,
  2378. ["UDim2"] = true,
  2379. ["CFrame"] = true,
  2380. ["Rect"] = true,
  2381. ["PhysicalProperties"] = true,
  2382. ["Ray"] = true,
  2383. ["NumberRange"] = true,
  2384. ["Faces"] = true,
  2385. ["Axes"] = true
  2386. }
  2387.  
  2388. Properties.ExpandableProps = {
  2389. ["Sound.SoundId"] = true
  2390. }
  2391.  
  2392. Properties.CollapsedCategories = {
  2393. ["Surface Inputs"] = true,
  2394. ["Surface"] = true
  2395. }
  2396.  
  2397. Properties.ConflictSubProps = {
  2398. ["Vector2"] = {"X","Y"},
  2399. ["Vector3"] = {"X","Y","Z"},
  2400. ["UDim"] = {"Scale","Offset"},
  2401. ["UDim2"] = {"X","X.Scale","X.Offset","Y","Y.Scale","Y.Offset"},
  2402. ["CFrame"] = {"Position","Position.X","Position.Y","Position.Z",
  2403. "RightVector","RightVector.X","RightVector.Y","RightVector.Z",
  2404. "UpVector","UpVector.X","UpVector.Y","UpVector.Z",
  2405. "LookVector","LookVector.X","LookVector.Y","LookVector.Z"},
  2406. ["Rect"] = {"Min.X","Min.Y","Max.X","Max.Y"},
  2407. ["PhysicalProperties"] = {"Density","Elasticity","ElasticityWeight","Friction","FrictionWeight"},
  2408. ["Ray"] = {"Origin","Origin.X","Origin.Y","Origin.Z","Direction","Direction.X","Direction.Y","Direction.Z"},
  2409. ["NumberRange"] = {"Min","Max"},
  2410. ["Faces"] = {"Back","Bottom","Front","Left","Right","Top"},
  2411. ["Axes"] = {"X","Y","Z"}
  2412. }
  2413.  
  2414. Properties.ConflictIgnore = {
  2415. ["BasePart"] = {
  2416. ["ResizableFaces"] = true
  2417. }
  2418. }
  2419.  
  2420. Properties.RoundableTypes = {
  2421. ["float"] = true,
  2422. ["double"] = true,
  2423. ["Color3"] = true,
  2424. ["UDim"] = true,
  2425. ["UDim2"] = true,
  2426. ["Vector2"] = true,
  2427. ["Vector3"] = true,
  2428. ["NumberRange"] = true,
  2429. ["Rect"] = true,
  2430. ["NumberSequence"] = true,
  2431. ["ColorSequence"] = true,
  2432. ["Ray"] = true,
  2433. ["CFrame"] = true
  2434. }
  2435.  
  2436. Properties.TypeNameConvert = {
  2437. ["number"] = "double",
  2438. ["boolean"] = "bool"
  2439. }
  2440.  
  2441. Properties.ToNumberTypes = {
  2442. ["int"] = true,
  2443. ["int64"] = true,
  2444. ["float"] = true,
  2445. ["double"] = true
  2446. }
  2447.  
  2448. Properties.DefaultPropValue = {
  2449. string = "",
  2450. bool = false,
  2451. double = 0,
  2452. UDim = UDim.new(0,0),
  2453. UDim2 = UDim2.new(0,0,0,0),
  2454. BrickColor = BrickColor.new("Medium stone grey"),
  2455. Color3 = Color3.new(1,1,1),
  2456. Vector2 = Vector2.new(0,0),
  2457. Vector3 = Vector3.new(0,0,0),
  2458. NumberSequence = NumberSequence.new(1),
  2459. ColorSequence = ColorSequence.new(Color3.new(1,1,1)),
  2460. NumberRange = NumberRange.new(0),
  2461. Rect = Rect.new(0,0,0,0)
  2462. }
  2463.  
  2464. Properties.AllowedAttributeTypes = {"string","boolean","number","UDim","UDim2","BrickColor","Color3","Vector2","Vector3","NumberSequence","ColorSequence","NumberRange","Rect"}
  2465.  
  2466. Properties.StringToValue = function(prop,str)
  2467. local typeData = prop.ValueType
  2468. local typeName = typeData.Name
  2469.  
  2470. if typeName == "string" or typeName == "Content" then
  2471. return str
  2472. elseif Properties.ToNumberTypes[typeName] then
  2473. return tonumber(str)
  2474. elseif typeName == "Vector2" then
  2475. local vals = str:split(",")
  2476. local x,y = tonumber(vals[1]),tonumber(vals[2])
  2477. if x and y and #vals >= 2 then return Vector2.new(x,y) end
  2478. elseif typeName == "Vector3" then
  2479. local vals = str:split(",")
  2480. local x,y,z = tonumber(vals[1]),tonumber(vals[2]),tonumber(vals[3])
  2481. if x and y and z and #vals >= 3 then return Vector3.new(x,y,z) end
  2482. elseif typeName == "UDim" then
  2483. local vals = str:split(",")
  2484. local scale,offset = tonumber(vals[1]),tonumber(vals[2])
  2485. if scale and offset and #vals >= 2 then return UDim.new(scale,offset) end
  2486. elseif typeName == "UDim2" then
  2487. local vals = str:gsub("[{}]",""):split(",")
  2488. local xScale,xOffset,yScale,yOffset = tonumber(vals[1]),tonumber(vals[2]),tonumber(vals[3]),tonumber(vals[4])
  2489. if xScale and xOffset and yScale and yOffset and #vals >= 4 then return UDim2.new(xScale,xOffset,yScale,yOffset) end
  2490. elseif typeName == "CFrame" then
  2491. local vals = str:split(",")
  2492. local s,result = pcall(CFrame.new, unpack(vals))
  2493. if s and #vals >= 12 then return result end
  2494. elseif typeName == "Rect" then
  2495. local vals = str:split(",")
  2496. local s,result = pcall(Rect.new,unpack(vals))
  2497. if s and #vals >= 4 then return result end
  2498. elseif typeName == "Ray" then
  2499. local vals = str:gsub("[{}]",""):split(",")
  2500. local s,origin = pcall(Vector3.new,unpack(vals,1,3))
  2501. local s2,direction = pcall(Vector3.new,unpack(vals,4,6))
  2502. if s and s2 and #vals >= 6 then return Ray.new(origin,direction) end
  2503. elseif typeName == "NumberRange" then
  2504. local vals = str:split(",")
  2505. local s,result = pcall(NumberRange.new,unpack(vals))
  2506. if s and #vals >= 1 then return result end
  2507. elseif typeName == "Color3" then
  2508. local vals = str:gsub("[{}]",""):split(",")
  2509. local s,result = pcall(Color3.fromRGB,unpack(vals))
  2510. if s and #vals >= 3 then return result end
  2511. end
  2512.  
  2513. return nil
  2514. end
  2515.  
  2516. Properties.ValueToString = function(prop,val)
  2517. local typeData = prop.ValueType
  2518. local typeName = typeData.Name
  2519.  
  2520. if typeName == "Color3" then
  2521. return Lib.ColorToBytes(val)
  2522. elseif typeName == "NumberRange" then
  2523. return val.Min..", "..val.Max
  2524. end
  2525.  
  2526. return tostring(val)
  2527. end
  2528.  
  2529. Properties.GetIndexableProps = function(obj,classData)
  2530. if not Main.Elevated then
  2531. if not pcall(function() return obj.ClassName end) then return nil end
  2532. end
  2533.  
  2534. local ignoreProps = Properties.IgnoreProps[classData.Name] or {}
  2535.  
  2536. local result = {}
  2537. local count = 1
  2538. local props = classData.Properties
  2539. for i = 1,#props do
  2540. local prop = props[i]
  2541. if not ignoreProps[prop.Name] then
  2542. local s = pcall(function() return obj[prop.Name] end)
  2543. if s then
  2544. result[count] = prop
  2545. count = count + 1
  2546. end
  2547. end
  2548. end
  2549.  
  2550. return result
  2551. end
  2552.  
  2553. Properties.FindFirstObjWhichIsA = function(class)
  2554. local classList = Properties.ClassLists[class] or {}
  2555. if classList and #classList > 0 then
  2556. return classList[1]
  2557. end
  2558.  
  2559. return nil
  2560. end
  2561.  
  2562. Properties.ComputeConflicts = function(p)
  2563. local maxConflictCheck = Settings.Properties.MaxConflictCheck
  2564. local sList = Explorer.Selection.List
  2565. local classLists = Properties.ClassLists
  2566. local stringSplit = string.split
  2567. local t_clear = table.clear
  2568. local conflictIgnore = Properties.ConflictIgnore
  2569. local conflictMap = {}
  2570. local propList = p and {p} or props
  2571.  
  2572. if p then
  2573. local gName = p.Class.."."..p.Name
  2574. autoUpdateObjs[gName] = nil
  2575. local subProps = Properties.ConflictSubProps[p.ValueType.Name] or {}
  2576. for i = 1,#subProps do
  2577. autoUpdateObjs[gName.."."..subProps[i]] = nil
  2578. end
  2579. else
  2580. table.clear(autoUpdateObjs)
  2581. end
  2582.  
  2583. if #sList > 0 then
  2584. for i = 1,#propList do
  2585. local prop = propList[i]
  2586. local propName,propClass = prop.Name,prop.Class
  2587. local typeData = prop.RootType or prop.ValueType
  2588. local typeName = typeData.Name
  2589. local attributeName = prop.AttributeName
  2590. local gName = propClass.."."..propName
  2591.  
  2592. local checked = 0
  2593. local subProps = Properties.ConflictSubProps[typeName] or {}
  2594. local subPropCount = #subProps
  2595. local toCheck = subPropCount + 1
  2596. local conflictsFound = 0
  2597. local indexNames = {}
  2598. local ignored = conflictIgnore[propClass] and conflictIgnore[propClass][propName]
  2599. local truthyCheck = (typeName == "PhysicalProperties")
  2600. local isAttribute = prop.IsAttribute
  2601. local isMultiType = prop.MultiType
  2602.  
  2603. t_clear(conflictMap)
  2604.  
  2605. if not isMultiType then
  2606. local firstVal,firstObj,firstSet
  2607. local classList = classLists[prop.Class] or {}
  2608. for c = 1,#classList do
  2609. local obj = classList[c]
  2610. if not firstSet then
  2611. if isAttribute then
  2612. firstVal = getAttribute(obj,attributeName)
  2613. if firstVal ~= nil then
  2614. firstObj = obj
  2615. firstSet = true
  2616. end
  2617. else
  2618. firstVal = obj[propName]
  2619. firstObj = obj
  2620. firstSet = true
  2621. end
  2622. if ignored then break end
  2623. else
  2624. local propVal,skip
  2625. if isAttribute then
  2626. propVal = getAttribute(obj,attributeName)
  2627. if propVal == nil then skip = true end
  2628. else
  2629. propVal = obj[propName]
  2630. end
  2631.  
  2632. if not skip then
  2633. if not conflictMap[1] then
  2634. if truthyCheck then
  2635. if (firstVal and true or false) ~= (propVal and true or false) then
  2636. conflictMap[1] = true
  2637. conflictsFound = conflictsFound + 1
  2638. end
  2639. elseif firstVal ~= propVal then
  2640. conflictMap[1] = true
  2641. conflictsFound = conflictsFound + 1
  2642. end
  2643. end
  2644.  
  2645. if subPropCount > 0 then
  2646. for sPropInd = 1,subPropCount do
  2647. local indexes = indexNames[sPropInd]
  2648. if not indexes then indexes = stringSplit(subProps[sPropInd],".") indexNames[sPropInd] = indexes end
  2649.  
  2650. local firstValSub = firstVal
  2651. local propValSub = propVal
  2652.  
  2653. for j = 1,#indexes do
  2654. if not firstValSub or not propValSub then break end -- PhysicalProperties
  2655. local indexName = indexes[j]
  2656. firstValSub = firstValSub[indexName]
  2657. propValSub = propValSub[indexName]
  2658. end
  2659.  
  2660. local mapInd = sPropInd + 1
  2661. if not conflictMap[mapInd] and firstValSub ~= propValSub then
  2662. conflictMap[mapInd] = true
  2663. conflictsFound = conflictsFound + 1
  2664. end
  2665. end
  2666. end
  2667.  
  2668. if conflictsFound == toCheck then break end
  2669. end
  2670. end
  2671.  
  2672. checked = checked + 1
  2673. if checked == maxConflictCheck then break end
  2674. end
  2675.  
  2676. if not conflictMap[1] then autoUpdateObjs[gName] = firstObj end
  2677. for sPropInd = 1,subPropCount do
  2678. if not conflictMap[sPropInd+1] then
  2679. autoUpdateObjs[gName.."."..subProps[sPropInd]] = firstObj
  2680. end
  2681. end
  2682. end
  2683. end
  2684. end
  2685.  
  2686. if p then
  2687. Properties.Refresh()
  2688. end
  2689. end
  2690.  
  2691. -- Fetches the properties to be displayed based on the explorer selection
  2692. Settings.Properties.ShowAttributes = true -- im making it true anyway since its useful by default and people complain
  2693. Properties.ShowExplorerProps = function()
  2694. local maxConflictCheck = Settings.Properties.MaxConflictCheck
  2695. local sList = Explorer.Selection.List
  2696. local foundClasses = {}
  2697. local propCount = 1
  2698. local elevated = Main.Elevated
  2699. local showDeprecated,showHidden = Settings.Properties.ShowDeprecated,Settings.Properties.ShowHidden
  2700. local Classes = API.Classes
  2701. local classLists = {}
  2702. local lower = string.lower
  2703. local RMDCustomOrders = RMD.PropertyOrders
  2704. local getAttributes = game.GetAttributes
  2705. local maxAttrs = Settings.Properties.MaxAttributes
  2706. local showingAttrs = Settings.Properties.ShowAttributes
  2707. local foundAttrs = {}
  2708. local attrCount = 0
  2709. local typeof = typeof
  2710. local typeNameConvert = Properties.TypeNameConvert
  2711.  
  2712. table.clear(props)
  2713.  
  2714. for i = 1,#sList do
  2715. local node = sList[i]
  2716. local obj = node.Obj
  2717. local class = node.Class
  2718. if not class then class = obj.ClassName node.Class = class end
  2719.  
  2720. local apiClass = Classes[class]
  2721. while apiClass do
  2722. local APIClassName = apiClass.Name
  2723. if not foundClasses[APIClassName] then
  2724. local apiProps = indexableProps[APIClassName]
  2725. if not apiProps then apiProps = Properties.GetIndexableProps(obj,apiClass) indexableProps[APIClassName] = apiProps end
  2726.  
  2727. for i = 1,#apiProps do
  2728. local prop = apiProps[i]
  2729. local tags = prop.Tags
  2730. if (not tags.Deprecated or showDeprecated) and (not tags.Hidden or showHidden) then
  2731. props[propCount] = prop
  2732. propCount = propCount + 1
  2733. end
  2734. end
  2735. foundClasses[APIClassName] = true
  2736. end
  2737.  
  2738. local classList = classLists[APIClassName]
  2739. if not classList then classList = {} classLists[APIClassName] = classList end
  2740. classList[#classList+1] = obj
  2741.  
  2742. apiClass = apiClass.Superclass
  2743. end
  2744.  
  2745. if showingAttrs and attrCount < maxAttrs then
  2746. local attrs = getAttributes(obj)
  2747. for name,val in pairs(attrs) do
  2748. local typ = typeof(val)
  2749. if not foundAttrs[name] then
  2750. local category = (typ == "Instance" and "Class") or (typ == "EnumItem" and "Enum") or "Other"
  2751. local valType = {Name = typeNameConvert[typ] or typ, Category = category}
  2752. local attrProp = {IsAttribute = true, Name = "ATTR_"..name, AttributeName = name, DisplayName = name, Class = "Instance", ValueType = valType, Category = "Attributes", Tags = {}}
  2753. props[propCount] = attrProp
  2754. propCount = propCount + 1
  2755. attrCount = attrCount + 1
  2756. foundAttrs[name] = {typ,attrProp}
  2757. if attrCount == maxAttrs then break end
  2758. elseif foundAttrs[name][1] ~= typ then
  2759. foundAttrs[name][2].MultiType = true
  2760. foundAttrs[name][2].Tags.ReadOnly = true
  2761. foundAttrs[name][2].ValueType = {Name = "string"}
  2762. end
  2763. end
  2764. end
  2765. end
  2766.  
  2767. table.sort(props,function(a,b)
  2768. if a.Category ~= b.Category then
  2769. return (categoryOrder[a.Category] or 9999) < (categoryOrder[b.Category] or 9999)
  2770. else
  2771. local aOrder = (RMDCustomOrders[a.Class] and RMDCustomOrders[a.Class][a.Name]) or 9999999
  2772. local bOrder = (RMDCustomOrders[b.Class] and RMDCustomOrders[b.Class][b.Name]) or 9999999
  2773. if aOrder ~= bOrder then
  2774. return aOrder < bOrder
  2775. else
  2776. return lower(a.Name) < lower(b.Name)
  2777. end
  2778. end
  2779. end)
  2780.  
  2781. -- Find conflicts and get auto-update instances
  2782. Properties.ClassLists = classLists
  2783. Properties.ComputeConflicts()
  2784. --warn("CONFLICT",tick()-start)
  2785. if #props > 0 then
  2786. props[#props+1] = Properties.AddAttributeProp
  2787. end
  2788.  
  2789. Properties.Update()
  2790. Properties.Refresh()
  2791. end
  2792.  
  2793. Properties.UpdateView = function()
  2794. local maxEntries = math.ceil(propsFrame.AbsoluteSize.Y / 23)
  2795. local maxX = propsFrame.AbsoluteSize.X
  2796. local totalWidth = Properties.ViewWidth + Properties.MinInputWidth
  2797.  
  2798. scrollV.VisibleSpace = maxEntries
  2799. scrollV.TotalSpace = #viewList + 1
  2800. scrollH.VisibleSpace = maxX
  2801. scrollH.TotalSpace = totalWidth
  2802.  
  2803. scrollV.Gui.Visible = #viewList + 1 > maxEntries
  2804. scrollH.Gui.Visible = Settings.Properties.ScaleType == 0 and totalWidth > maxX
  2805.  
  2806. local oldSize = propsFrame.Size
  2807. propsFrame.Size = UDim2.new(1,(scrollV.Gui.Visible and -16 or 0),1,(scrollH.Gui.Visible and -39 or -23))
  2808. if oldSize ~= propsFrame.Size then
  2809. Properties.UpdateView()
  2810. else
  2811. scrollV:Update()
  2812. scrollH:Update()
  2813.  
  2814. if scrollV.Gui.Visible and scrollH.Gui.Visible then
  2815. scrollV.Gui.Size = UDim2.new(0,16,1,-39)
  2816. scrollH.Gui.Size = UDim2.new(1,-16,0,16)
  2817. Properties.Window.GuiElems.Content.ScrollCorner.Visible = true
  2818. else
  2819. scrollV.Gui.Size = UDim2.new(0,16,1,-23)
  2820. scrollH.Gui.Size = UDim2.new(1,0,0,16)
  2821. Properties.Window.GuiElems.Content.ScrollCorner.Visible = false
  2822. end
  2823.  
  2824. Properties.Index = scrollV.Index
  2825. end
  2826. end
  2827.  
  2828. Properties.MakeSubProp = function(prop,subName,valueType,displayName)
  2829. local subProp = {}
  2830. for i,v in pairs(prop) do
  2831. subProp[i] = v
  2832. end
  2833. subProp.RootType = subProp.RootType or subProp.ValueType
  2834. subProp.ValueType = valueType
  2835. subProp.SubName = subProp.SubName and (subProp.SubName..subName) or subName
  2836. subProp.DisplayName = displayName
  2837.  
  2838. return subProp
  2839. end
  2840.  
  2841. Properties.GetExpandedProps = function(prop) -- TODO: Optimize using table
  2842. local result = {}
  2843. local typeData = prop.ValueType
  2844. local typeName = typeData.Name
  2845. local makeSubProp = Properties.MakeSubProp
  2846.  
  2847. if typeName == "Vector2" then
  2848. result[1] = makeSubProp(prop,".X",{Name = "float"})
  2849. result[2] = makeSubProp(prop,".Y",{Name = "float"})
  2850. elseif typeName == "Vector3" then
  2851. result[1] = makeSubProp(prop,".X",{Name = "float"})
  2852. result[2] = makeSubProp(prop,".Y",{Name = "float"})
  2853. result[3] = makeSubProp(prop,".Z",{Name = "float"})
  2854. elseif typeName == "CFrame" then
  2855. result[1] = makeSubProp(prop,".Position",{Name = "Vector3"})
  2856. result[2] = makeSubProp(prop,".RightVector",{Name = "Vector3"})
  2857. result[3] = makeSubProp(prop,".UpVector",{Name = "Vector3"})
  2858. result[4] = makeSubProp(prop,".LookVector",{Name = "Vector3"})
  2859. elseif typeName == "UDim" then
  2860. result[1] = makeSubProp(prop,".Scale",{Name = "float"})
  2861. result[2] = makeSubProp(prop,".Offset",{Name = "int"})
  2862. elseif typeName == "UDim2" then
  2863. result[1] = makeSubProp(prop,".X",{Name = "UDim"})
  2864. result[2] = makeSubProp(prop,".Y",{Name = "UDim"})
  2865. elseif typeName == "Rect" then
  2866. result[1] = makeSubProp(prop,".Min.X",{Name = "float"},"X0")
  2867. result[2] = makeSubProp(prop,".Min.Y",{Name = "float"},"Y0")
  2868. result[3] = makeSubProp(prop,".Max.X",{Name = "float"},"X1")
  2869. result[4] = makeSubProp(prop,".Max.Y",{Name = "float"},"Y1")
  2870. elseif typeName == "PhysicalProperties" then
  2871. result[1] = makeSubProp(prop,".Density",{Name = "float"})
  2872. result[2] = makeSubProp(prop,".Elasticity",{Name = "float"})
  2873. result[3] = makeSubProp(prop,".ElasticityWeight",{Name = "float"})
  2874. result[4] = makeSubProp(prop,".Friction",{Name = "float"})
  2875. result[5] = makeSubProp(prop,".FrictionWeight",{Name = "float"})
  2876. elseif typeName == "Ray" then
  2877. result[1] = makeSubProp(prop,".Origin",{Name = "Vector3"})
  2878. result[2] = makeSubProp(prop,".Direction",{Name = "Vector3"})
  2879. elseif typeName == "NumberRange" then
  2880. result[1] = makeSubProp(prop,".Min",{Name = "float"})
  2881. result[2] = makeSubProp(prop,".Max",{Name = "float"})
  2882. elseif typeName == "Faces" then
  2883. result[1] = makeSubProp(prop,".Back",{Name = "bool"})
  2884. result[2] = makeSubProp(prop,".Bottom",{Name = "bool"})
  2885. result[3] = makeSubProp(prop,".Front",{Name = "bool"})
  2886. result[4] = makeSubProp(prop,".Left",{Name = "bool"})
  2887. result[5] = makeSubProp(prop,".Right",{Name = "bool"})
  2888. result[6] = makeSubProp(prop,".Top",{Name = "bool"})
  2889. elseif typeName == "Axes" then
  2890. result[1] = makeSubProp(prop,".X",{Name = "bool"})
  2891. result[2] = makeSubProp(prop,".Y",{Name = "bool"})
  2892. result[3] = makeSubProp(prop,".Z",{Name = "bool"})
  2893. end
  2894.  
  2895. if prop.Name == "SoundId" and prop.Class == "Sound" then
  2896. result[1] = Properties.SoundPreviewProp
  2897. end
  2898.  
  2899. return result
  2900. end
  2901.  
  2902. Properties.Update = function()
  2903. table.clear(viewList)
  2904.  
  2905. local nameWidthCache = Properties.NameWidthCache
  2906. local lastCategory
  2907. local count = 1
  2908. local maxWidth,maxDepth = 0,1
  2909.  
  2910. local textServ = service.TextService
  2911. local getTextSize = textServ.GetTextSize
  2912. local font = Enum.Font.SourceSans
  2913. local size = Vector2.new(math.huge,20)
  2914. local stringSplit = string.split
  2915. local entryIndent = Properties.EntryIndent
  2916. local isFirstScaleType = Settings.Properties.ScaleType == 0
  2917. local find,lower = string.find,string.lower
  2918. local searchText = (#Properties.SearchText > 0 and lower(Properties.SearchText))
  2919.  
  2920. local function recur(props,depth)
  2921. for i = 1,#props do
  2922. local prop = props[i]
  2923. local propName = prop.Name
  2924. local subName = prop.SubName
  2925. local category = prop.Category
  2926.  
  2927. local visible
  2928. if searchText and depth == 1 then
  2929. if find(lower(propName),searchText,1,true) then
  2930. visible = true
  2931. end
  2932. else
  2933. visible = true
  2934. end
  2935.  
  2936. if visible and lastCategory ~= category then
  2937. viewList[count] = {CategoryName = category}
  2938. count = count + 1
  2939. lastCategory = category
  2940. end
  2941.  
  2942. if (expanded["CAT_"..category] and visible) or prop.SpecialRow then
  2943. if depth > 1 then prop.Depth = depth if depth > maxDepth then maxDepth = depth end end
  2944.  
  2945. if isFirstScaleType then
  2946. local nameArr = subName and stringSplit(subName,".")
  2947. local displayName = prop.DisplayName or (nameArr and nameArr[#nameArr]) or propName
  2948.  
  2949. local nameWidth = nameWidthCache[displayName]
  2950. if not nameWidth then nameWidth = getTextSize(textServ,displayName,14,font,size).X nameWidthCache[displayName] = nameWidth end
  2951.  
  2952. local totalWidth = nameWidth + entryIndent*depth
  2953. if totalWidth > maxWidth then
  2954. maxWidth = totalWidth
  2955. end
  2956. end
  2957.  
  2958. viewList[count] = prop
  2959. count = count + 1
  2960.  
  2961. local fullName = prop.Class.."."..prop.Name..(prop.SubName or "")
  2962. if expanded[fullName] then
  2963. local nextDepth = depth+1
  2964. local expandedProps = Properties.GetExpandedProps(prop)
  2965. if #expandedProps > 0 then
  2966. recur(expandedProps,nextDepth)
  2967. end
  2968. end
  2969. end
  2970. end
  2971. end
  2972. recur(props,1)
  2973.  
  2974. inputProp = nil
  2975. Properties.ViewWidth = maxWidth + 9 + Properties.EntryOffset
  2976. Properties.UpdateView()
  2977. end
  2978.  
  2979. Properties.NewPropEntry = function(index)
  2980. local newEntry = Properties.EntryTemplate:Clone()
  2981. local nameFrame = newEntry.NameFrame
  2982. local valueFrame = newEntry.ValueFrame
  2983. local newCheckbox = Lib.Checkbox.new(1)
  2984. newCheckbox.Gui.Position = UDim2.new(0,3,0,3)
  2985. newCheckbox.Gui.Parent = valueFrame
  2986. newCheckbox.OnInput:Connect(function()
  2987. local prop = viewList[index + Properties.Index]
  2988. if not prop then return end
  2989.  
  2990. if prop.ValueType.Name == "PhysicalProperties" then
  2991. Properties.SetProp(prop,newCheckbox.Toggled and true or nil)
  2992. else
  2993. Properties.SetProp(prop,newCheckbox.Toggled)
  2994. end
  2995. end)
  2996. checkboxes[index] = newCheckbox
  2997.  
  2998. local iconFrame = Main.MiscIcons:GetLabel()
  2999. iconFrame.Position = UDim2.new(0,2,0,3)
  3000. iconFrame.Parent = newEntry.ValueFrame.RightButton
  3001.  
  3002. newEntry.Position = UDim2.new(0,0,0,23*(index-1))
  3003.  
  3004. nameFrame.Expand.InputBegan:Connect(function(input)
  3005. local prop = viewList[index + Properties.Index]
  3006. if not prop or (input.UserInputType ~= Enum.UserInputType.MouseMovement and input.UserInputType ~= Enum.UserInputType.Touch) then return end
  3007.  
  3008. local fullName = (prop.CategoryName and "CAT_"..prop.CategoryName) or prop.Class.."."..prop.Name..(prop.SubName or "")
  3009.  
  3010. Main.MiscIcons:DisplayByKey(newEntry.NameFrame.Expand.Icon, expanded[fullName] and "Collapse_Over" or "Expand_Over")
  3011. end)
  3012.  
  3013. nameFrame.Expand.InputEnded:Connect(function(input)
  3014. local prop = viewList[index + Properties.Index]
  3015. if not prop or (input.UserInputType ~= Enum.UserInputType.MouseMovement and input.UserInputType ~= Enum.UserInputType.Touch) then return end
  3016.  
  3017. local fullName = (prop.CategoryName and "CAT_"..prop.CategoryName) or prop.Class.."."..prop.Name..(prop.SubName or "")
  3018.  
  3019. Main.MiscIcons:DisplayByKey(newEntry.NameFrame.Expand.Icon, expanded[fullName] and "Collapse" or "Expand")
  3020. end)
  3021.  
  3022. nameFrame.Expand.MouseButton1Down:Connect(function()
  3023. local prop = viewList[index + Properties.Index]
  3024. if not prop then return end
  3025.  
  3026. local fullName = (prop.CategoryName and "CAT_"..prop.CategoryName) or prop.Class.."."..prop.Name..(prop.SubName or "")
  3027. if not prop.CategoryName and not Properties.ExpandableTypes[prop.ValueType and prop.ValueType.Name] and not Properties.ExpandableProps[fullName] then return end
  3028.  
  3029. expanded[fullName] = not expanded[fullName]
  3030. Properties.Update()
  3031. Properties.Refresh()
  3032. end)
  3033.  
  3034. nameFrame.PropName.InputBegan:Connect(function(input)
  3035. local prop = viewList[index + Properties.Index]
  3036. if not prop then return end
  3037. if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and not nameFrame.PropName.TextFits then
  3038. local fullNameFrame = Properties.FullNameFrame
  3039. local nameArr = string.split(prop.Class.."."..prop.Name..(prop.SubName or ""), ".")
  3040. local dispName = prop.DisplayName or nameArr[#nameArr]
  3041. local sizeX = service.TextService:GetTextSize(dispName, 14, Enum.Font.SourceSans, Vector2.new(math.huge, 20)).X
  3042.  
  3043. fullNameFrame.TextLabel.Text = dispName
  3044. fullNameFrame.Size = UDim2.new(0, sizeX + 4, 0, 22)
  3045. fullNameFrame.Visible = true
  3046. Properties.FullNameFrameIndex = index
  3047. Properties.FullNameFrameAttach.SetData(fullNameFrame, {Target = nameFrame})
  3048. Properties.FullNameFrameAttach.Enable()
  3049. end
  3050. end)
  3051.  
  3052. nameFrame.PropName.InputEnded:Connect(function(input)
  3053. if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and Properties.FullNameFrameIndex == index then
  3054. Properties.FullNameFrame.Visible = false
  3055. Properties.FullNameFrameAttach.Disable()
  3056. end
  3057. end)
  3058.  
  3059.  
  3060. valueFrame.ValueBox.MouseButton1Down:Connect(function()
  3061. local prop = viewList[index + Properties.Index]
  3062. if not prop then return end
  3063.  
  3064. Properties.SetInputProp(prop,index)
  3065. end)
  3066.  
  3067. valueFrame.ColorButton.MouseButton1Down:Connect(function()
  3068. local prop = viewList[index + Properties.Index]
  3069. if not prop then return end
  3070.  
  3071. Properties.SetInputProp(prop,index,"color")
  3072. end)
  3073.  
  3074. valueFrame.RightButton.MouseButton1Click:Connect(function()
  3075. local prop = viewList[index + Properties.Index]
  3076. if not prop then return end
  3077.  
  3078. local fullName = prop.Class.."."..prop.Name..(prop.SubName or "")
  3079. local inputFullName = inputProp and (inputProp.Class.."."..inputProp.Name..(inputProp.SubName or ""))
  3080.  
  3081. if fullName == inputFullName and inputProp.ValueType.Category == "Class" then
  3082. inputProp = nil
  3083. Properties.SetProp(prop,nil)
  3084. else
  3085. Properties.SetInputProp(prop,index,"right")
  3086. end
  3087. end)
  3088.  
  3089. nameFrame.ToggleAttributes.MouseButton1Click:Connect(function()
  3090. Settings.Properties.ShowAttributes = not Settings.Properties.ShowAttributes
  3091. Properties.ShowExplorerProps()
  3092. end)
  3093.  
  3094. newEntry.RowButton.MouseButton1Click:Connect(function()
  3095. Properties.DisplayAddAttributeWindow()
  3096. end)
  3097.  
  3098. newEntry.EditAttributeButton.MouseButton1Down:Connect(function()
  3099. local prop = viewList[index + Properties.Index]
  3100. if not prop then return end
  3101.  
  3102. Properties.DisplayAttributeContext(prop)
  3103. end)
  3104.  
  3105. valueFrame.SoundPreview.ControlButton.MouseButton1Click:Connect(function()
  3106. if Properties.PreviewSound and Properties.PreviewSound.Playing then
  3107. Properties.SetSoundPreview(false)
  3108. else
  3109. local soundObj = Properties.FindFirstObjWhichIsA("Sound")
  3110. if soundObj then Properties.SetSoundPreview(soundObj) end
  3111. end
  3112. end)
  3113.  
  3114. valueFrame.SoundPreview.InputBegan:Connect(function(input)
  3115. if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then return end
  3116.  
  3117. local releaseEvent, inputEvent
  3118. releaseEvent = service.UserInputService.InputEnded:Connect(function(input)
  3119. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  3120. releaseEvent:Disconnect()
  3121. if inputEvent then
  3122. inputEvent:Disconnect()
  3123. end
  3124. end
  3125. end)
  3126.  
  3127. local timeLine = newEntry.ValueFrame.SoundPreview.TimeLine
  3128. local soundObj = Properties.FindFirstObjWhichIsA("Sound")
  3129. if soundObj then Properties.SetSoundPreview(soundObj, true) end
  3130.  
  3131. local function update(input)
  3132. local sound = Properties.PreviewSound
  3133. if not sound or sound.TimeLength == 0 then return end
  3134.  
  3135. local inputX = (input.UserInputType == Enum.UserInputType.Touch) and input.Position.X or input.Position.X
  3136. local timeLineSize = timeLine.AbsoluteSize
  3137. local relaX = inputX - timeLine.AbsolutePosition.X
  3138.  
  3139. if timeLineSize.X <= 1 then return end
  3140. if relaX < 0 then relaX = 0 elseif relaX >= timeLineSize.X then relaX = timeLineSize.X - 1 end
  3141.  
  3142. local perc = (relaX / (timeLineSize.X - 1))
  3143. sound.TimePosition = perc * sound.TimeLength
  3144. timeLine.Slider.Position = UDim2.new(perc, -4, 0, -8)
  3145. end
  3146.  
  3147. update(input)
  3148.  
  3149. inputEvent = service.UserInputService.InputChanged:Connect(function(input)
  3150. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  3151. update(input)
  3152. end
  3153. end)
  3154. end)
  3155.  
  3156.  
  3157. newEntry.Parent = propsFrame
  3158.  
  3159. return {
  3160. Gui = newEntry,
  3161. GuiElems = {
  3162. NameFrame = nameFrame,
  3163. ValueFrame = valueFrame,
  3164. PropName = nameFrame.PropName,
  3165. ValueBox = valueFrame.ValueBox,
  3166. Expand = nameFrame.Expand,
  3167. ColorButton = valueFrame.ColorButton,
  3168. ColorPreview = valueFrame.ColorButton.ColorPreview,
  3169. Gradient = valueFrame.ColorButton.ColorPreview.UIGradient,
  3170. EnumArrow = valueFrame.EnumArrow,
  3171. Checkbox = valueFrame.Checkbox,
  3172. RightButton = valueFrame.RightButton,
  3173. RightButtonIcon = iconFrame,
  3174. RowButton = newEntry.RowButton,
  3175. EditAttributeButton = newEntry.EditAttributeButton,
  3176. ToggleAttributes = nameFrame.ToggleAttributes,
  3177. SoundPreview = valueFrame.SoundPreview,
  3178. SoundPreviewSlider = valueFrame.SoundPreview.TimeLine.Slider
  3179. }
  3180. }
  3181. end
  3182.  
  3183. Properties.GetSoundPreviewEntry = function()
  3184. for i = 1,#viewList do
  3185. if viewList[i] == Properties.SoundPreviewProp then
  3186. return propEntries[i - Properties.Index]
  3187. end
  3188. end
  3189. end
  3190.  
  3191. Properties.SetSoundPreview = function(soundObj,noplay)
  3192. local sound = Properties.PreviewSound
  3193. if not sound then
  3194. sound = Instance.new("Sound")
  3195. sound.Name = "Preview"
  3196. sound.Paused:Connect(function()
  3197. local entry = Properties.GetSoundPreviewEntry()
  3198. if entry then Main.MiscIcons:DisplayByKey(entry.GuiElems.SoundPreview.ControlButton.Icon, "Play") end
  3199. end)
  3200. sound.Resumed:Connect(function() Properties.Refresh() end)
  3201. sound.Ended:Connect(function()
  3202. local entry = Properties.GetSoundPreviewEntry()
  3203. if entry then entry.GuiElems.SoundPreviewSlider.Position = UDim2.new(0,-4,0,-8) end
  3204. Properties.Refresh()
  3205. end)
  3206. sound.Parent = window.Gui
  3207. Properties.PreviewSound = sound
  3208. end
  3209.  
  3210. if not soundObj then
  3211. sound:Pause()
  3212. else
  3213. local newId = sound.SoundId ~= soundObj.SoundId
  3214. sound.SoundId = soundObj.SoundId
  3215. sound.PlaybackSpeed = soundObj.PlaybackSpeed
  3216. sound.Volume = soundObj.Volume
  3217. if newId then sound.TimePosition = 0 end
  3218. if not noplay then sound:Resume() end
  3219.  
  3220. coroutine.wrap(function()
  3221. local previewTime = tick()
  3222. Properties.SoundPreviewTime = previewTime
  3223. while previewTime == Properties.SoundPreviewTime and sound.Playing do
  3224. local entry = Properties.GetSoundPreviewEntry()
  3225. if entry then
  3226. local tl = sound.TimeLength
  3227. local perc = sound.TimePosition/(tl == 0 and 1 or tl)
  3228. entry.GuiElems.SoundPreviewSlider.Position = UDim2.new(perc,-4,0,-8)
  3229. end
  3230. Lib.FastWait()
  3231. end
  3232. end)()
  3233. Properties.Refresh()
  3234. end
  3235. end
  3236.  
  3237. Properties.DisplayAttributeContext = function(prop)
  3238. local context = Properties.AttributeContext
  3239. if not context then
  3240. context = Lib.ContextMenu.new()
  3241. context.Iconless = true
  3242. context.Width = 80
  3243. end
  3244. context:Clear()
  3245.  
  3246. context:Add({Name = "Edit", OnClick = function()
  3247. Properties.DisplayAddAttributeWindow(prop)
  3248. end})
  3249. context:Add({Name = "Delete", OnClick = function()
  3250. Properties.SetProp(prop,nil,true)
  3251. Properties.ShowExplorerProps()
  3252. end})
  3253.  
  3254. context:Show()
  3255. end
  3256.  
  3257. Properties.DisplayAddAttributeWindow = function(editAttr)
  3258. local win = Properties.AddAttributeWindow
  3259. if not win then
  3260. win = Lib.Window.new()
  3261. win.Alignable = false
  3262. win.Resizable = false
  3263. win:SetTitle("Add Attribute")
  3264. win:SetSize(200,130)
  3265.  
  3266. local saveButton = Lib.Button.new()
  3267. local nameLabel = Lib.Label.new()
  3268. nameLabel.Text = "Name"
  3269. nameLabel.Position = UDim2.new(0,30,0,10)
  3270. nameLabel.Size = UDim2.new(0,40,0,20)
  3271. win:Add(nameLabel)
  3272.  
  3273. local nameBox = Lib.ViewportTextBox.new()
  3274. nameBox.Position = UDim2.new(0,75,0,10)
  3275. nameBox.Size = UDim2.new(0,120,0,20)
  3276. win:Add(nameBox,"NameBox")
  3277. nameBox.TextBox:GetPropertyChangedSignal("Text"):Connect(function()
  3278. saveButton:SetDisabled(#nameBox:GetText() == 0)
  3279. end)
  3280.  
  3281. local typeLabel = Lib.Label.new()
  3282. typeLabel.Text = "Type"
  3283. typeLabel.Position = UDim2.new(0,30,0,40)
  3284. typeLabel.Size = UDim2.new(0,40,0,20)
  3285. win:Add(typeLabel)
  3286.  
  3287. local typeChooser = Lib.DropDown.new()
  3288. typeChooser.CanBeEmpty = false
  3289. typeChooser.Position = UDim2.new(0,75,0,40)
  3290. typeChooser.Size = UDim2.new(0,120,0,20)
  3291. typeChooser:SetOptions(Properties.AllowedAttributeTypes)
  3292. win:Add(typeChooser,"TypeChooser")
  3293.  
  3294. local errorLabel = Lib.Label.new()
  3295. errorLabel.Text = ""
  3296. errorLabel.Position = UDim2.new(0,5,1,-45)
  3297. errorLabel.Size = UDim2.new(1,-10,0,20)
  3298. errorLabel.TextColor3 = Settings.Theme.Important
  3299. win.ErrorLabel = errorLabel
  3300. win:Add(errorLabel,"Error")
  3301.  
  3302. local cancelButton = Lib.Button.new()
  3303. cancelButton.Text = "Cancel"
  3304. cancelButton.Position = UDim2.new(1,-97,1,-25)
  3305. cancelButton.Size = UDim2.new(0,92,0,20)
  3306. cancelButton.OnClick:Connect(function()
  3307. win:Close()
  3308. end)
  3309. win:Add(cancelButton)
  3310.  
  3311. saveButton.Text = "Save"
  3312. saveButton.Position = UDim2.new(0,5,1,-25)
  3313. saveButton.Size = UDim2.new(0,92,0,20)
  3314. saveButton.OnClick:Connect(function()
  3315. local name = nameBox:GetText()
  3316. if #name > 100 then
  3317. errorLabel.Text = "Error: Name over 100 chars"
  3318. return
  3319. elseif name:sub(1,3) == "RBX" then
  3320. errorLabel.Text = "Error: Name begins with 'RBX'"
  3321. return
  3322. end
  3323.  
  3324. local typ = typeChooser.Selected
  3325. local valType = {Name = Properties.TypeNameConvert[typ] or typ, Category = "DataType"}
  3326. local attrProp = {IsAttribute = true, Name = "ATTR_"..name, AttributeName = name, DisplayName = name, Class = "Instance", ValueType = valType, Category = "Attributes", Tags = {}}
  3327.  
  3328. Settings.Properties.ShowAttributes = true
  3329. Properties.SetProp(attrProp,Properties.DefaultPropValue[valType.Name],true,Properties.EditingAttribute)
  3330. Properties.ShowExplorerProps()
  3331. win:Close()
  3332. end)
  3333. win:Add(saveButton,"SaveButton")
  3334.  
  3335. Properties.AddAttributeWindow = win
  3336. end
  3337.  
  3338. Properties.EditingAttribute = editAttr
  3339. win:SetTitle(editAttr and "Edit Attribute "..editAttr.AttributeName or "Add Attribute")
  3340. win.Elements.Error.Text = ""
  3341. win.Elements.NameBox:SetText("")
  3342. win.Elements.SaveButton:SetDisabled(true)
  3343. win.Elements.TypeChooser:SetSelected(1)
  3344. win:Show()
  3345. end
  3346.  
  3347. Properties.IsTextEditable = function(prop)
  3348. local typeData = prop.ValueType
  3349. local typeName = typeData.Name
  3350.  
  3351. return typeName ~= "bool" and typeData.Category ~= "Enum" and typeData.Category ~= "Class" and typeName ~= "BrickColor"
  3352. end
  3353.  
  3354. Properties.DisplayEnumDropdown = function(entryIndex)
  3355. local context = Properties.EnumContext
  3356. if not context then
  3357. context = Lib.ContextMenu.new()
  3358. context.Iconless = true
  3359. context.MaxHeight = 200
  3360. context.ReverseYOffset = 22
  3361. Properties.EnumDropdown = context
  3362. end
  3363.  
  3364. if not inputProp or inputProp.ValueType.Category ~= "Enum" then return end
  3365. local prop = inputProp
  3366.  
  3367. local entry = propEntries[entryIndex]
  3368. local valueFrame = entry.GuiElems.ValueFrame
  3369.  
  3370. local enum = Enum[prop.ValueType.Name]
  3371. if not enum then return end
  3372.  
  3373. local sorted = {}
  3374. for name,enum in next,enum:GetEnumItems() do
  3375. sorted[#sorted+1] = enum
  3376. end
  3377. table.sort(sorted,function(a,b) return a.Name < b.Name end)
  3378.  
  3379. context:Clear()
  3380.  
  3381. local function onClick(name)
  3382. if prop ~= inputProp then return end
  3383.  
  3384. local enumItem = enum[name]
  3385. inputProp = nil
  3386. Properties.SetProp(prop,enumItem)
  3387. end
  3388.  
  3389. for i = 1,#sorted do
  3390. local enumItem = sorted[i]
  3391. context:Add({Name = enumItem.Name, OnClick = onClick})
  3392. end
  3393.  
  3394. context.Width = valueFrame.AbsoluteSize.X
  3395. context:Show(valueFrame.AbsolutePosition.X, valueFrame.AbsolutePosition.Y + 22)
  3396. end
  3397.  
  3398. Properties.DisplayBrickColorEditor = function(prop,entryIndex,col)
  3399. local editor = Properties.BrickColorEditor
  3400. if not editor then
  3401. editor = Lib.BrickColorPicker.new()
  3402. editor.Gui.DisplayOrder = Main.DisplayOrders.Menu
  3403. editor.ReverseYOffset = 22
  3404.  
  3405. editor.OnSelect:Connect(function(col)
  3406. if not editor.CurrentProp or editor.CurrentProp.ValueType.Name ~= "BrickColor" then return end
  3407.  
  3408. if editor.CurrentProp == inputProp then inputProp = nil end
  3409. Properties.SetProp(editor.CurrentProp,BrickColor.new(col))
  3410. end)
  3411.  
  3412. editor.OnMoreColors:Connect(function() -- TODO: Special Case BasePart.BrickColor to BasePart.Color
  3413. editor:Close()
  3414. local colProp
  3415. for i,v in pairs(API.Classes.BasePart.Properties) do
  3416. if v.Name == "Color" then
  3417. colProp = v
  3418. break
  3419. end
  3420. end
  3421. Properties.DisplayColorEditor(colProp,editor.SavedColor.Color)
  3422. end)
  3423.  
  3424. Properties.BrickColorEditor = editor
  3425. end
  3426.  
  3427. local entry = propEntries[entryIndex]
  3428. local valueFrame = entry.GuiElems.ValueFrame
  3429.  
  3430. editor.CurrentProp = prop
  3431. editor.SavedColor = col
  3432. if prop and prop.Class == "BasePart" and prop.Name == "BrickColor" then
  3433. editor:SetMoreColorsVisible(true)
  3434. else
  3435. editor:SetMoreColorsVisible(false)
  3436. end
  3437. editor:Show(valueFrame.AbsolutePosition.X, valueFrame.AbsolutePosition.Y + 22)
  3438. end
  3439.  
  3440. Properties.DisplayColorEditor = function(prop,col)
  3441. local editor = Properties.ColorEditor
  3442. if not editor then
  3443. editor = Lib.ColorPicker.new()
  3444.  
  3445. editor.OnSelect:Connect(function(col)
  3446. if not editor.CurrentProp then return end
  3447. local typeName = editor.CurrentProp.ValueType.Name
  3448. if typeName ~= "Color3" and typeName ~= "BrickColor" then return end
  3449.  
  3450. local colVal = (typeName == "Color3" and col or BrickColor.new(col))
  3451.  
  3452. if editor.CurrentProp == inputProp then inputProp = nil end
  3453. Properties.SetProp(editor.CurrentProp,colVal)
  3454. end)
  3455.  
  3456. Properties.ColorEditor = editor
  3457. end
  3458.  
  3459. editor.CurrentProp = prop
  3460. if col then
  3461. editor:SetColor(col)
  3462. else
  3463. local firstVal = Properties.GetFirstPropVal(prop)
  3464. if firstVal then editor:SetColor(firstVal) end
  3465. end
  3466. editor:Show()
  3467. end
  3468.  
  3469. Properties.DisplayNumberSequenceEditor = function(prop,seq)
  3470. local editor = Properties.NumberSequenceEditor
  3471. if not editor then
  3472. editor = Lib.NumberSequenceEditor.new()
  3473.  
  3474. editor.OnSelect:Connect(function(val)
  3475. if not editor.CurrentProp or editor.CurrentProp.ValueType.Name ~= "NumberSequence" then return end
  3476.  
  3477. if editor.CurrentProp == inputProp then inputProp = nil end
  3478. Properties.SetProp(editor.CurrentProp,val)
  3479. end)
  3480.  
  3481. Properties.NumberSequenceEditor = editor
  3482. end
  3483.  
  3484. editor.CurrentProp = prop
  3485. if seq then
  3486. editor:SetSequence(seq)
  3487. else
  3488. local firstVal = Properties.GetFirstPropVal(prop)
  3489. if firstVal then editor:SetSequence(firstVal) end
  3490. end
  3491. editor:Show()
  3492. end
  3493.  
  3494. Properties.DisplayColorSequenceEditor = function(prop,seq)
  3495. local editor = Properties.ColorSequenceEditor
  3496. if not editor then
  3497. editor = Lib.ColorSequenceEditor.new()
  3498.  
  3499. editor.OnSelect:Connect(function(val)
  3500. if not editor.CurrentProp or editor.CurrentProp.ValueType.Name ~= "ColorSequence" then return end
  3501.  
  3502. if editor.CurrentProp == inputProp then inputProp = nil end
  3503. Properties.SetProp(editor.CurrentProp,val)
  3504. end)
  3505.  
  3506. Properties.ColorSequenceEditor = editor
  3507. end
  3508.  
  3509. editor.CurrentProp = prop
  3510. if seq then
  3511. editor:SetSequence(seq)
  3512. else
  3513. local firstVal = Properties.GetFirstPropVal(prop)
  3514. if firstVal then editor:SetSequence(firstVal) end
  3515. end
  3516. editor:Show()
  3517. end
  3518.  
  3519. Properties.GetFirstPropVal = function(prop)
  3520. local first = Properties.FindFirstObjWhichIsA(prop.Class)
  3521. if first then
  3522. return Properties.GetPropVal(prop,first)
  3523. end
  3524. end
  3525.  
  3526. Properties.GetPropVal = function(prop,obj)
  3527. if prop.MultiType then return "<Multiple Types>" end
  3528. if not obj then return end
  3529.  
  3530. local propVal
  3531. if prop.IsAttribute then
  3532. propVal = getAttribute(obj,prop.AttributeName)
  3533. if propVal == nil then return nil end
  3534.  
  3535. local typ = typeof(propVal)
  3536. local currentType = Properties.TypeNameConvert[typ] or typ
  3537. if prop.RootType then
  3538. if prop.RootType.Name ~= currentType then
  3539. return nil
  3540. end
  3541. elseif prop.ValueType.Name ~= currentType then
  3542. return nil
  3543. end
  3544. else
  3545. propVal = obj[prop.Name]
  3546. end
  3547. if prop.SubName then
  3548. local indexes = string.split(prop.SubName,".")
  3549. for i = 1,#indexes do
  3550. local indexName = indexes[i]
  3551. if #indexName > 0 and propVal then
  3552. propVal = propVal[indexName]
  3553. end
  3554. end
  3555. end
  3556.  
  3557. return propVal
  3558. end
  3559.  
  3560. Properties.SelectObject = function(obj)
  3561. if inputProp and inputProp.ValueType.Category == "Class" then
  3562. local prop = inputProp
  3563. inputProp = nil
  3564.  
  3565. if isa(obj,prop.ValueType.Name) then
  3566. Properties.SetProp(prop,obj)
  3567. else
  3568. Properties.Refresh()
  3569. end
  3570.  
  3571. return true
  3572. end
  3573.  
  3574. return false
  3575. end
  3576.  
  3577. Properties.DisplayProp = function(prop,entryIndex)
  3578. local propName = prop.Name
  3579. local typeData = prop.ValueType
  3580. local typeName = typeData.Name
  3581. local tags = prop.Tags
  3582. local gName = prop.Class.."."..prop.Name..(prop.SubName or "")
  3583. local propObj = autoUpdateObjs[gName]
  3584. local entryData = propEntries[entryIndex]
  3585. local UDim2 = UDim2
  3586.  
  3587. local guiElems = entryData.GuiElems
  3588. local valueFrame = guiElems.ValueFrame
  3589. local valueBox = guiElems.ValueBox
  3590. local colorButton = guiElems.ColorButton
  3591. local colorPreview = guiElems.ColorPreview
  3592. local gradient = guiElems.Gradient
  3593. local enumArrow = guiElems.EnumArrow
  3594. local checkbox = guiElems.Checkbox
  3595. local rightButton = guiElems.RightButton
  3596. local soundPreview = guiElems.SoundPreview
  3597.  
  3598. local propVal = Properties.GetPropVal(prop,propObj)
  3599. local inputFullName = inputProp and (inputProp.Class.."."..inputProp.Name..(inputProp.SubName or ""))
  3600.  
  3601. local offset = 4
  3602. local endOffset = 6
  3603.  
  3604. -- Offsetting the ValueBox for ValueType specific buttons
  3605. if (typeName == "Color3" or typeName == "BrickColor" or typeName == "ColorSequence") then
  3606. colorButton.Visible = true
  3607. enumArrow.Visible = false
  3608. if propVal then
  3609. gradient.Color = (typeName == "Color3" and ColorSequence.new(propVal)) or (typeName == "BrickColor" and ColorSequence.new(propVal.Color)) or propVal
  3610. else
  3611. gradient.Color = ColorSequence.new(Color3.new(1,1,1))
  3612. end
  3613. colorPreview.BorderColor3 = (typeName == "ColorSequence" and Color3.new(1,1,1) or Color3.new(0,0,0))
  3614. offset = 22
  3615. endOffset = 24 + (typeName == "ColorSequence" and 20 or 0)
  3616. elseif typeData.Category == "Enum" then
  3617. colorButton.Visible = false
  3618. enumArrow.Visible = not prop.Tags.ReadOnly
  3619. endOffset = 22
  3620. elseif (gName == inputFullName and typeData.Category == "Class") or typeName == "NumberSequence" then
  3621. colorButton.Visible = false
  3622. enumArrow.Visible = false
  3623. endOffset = 26
  3624. else
  3625. colorButton.Visible = false
  3626. enumArrow.Visible = false
  3627. end
  3628.  
  3629. valueBox.Position = UDim2.new(0,offset,0,0)
  3630. valueBox.Size = UDim2.new(1,-endOffset,1,0)
  3631.  
  3632. -- Right button
  3633. if inputFullName == gName and typeData.Category == "Class" then
  3634. Main.MiscIcons:DisplayByKey(guiElems.RightButtonIcon, "Delete")
  3635. guiElems.RightButtonIcon.Visible = true
  3636. rightButton.Text = ""
  3637. rightButton.Visible = true
  3638. elseif typeName == "NumberSequence" or typeName == "ColorSequence" then
  3639. guiElems.RightButtonIcon.Visible = false
  3640. rightButton.Text = "..."
  3641. rightButton.Visible = true
  3642. else
  3643. rightButton.Visible = false
  3644. end
  3645.  
  3646. -- Displays the correct ValueBox for the ValueType, and sets it to the prop value
  3647. if typeName == "bool" or typeName == "PhysicalProperties" then
  3648. valueBox.Visible = false
  3649. checkbox.Visible = true
  3650. soundPreview.Visible = false
  3651. checkboxes[entryIndex].Disabled = tags.ReadOnly
  3652. if typeName == "PhysicalProperties" and autoUpdateObjs[gName] then
  3653. checkboxes[entryIndex]:SetState(propVal and true or false)
  3654. else
  3655. checkboxes[entryIndex]:SetState(propVal)
  3656. end
  3657. elseif typeName == "SoundPlayer" then
  3658. valueBox.Visible = false
  3659. checkbox.Visible = false
  3660. soundPreview.Visible = true
  3661. local playing = Properties.PreviewSound and Properties.PreviewSound.Playing
  3662. Main.MiscIcons:DisplayByKey(soundPreview.ControlButton.Icon, playing and "Pause" or "Play")
  3663. else
  3664. valueBox.Visible = true
  3665. checkbox.Visible = false
  3666. soundPreview.Visible = false
  3667.  
  3668. if propVal ~= nil then
  3669. if typeName == "Color3" then
  3670. valueBox.Text = "["..Lib.ColorToBytes(propVal).."]"
  3671. elseif typeData.Category == "Enum" then
  3672. valueBox.Text = propVal.Name
  3673. elseif Properties.RoundableTypes[typeName] and Settings.Properties.NumberRounding then
  3674. local rawStr = Properties.ValueToString(prop,propVal)
  3675. valueBox.Text = rawStr:gsub("-?%d+%.%d+",function(num)
  3676. return tostring(tonumber(("%."..Settings.Properties.NumberRounding.."f"):format(num)))
  3677. end)
  3678. else
  3679. valueBox.Text = Properties.ValueToString(prop,propVal)
  3680. end
  3681. else
  3682. valueBox.Text = ""
  3683. end
  3684.  
  3685. valueBox.TextColor3 = tags.ReadOnly and Settings.Theme.PlaceholderText or Settings.Theme.Text
  3686. end
  3687. end
  3688.  
  3689. Properties.Refresh = function()
  3690. local maxEntries = math.max(math.ceil((propsFrame.AbsoluteSize.Y) / 23),0)
  3691. local maxX = propsFrame.AbsoluteSize.X
  3692. local valueWidth = math.max(Properties.MinInputWidth,maxX-Properties.ViewWidth)
  3693. local inputPropVisible = false
  3694. local isa = game.IsA
  3695. local UDim2 = UDim2
  3696. local stringSplit = string.split
  3697. local scaleType = Settings.Properties.ScaleType
  3698.  
  3699. -- Clear connections
  3700. for i = 1,#propCons do
  3701. propCons[i]:Disconnect()
  3702. end
  3703. table.clear(propCons)
  3704.  
  3705. -- Hide full name viewer
  3706. Properties.FullNameFrame.Visible = false
  3707. Properties.FullNameFrameAttach.Disable()
  3708.  
  3709. for i = 1,maxEntries do
  3710. local entryData = propEntries[i]
  3711. if not propEntries[i] then entryData = Properties.NewPropEntry(i) propEntries[i] = entryData end
  3712.  
  3713. local entry = entryData.Gui
  3714. local guiElems = entryData.GuiElems
  3715. local nameFrame = guiElems.NameFrame
  3716. local propNameLabel = guiElems.PropName
  3717. local valueFrame = guiElems.ValueFrame
  3718. local expand = guiElems.Expand
  3719. local valueBox = guiElems.ValueBox
  3720. local propNameBox = guiElems.PropName
  3721. local rightButton = guiElems.RightButton
  3722. local editAttributeButton = guiElems.EditAttributeButton
  3723. local toggleAttributes = guiElems.ToggleAttributes
  3724.  
  3725. local prop = viewList[i + Properties.Index]
  3726. if prop then
  3727. local entryXOffset = (scaleType == 0 and scrollH.Index or 0)
  3728. entry.Visible = true
  3729. entry.Position = UDim2.new(0,-entryXOffset,0,entry.Position.Y.Offset)
  3730. entry.Size = UDim2.new(scaleType == 0 and 0 or 1, scaleType == 0 and Properties.ViewWidth + valueWidth or 0,0,22)
  3731.  
  3732. if prop.SpecialRow then
  3733. if prop.SpecialRow == "AddAttribute" then
  3734. nameFrame.Visible = false
  3735. valueFrame.Visible = false
  3736. guiElems.RowButton.Visible = true
  3737. end
  3738. else
  3739. -- Revert special row stuff
  3740. nameFrame.Visible = true
  3741. guiElems.RowButton.Visible = false
  3742.  
  3743. local depth = Properties.EntryIndent*(prop.Depth or 1)
  3744. local leftOffset = depth + Properties.EntryOffset
  3745. nameFrame.Position = UDim2.new(0,leftOffset,0,0)
  3746. propNameLabel.Size = UDim2.new(1,-2 - (scaleType == 0 and 0 or 6),1,0)
  3747.  
  3748. local gName = (prop.CategoryName and "CAT_"..prop.CategoryName) or prop.Class.."."..prop.Name..(prop.SubName or "")
  3749.  
  3750. if prop.CategoryName then
  3751. entry.BackgroundColor3 = Settings.Theme.Main1
  3752. valueFrame.Visible = false
  3753.  
  3754. propNameBox.Text = prop.CategoryName
  3755. propNameBox.Font = Enum.Font.SourceSansBold
  3756. expand.Visible = true
  3757. propNameBox.TextColor3 = Settings.Theme.Text
  3758. nameFrame.BackgroundTransparency = 1
  3759. nameFrame.Size = UDim2.new(1,0,1,0)
  3760. editAttributeButton.Visible = false
  3761.  
  3762. local showingAttrs = Settings.Properties.ShowAttributes
  3763. toggleAttributes.Position = UDim2.new(1,-85-leftOffset,0,0)
  3764. toggleAttributes.Text = (showingAttrs and "[Setting: ON]" or "[Setting: OFF]")
  3765. toggleAttributes.TextColor3 = Settings.Theme.Text
  3766. toggleAttributes.Visible = (prop.CategoryName == "Attributes")
  3767. else
  3768. local propName = prop.Name
  3769. local typeData = prop.ValueType
  3770. local typeName = typeData.Name
  3771. local tags = prop.Tags
  3772. local propObj = autoUpdateObjs[gName]
  3773.  
  3774. local attributeOffset = (prop.IsAttribute and 20 or 0)
  3775. editAttributeButton.Visible = (prop.IsAttribute and not prop.RootType)
  3776. toggleAttributes.Visible = false
  3777.  
  3778. -- Moving around the frames
  3779. if scaleType == 0 then
  3780. nameFrame.Size = UDim2.new(0,Properties.ViewWidth - leftOffset - 1,1,0)
  3781. valueFrame.Position = UDim2.new(0,Properties.ViewWidth,0,0)
  3782. valueFrame.Size = UDim2.new(0,valueWidth - attributeOffset,1,0)
  3783. else
  3784. nameFrame.Size = UDim2.new(0.5,-leftOffset - 1,1,0)
  3785. valueFrame.Position = UDim2.new(0.5,0,0,0)
  3786. valueFrame.Size = UDim2.new(0.5,-attributeOffset,1,0)
  3787. end
  3788.  
  3789. local nameArr = stringSplit(gName,".")
  3790. propNameBox.Text = prop.DisplayName or nameArr[#nameArr]
  3791. propNameBox.Font = Enum.Font.SourceSans
  3792. entry.BackgroundColor3 = Settings.Theme.Main2
  3793. valueFrame.Visible = true
  3794.  
  3795. expand.Visible = typeData.Category == "DataType" and Properties.ExpandableTypes[typeName] or Properties.ExpandableProps[gName]
  3796. propNameBox.TextColor3 = tags.ReadOnly and Settings.Theme.PlaceholderText or Settings.Theme.Text
  3797.  
  3798. -- Display property value
  3799. Properties.DisplayProp(prop,i)
  3800. if propObj then
  3801. if prop.IsAttribute then
  3802. propCons[#propCons+1] = getAttributeChangedSignal(propObj,prop.AttributeName):Connect(function()
  3803. Properties.DisplayProp(prop,i)
  3804. end)
  3805. else
  3806. propCons[#propCons+1] = getPropChangedSignal(propObj,propName):Connect(function()
  3807. Properties.DisplayProp(prop,i)
  3808. end)
  3809. end
  3810. end
  3811.  
  3812. -- Position and resize Input Box
  3813. local beforeVisible = valueBox.Visible
  3814. local inputFullName = inputProp and (inputProp.Class.."."..inputProp.Name..(inputProp.SubName or ""))
  3815. if gName == inputFullName then
  3816. nameFrame.BackgroundColor3 = Settings.Theme.ListSelection
  3817. nameFrame.BackgroundTransparency = 0
  3818. if typeData.Category == "Class" or typeData.Category == "Enum" or typeName == "BrickColor" then
  3819. valueFrame.BackgroundColor3 = Settings.Theme.TextBox
  3820. valueFrame.BackgroundTransparency = 0
  3821. valueBox.Visible = true
  3822. else
  3823. inputPropVisible = true
  3824. local scale = (scaleType == 0 and 0 or 0.5)
  3825. local offset = (scaleType == 0 and Properties.ViewWidth-scrollH.Index or 0)
  3826. local endOffset = 0
  3827.  
  3828. if typeName == "Color3" or typeName == "ColorSequence" then
  3829. offset = offset + 22
  3830. end
  3831.  
  3832. if typeName == "NumberSequence" or typeName == "ColorSequence" then
  3833. endOffset = 20
  3834. end
  3835.  
  3836. inputBox.Position = UDim2.new(scale,offset,0,entry.Position.Y.Offset)
  3837. inputBox.Size = UDim2.new(1-scale,-offset-endOffset-attributeOffset,0,22)
  3838. inputBox.Visible = true
  3839. valueBox.Visible = false
  3840. end
  3841. else
  3842. nameFrame.BackgroundColor3 = Settings.Theme.Main1
  3843. nameFrame.BackgroundTransparency = 1
  3844. valueFrame.BackgroundColor3 = Settings.Theme.Main1
  3845. valueFrame.BackgroundTransparency = 1
  3846. valueBox.Visible = beforeVisible
  3847. end
  3848. end
  3849.  
  3850. -- Expand
  3851. if prop.CategoryName or Properties.ExpandableTypes[prop.ValueType and prop.ValueType.Name] or Properties.ExpandableProps[gName] then
  3852. if Lib.CheckMouseInGui(expand) then
  3853. Main.MiscIcons:DisplayByKey(expand.Icon, expanded[gName] and "Collapse_Over" or "Expand_Over")
  3854. else
  3855. Main.MiscIcons:DisplayByKey(expand.Icon, expanded[gName] and "Collapse" or "Expand")
  3856. end
  3857. expand.Visible = true
  3858. else
  3859. expand.Visible = false
  3860. end
  3861. end
  3862. entry.Visible = true
  3863. else
  3864. entry.Visible = false
  3865. end
  3866. end
  3867.  
  3868. if not inputPropVisible then
  3869. inputBox.Visible = false
  3870. end
  3871.  
  3872. for i = maxEntries+1,#propEntries do
  3873. propEntries[i].Gui:Destroy()
  3874. propEntries[i] = nil
  3875. checkboxes[i] = nil
  3876. end
  3877. end
  3878.  
  3879. Properties.SetProp = function(prop,val,noupdate,prevAttribute)
  3880. local sList = Explorer.Selection.List
  3881. local propName = prop.Name
  3882. local subName = prop.SubName
  3883. local propClass = prop.Class
  3884. local typeData = prop.ValueType
  3885. local typeName = typeData.Name
  3886. local attributeName = prop.AttributeName
  3887. local rootTypeData = prop.RootType
  3888. local rootTypeName = rootTypeData and rootTypeData.Name
  3889. local fullName = prop.Class.."."..prop.Name..(prop.SubName or "")
  3890. local Vector3 = Vector3
  3891.  
  3892. for i = 1,#sList do
  3893. local node = sList[i]
  3894. local obj = node.Obj
  3895.  
  3896. if isa(obj,propClass) then
  3897. pcall(function()
  3898. local setVal = val
  3899. local root
  3900. if prop.IsAttribute then
  3901. root = getAttribute(obj,attributeName)
  3902. else
  3903. root = obj[propName]
  3904. end
  3905.  
  3906. if prevAttribute then
  3907. if prevAttribute.ValueType.Name == typeName then
  3908. setVal = getAttribute(obj,prevAttribute.AttributeName) or setVal
  3909. end
  3910. setAttribute(obj,prevAttribute.AttributeName,nil)
  3911. end
  3912.  
  3913. if rootTypeName then
  3914. if rootTypeName == "Vector2" then
  3915. setVal = Vector2.new((subName == ".X" and setVal) or root.X, (subName == ".Y" and setVal) or root.Y)
  3916. elseif rootTypeName == "Vector3" then
  3917. setVal = Vector3.new((subName == ".X" and setVal) or root.X, (subName == ".Y" and setVal) or root.Y, (subName == ".Z" and setVal) or root.Z)
  3918. elseif rootTypeName == "UDim" then
  3919. setVal = UDim.new((subName == ".Scale" and setVal) or root.Scale, (subName == ".Offset" and setVal) or root.Offset)
  3920. elseif rootTypeName == "UDim2" then
  3921. local rootX,rootY = root.X,root.Y
  3922. local X_UDim = (subName == ".X" and setVal) or UDim.new((subName == ".X.Scale" and setVal) or rootX.Scale, (subName == ".X.Offset" and setVal) or rootX.Offset)
  3923. local Y_UDim = (subName == ".Y" and setVal) or UDim.new((subName == ".Y.Scale" and setVal) or rootY.Scale, (subName == ".Y.Offset" and setVal) or rootY.Offset)
  3924. setVal = UDim2.new(X_UDim,Y_UDim)
  3925. elseif rootTypeName == "CFrame" then
  3926. local rootPos,rootRight,rootUp,rootLook = root.Position,root.RightVector,root.UpVector,root.LookVector
  3927. local pos = (subName == ".Position" and setVal) or Vector3.new((subName == ".Position.X" and setVal) or rootPos.X, (subName == ".Position.Y" and setVal) or rootPos.Y, (subName == ".Position.Z" and setVal) or rootPos.Z)
  3928. local rightV = (subName == ".RightVector" and setVal) or Vector3.new((subName == ".RightVector.X" and setVal) or rootRight.X, (subName == ".RightVector.Y" and setVal) or rootRight.Y, (subName == ".RightVector.Z" and setVal) or rootRight.Z)
  3929. local upV = (subName == ".UpVector" and setVal) or Vector3.new((subName == ".UpVector.X" and setVal) or rootUp.X, (subName == ".UpVector.Y" and setVal) or rootUp.Y, (subName == ".UpVector.Z" and setVal) or rootUp.Z)
  3930. local lookV = (subName == ".LookVector" and setVal) or Vector3.new((subName == ".LookVector.X" and setVal) or rootLook.X, (subName == ".RightVector.Y" and setVal) or rootLook.Y, (subName == ".RightVector.Z" and setVal) or rootLook.Z)
  3931. setVal = CFrame.fromMatrix(pos,rightV,upV,-lookV)
  3932. elseif rootTypeName == "Rect" then
  3933. local rootMin,rootMax = root.Min,root.Max
  3934. local min = Vector2.new((subName == ".Min.X" and setVal) or rootMin.X, (subName == ".Min.Y" and setVal) or rootMin.Y)
  3935. local max = Vector2.new((subName == ".Max.X" and setVal) or rootMax.X, (subName == ".Max.Y" and setVal) or rootMax.Y)
  3936. setVal = Rect.new(min,max)
  3937. elseif rootTypeName == "PhysicalProperties" then
  3938. local rootProps = PhysicalProperties.new(obj.Material)
  3939. local density = (subName == ".Density" and setVal) or (root and root.Density) or rootProps.Density
  3940. local friction = (subName == ".Friction" and setVal) or (root and root.Friction) or rootProps.Friction
  3941. local elasticity = (subName == ".Elasticity" and setVal) or (root and root.Elasticity) or rootProps.Elasticity
  3942. local frictionWeight = (subName == ".FrictionWeight" and setVal) or (root and root.FrictionWeight) or rootProps.FrictionWeight
  3943. local elasticityWeight = (subName == ".ElasticityWeight" and setVal) or (root and root.ElasticityWeight) or rootProps.ElasticityWeight
  3944. setVal = PhysicalProperties.new(density,friction,elasticity,frictionWeight,elasticityWeight)
  3945. elseif rootTypeName == "Ray" then
  3946. local rootOrigin,rootDirection = root.Origin,root.Direction
  3947. local origin = (subName == ".Origin" and setVal) or Vector3.new((subName == ".Origin.X" and setVal) or rootOrigin.X, (subName == ".Origin.Y" and setVal) or rootOrigin.Y, (subName == ".Origin.Z" and setVal) or rootOrigin.Z)
  3948. local direction = (subName == ".Direction" and setVal) or Vector3.new((subName == ".Direction.X" and setVal) or rootDirection.X, (subName == ".Direction.Y" and setVal) or rootDirection.Y, (subName == ".Direction.Z" and setVal) or rootDirection.Z)
  3949. setVal = Ray.new(origin,direction)
  3950. elseif rootTypeName == "Faces" then
  3951. local faces = {}
  3952. local faceList = {"Back","Bottom","Front","Left","Right","Top"}
  3953. for _,face in pairs(faceList) do
  3954. local val
  3955. if subName == "."..face then
  3956. val = setVal
  3957. else
  3958. val = root[face]
  3959. end
  3960. if val then faces[#faces+1] = Enum.NormalId[face] end
  3961. end
  3962. setVal = Faces.new(unpack(faces))
  3963. elseif rootTypeName == "Axes" then
  3964. local axes = {}
  3965. local axesList = {"X","Y","Z"}
  3966. for _,axe in pairs(axesList) do
  3967. local val
  3968. if subName == "."..axe then
  3969. val = setVal
  3970. else
  3971. val = root[axe]
  3972. end
  3973. if val then axes[#axes+1] = Enum.Axis[axe] end
  3974. end
  3975. setVal = Axes.new(unpack(axes))
  3976. elseif rootTypeName == "NumberRange" then
  3977. setVal = NumberRange.new(subName == ".Min" and setVal or root.Min, subName == ".Max" and setVal or root.Max)
  3978. end
  3979. end
  3980.  
  3981. if typeName == "PhysicalProperties" and setVal then
  3982. setVal = root or PhysicalProperties.new(obj.Material)
  3983. end
  3984.  
  3985. if prop.IsAttribute then
  3986. setAttribute(obj,attributeName,setVal)
  3987. else
  3988. obj[propName] = setVal
  3989. end
  3990. end)
  3991. end
  3992. end
  3993.  
  3994. if not noupdate then
  3995. Properties.ComputeConflicts(prop)
  3996. end
  3997. end
  3998.  
  3999. Properties.InitInputBox = function()
  4000. inputBox = create({
  4001. {1,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderSizePixel=0,Name="InputBox",Size=UDim2.new(0,200,0,22),Visible=false,ZIndex=2,}},
  4002. {2,"TextBox",{BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BackgroundTransparency=1,BorderColor3=Color3.new(0.062745101749897,0.51764708757401,1),BorderSizePixel=0,ClearTextOnFocus=false,Font=3,Parent={1},PlaceholderColor3=Color3.new(0.69803923368454,0.69803923368454,0.69803923368454),Position=UDim2.new(0,3,0,0),Size=UDim2.new(1,-6,1,0),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,TextXAlignment=0,ZIndex=2,}},
  4003. })
  4004. inputTextBox = inputBox.TextBox
  4005. inputBox.BackgroundColor3 = Settings.Theme.TextBox
  4006. inputBox.Parent = Properties.Window.GuiElems.Content.List
  4007.  
  4008. inputTextBox.FocusLost:Connect(function()
  4009. if not inputProp then return end
  4010.  
  4011. local prop = inputProp
  4012. inputProp = nil
  4013. local val = Properties.StringToValue(prop,inputTextBox.Text)
  4014. if val then Properties.SetProp(prop,val) else Properties.Refresh() end
  4015. end)
  4016.  
  4017. inputTextBox.Focused:Connect(function()
  4018. inputTextBox.SelectionStart = 1
  4019. inputTextBox.CursorPosition = #inputTextBox.Text + 1
  4020. end)
  4021.  
  4022. Lib.ViewportTextBox.convert(inputTextBox)
  4023. end
  4024.  
  4025. Properties.SetInputProp = function(prop,entryIndex,special)
  4026. local typeData = prop.ValueType
  4027. local typeName = typeData.Name
  4028. local fullName = prop.Class.."."..prop.Name..(prop.SubName or "")
  4029. local propObj = autoUpdateObjs[fullName]
  4030. local propVal = Properties.GetPropVal(prop,propObj)
  4031.  
  4032. if prop.Tags.ReadOnly then return end
  4033.  
  4034. inputProp = prop
  4035. if special then
  4036. if special == "color" then
  4037. if typeName == "Color3" then
  4038. inputTextBox.Text = propVal and Properties.ValueToString(prop,propVal) or ""
  4039. Properties.DisplayColorEditor(prop,propVal)
  4040. elseif typeName == "BrickColor" then
  4041. Properties.DisplayBrickColorEditor(prop,entryIndex,propVal)
  4042. elseif typeName == "ColorSequence" then
  4043. inputTextBox.Text = propVal and Properties.ValueToString(prop,propVal) or ""
  4044. Properties.DisplayColorSequenceEditor(prop,propVal)
  4045. end
  4046. elseif special == "right" then
  4047. if typeName == "NumberSequence" then
  4048. inputTextBox.Text = propVal and Properties.ValueToString(prop,propVal) or ""
  4049. Properties.DisplayNumberSequenceEditor(prop,propVal)
  4050. elseif typeName == "ColorSequence" then
  4051. inputTextBox.Text = propVal and Properties.ValueToString(prop,propVal) or ""
  4052. Properties.DisplayColorSequenceEditor(prop,propVal)
  4053. end
  4054. end
  4055. else
  4056. if Properties.IsTextEditable(prop) then
  4057. inputTextBox.Text = propVal and Properties.ValueToString(prop,propVal) or ""
  4058. inputTextBox:CaptureFocus()
  4059. elseif typeData.Category == "Enum" then
  4060. Properties.DisplayEnumDropdown(entryIndex)
  4061. elseif typeName == "BrickColor" then
  4062. Properties.DisplayBrickColorEditor(prop,entryIndex,propVal)
  4063. end
  4064. end
  4065. Properties.Refresh()
  4066. end
  4067.  
  4068. Properties.InitSearch = function()
  4069. local TweenService = service.TweenService
  4070. local SearchFrame = Properties.GuiElems.ToolBar.SearchFrame
  4071. local searchBox = SearchFrame.SearchBox
  4072.  
  4073. local TweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quint)
  4074.  
  4075. local Tweens = {
  4076. Start = TweenService:Create(SearchFrame.UIStroke, TweenInfo, { Color = Color3.fromRGB(0, 120, 215) }),
  4077. End = TweenService:Create(SearchFrame.UIStroke, TweenInfo, { Color = Color3.fromRGB(42, 42, 42) })
  4078. }
  4079.  
  4080. Lib.ViewportTextBox.convert(searchBox)
  4081.  
  4082. searchBox.FocusLost:Connect(function() Tweens.End:Play() end)
  4083. searchBox.Focused:Connect(function() Tweens.Start:Play() end)
  4084.  
  4085. searchBox:GetPropertyChangedSignal("Text"):Connect(function()
  4086. Properties.SearchText = searchBox.Text
  4087. Properties.Update()
  4088. Properties.Refresh()
  4089. end)
  4090. end
  4091.  
  4092. Properties.InitEntryStuff = function()
  4093. Properties.EntryTemplate = create({
  4094. {1,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderColor3=Color3.new(0.1294117718935,0.1294117718935,0.1294117718935),Font=3,Name="Entry",Position=UDim2.new(0,1,0,1),Size=UDim2.new(0,250,0,22),Text="",TextSize=14,}},
  4095. {2,"Frame",{BackgroundColor3=Color3.new(0.04313725605607,0.35294118523598,0.68627452850342),BackgroundTransparency=1,BorderColor3=Color3.new(0.33725491166115,0.49019610881805,0.73725491762161),BorderSizePixel=0,Name="NameFrame",Parent={1},Position=UDim2.new(0,20,0,0),Size=UDim2.new(1,-40,1,0),}},
  4096. {3,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="PropName",Parent={2},Position=UDim2.new(0,2,0,0),Size=UDim2.new(1,-2,1,0),Text="Anchored",TextColor3=Color3.new(1,1,1),TextSize=14,TextTransparency=0.10000000149012,TextTruncate=1,TextXAlignment=0,}},
  4097. {4,"TextButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,ClipsDescendants=true,Font=3,Name="Expand",Parent={2},Position=UDim2.new(0,-20,0,1),Size=UDim2.new(0,20,0,20),Text="",TextSize=14,Visible=false,}},
  4098. {5,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://5642383285",ImageRectOffset=Vector2.new(144,16),ImageRectSize=Vector2.new(16,16),Name="Icon",Parent={4},Position=UDim2.new(0,2,0,2),ScaleType=4,Size=UDim2.new(0,16,0,16),}},
  4099. {6,"TextButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=4,Name="ToggleAttributes",Parent={2},Position=UDim2.new(1,-85,0,0),Size=UDim2.new(0,85,0,22),Text="[SETTING: OFF]",TextColor3=Color3.new(1,1,1),TextSize=14,TextTransparency=0.10000000149012,Visible=false,}},
  4100. {7,"Frame",{BackgroundColor3=Color3.new(0.04313725605607,0.35294118523598,0.68627452850342),BackgroundTransparency=1,BorderColor3=Color3.new(0.33725491166115,0.49019607901573,0.73725491762161),BorderSizePixel=0,Name="ValueFrame",Parent={1},Position=UDim2.new(1,-100,0,0),Size=UDim2.new(0,80,1,0),}},
  4101. {8,"Frame",{BackgroundColor3=Color3.new(0.14117647707462,0.14117647707462,0.14117647707462),BorderColor3=Color3.new(0.33725491166115,0.49019610881805,0.73725491762161),BorderSizePixel=0,Name="Line",Parent={7},Position=UDim2.new(0,-1,0,0),Size=UDim2.new(0,1,1,0),}},
  4102. {9,"TextButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="ColorButton",Parent={7},Size=UDim2.new(0,20,0,22),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,Visible=false,}},
  4103. {10,"Frame",{BackgroundColor3=Color3.new(1,1,1),BorderColor3=Color3.new(0,0,0),Name="ColorPreview",Parent={9},Position=UDim2.new(0,5,0,6),Size=UDim2.new(0,10,0,10),}},
  4104. {11,"UIGradient",{Parent={10},}},
  4105. {12,"Frame",{BackgroundTransparency=1,Name="EnumArrow",Parent={7},Position=UDim2.new(1,-16,0,3),Size=UDim2.new(0,16,0,16),Visible=false,}},
  4106. {13,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={12},Position=UDim2.new(0,8,0,9),Size=UDim2.new(0,1,0,1),}},
  4107. {14,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={12},Position=UDim2.new(0,7,0,8),Size=UDim2.new(0,3,0,1),}},
  4108. {15,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={12},Position=UDim2.new(0,6,0,7),Size=UDim2.new(0,5,0,1),}},
  4109. {16,"TextButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="ValueBox",Parent={7},Position=UDim2.new(0,4,0,0),Size=UDim2.new(1,-8,1,0),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,TextTransparency=0.10000000149012,TextTruncate=1,TextXAlignment=0,}},
  4110. {17,"TextButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="RightButton",Parent={7},Position=UDim2.new(1,-20,0,0),Size=UDim2.new(0,20,0,22),Text="...",TextColor3=Color3.new(1,1,1),TextSize=14,Visible=false,}},
  4111. {18,"TextButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="SettingsButton",Parent={7},Position=UDim2.new(1,-20,0,0),Size=UDim2.new(0,20,0,22),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,Visible=false,}},
  4112. {19,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Name="SoundPreview",Parent={7},Size=UDim2.new(1,0,1,0),Visible=false,}},
  4113. {20,"TextButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="ControlButton",Parent={19},Size=UDim2.new(0,20,0,22),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,}},
  4114. {21,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://5642383285",ImageRectOffset=Vector2.new(144,16),ImageRectSize=Vector2.new(16,16),Name="Icon",Parent={20},Position=UDim2.new(0,2,0,3),ScaleType=4,Size=UDim2.new(0,16,0,16),}},
  4115. {22,"Frame",{BackgroundColor3=Color3.new(0.3137255012989,0.3137255012989,0.3137255012989),BorderSizePixel=0,Name="TimeLine",Parent={19},Position=UDim2.new(0,26,0.5,-1),Size=UDim2.new(1,-34,0,2),}},
  4116. {23,"Frame",{BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderColor3=Color3.new(0.1294117718935,0.1294117718935,0.1294117718935),Name="Slider",Parent={22},Position=UDim2.new(0,-4,0,-8),Size=UDim2.new(0,8,0,18),}},
  4117. {24,"TextButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="EditAttributeButton",Parent={1},Position=UDim2.new(1,-20,0,0),Size=UDim2.new(0,20,0,22),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,}},
  4118. {25,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://5034718180",ImageTransparency=0.20000000298023,Name="Icon",Parent={24},Position=UDim2.new(0,2,0,3),Size=UDim2.new(0,16,0,16),}},
  4119. {26,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderSizePixel=0,Font=3,Name="RowButton",Parent={1},Size=UDim2.new(1,0,1,0),Text="Add Attribute",TextColor3=Color3.new(1,1,1),TextSize=14,TextTransparency=0.10000000149012,Visible=false,}},
  4120. })
  4121.  
  4122. local fullNameFrame = Lib.Frame.new()
  4123. local label = Lib.Label.new()
  4124. label.Parent = fullNameFrame.Gui
  4125. label.Position = UDim2.new(0,2,0,0)
  4126. label.Size = UDim2.new(1,-4,1,0)
  4127. fullNameFrame.Visible = false
  4128. fullNameFrame.Parent = window.Gui
  4129.  
  4130. Properties.FullNameFrame = fullNameFrame
  4131. Properties.FullNameFrameAttach = Lib.AttachTo(fullNameFrame)
  4132. end
  4133.  
  4134. Properties.Init = function() -- TODO: MAKE BETTER
  4135. local guiItems = create({
  4136. {1,"Folder",{Name="Items",}},
  4137. {2,"Frame",{BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),BorderSizePixel=0,Name="ToolBar",Parent={1},Size=UDim2.new(1,0,0,22),}},
  4138. {3,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.1176470592618,0.1176470592618,0.1176470592618),BorderSizePixel=0,Name="SearchFrame",Parent={2},Position=UDim2.new(0,3,0,1),Size=UDim2.new(1,-6,0,18),}},
  4139. {4,"TextBox",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,ClearTextOnFocus=false,Font=3,Name="SearchBox",Parent={3},PlaceholderColor3=Color3.new(0.39215689897537,0.39215689897537,0.39215689897537),PlaceholderText="Search properties",Position=UDim2.new(0,4,0,0),Size=UDim2.new(1,-24,0,18),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,TextXAlignment=0,}},
  4140. {5,"UICorner",{CornerRadius=UDim.new(0,2),Parent={3},}},
  4141. {6,"UIStroke",{Thickness=1.4,Parent={3},Color=Color3.fromRGB(42,42,42)}},
  4142. {7,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Reset",Parent={3},Position=UDim2.new(1,-17,0,1),Size=UDim2.new(0,16,0,16),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,}},
  4143. {8,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://5034718129",ImageColor3=Color3.new(0.39215686917305,0.39215686917305,0.39215686917305),Parent={7},Size=UDim2.new(0,16,0,16),}},
  4144. {9,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Refresh",Parent={2},Position=UDim2.new(1,-20,0,1),Size=UDim2.new(0,18,0,18),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,Visible=false,}},
  4145. {10,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://5642310344",Parent={9},Position=UDim2.new(0,3,0,3),Size=UDim2.new(0,12,0,12),}},
  4146. {11,"Frame",{BackgroundColor3=Color3.new(0.15686275064945,0.15686275064945,0.15686275064945),BorderSizePixel=0,Name="ScrollCorner",Parent={1},Position=UDim2.new(1,-16,1,-16),Size=UDim2.new(0,16,0,16),Visible=false,}},
  4147. {12,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,ClipsDescendants=true,Name="List",Parent={1},Position=UDim2.new(0,0,0,23),Size=UDim2.new(1,0,1,-23),}},
  4148. })
  4149.  
  4150. -- Vars
  4151. categoryOrder = API.CategoryOrder
  4152. for category,_ in next,categoryOrder do
  4153. if not Properties.CollapsedCategories[category] then
  4154. expanded["CAT_"..category] = true
  4155. end
  4156. end
  4157. expanded["Sound.SoundId"] = true
  4158.  
  4159. -- Init window
  4160. window = Lib.Window.new()
  4161. Properties.Window = window
  4162. window:SetTitle("Properties")
  4163.  
  4164. toolBar = guiItems.ToolBar
  4165. propsFrame = guiItems.List
  4166.  
  4167. Properties.GuiElems.ToolBar = toolBar
  4168. Properties.GuiElems.PropsFrame = propsFrame
  4169.  
  4170. Properties.InitEntryStuff()
  4171.  
  4172. -- Window events
  4173. window.GuiElems.Main:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
  4174. if Properties.Window:IsContentVisible() then
  4175. Properties.UpdateView()
  4176. Properties.Refresh()
  4177. end
  4178. end)
  4179. window.OnActivate:Connect(function()
  4180. Properties.UpdateView()
  4181. Properties.Update()
  4182. Properties.Refresh()
  4183. end)
  4184. window.OnRestore:Connect(function()
  4185. Properties.UpdateView()
  4186. Properties.Update()
  4187. Properties.Refresh()
  4188. end)
  4189.  
  4190. -- Init scrollbars
  4191. scrollV = Lib.ScrollBar.new()
  4192. scrollV.WheelIncrement = 3
  4193. scrollV.Gui.Position = UDim2.new(1,-16,0,23)
  4194. scrollV:SetScrollFrame(propsFrame)
  4195. scrollV.Scrolled:Connect(function()
  4196. Properties.Index = scrollV.Index
  4197. Properties.Refresh()
  4198. end)
  4199.  
  4200. scrollH = Lib.ScrollBar.new(true)
  4201. scrollH.Increment = 5
  4202. scrollH.WheelIncrement = 20
  4203. scrollH.Gui.Position = UDim2.new(0,0,1,-16)
  4204. scrollH.Scrolled:Connect(function()
  4205. Properties.Refresh()
  4206. end)
  4207.  
  4208. -- Setup Gui
  4209. window.GuiElems.Line.Position = UDim2.new(0,0,0,22)
  4210. toolBar.Parent = window.GuiElems.Content
  4211. propsFrame.Parent = window.GuiElems.Content
  4212. guiItems.ScrollCorner.Parent = window.GuiElems.Content
  4213. scrollV.Gui.Parent = window.GuiElems.Content
  4214. scrollH.Gui.Parent = window.GuiElems.Content
  4215. Properties.InitInputBox()
  4216. Properties.InitSearch()
  4217. end
  4218.  
  4219. return Properties
  4220. end
  4221.  
  4222. return {InitDeps = initDeps, InitAfterMain = initAfterMain, Main = main}
  4223. end,
  4224. ScriptViewer = function()
  4225. --[[
  4226. Script Viewer App Module
  4227.  
  4228. A script viewer that is basically a notepad
  4229. ]]
  4230.  
  4231. -- Common Locals
  4232. local Main,Lib,Apps,Settings -- Main Containers
  4233. local Explorer, Properties, ScriptViewer, Notebook -- Major Apps
  4234. local API,RMD,env,service,plr,create,createSimple -- Main Locals
  4235.  
  4236. local function initDeps(data)
  4237. Main = data.Main
  4238. Lib = data.Lib
  4239. Apps = data.Apps
  4240. Settings = data.Settings
  4241.  
  4242. API = data.API
  4243. RMD = data.RMD
  4244. env = data.env
  4245. service = data.service
  4246. plr = data.plr
  4247. create = data.create
  4248. createSimple = data.createSimple
  4249. end
  4250.  
  4251. local function initAfterMain()
  4252. Explorer = Apps.Explorer
  4253. Properties = Apps.Properties
  4254. ScriptViewer = Apps.ScriptViewer
  4255. Notebook = Apps.Notebook
  4256. end
  4257.  
  4258. local function main()
  4259. local ScriptViewer = {}
  4260. local window, codeFrame
  4261. local PreviousScr = nil
  4262.  
  4263. ScriptViewer.ViewScript = function(scr)
  4264. local success, source = pcall(env.decompile, scr)
  4265. if not success or not source then source, PreviousScr = ("-- DEX - %s failed to decompile %s"):format(env.executor, scr.ClassName), nil else PreviousScr = scr end
  4266. codeFrame:SetText(source:gsub("\0", "\\0"))
  4267. window:Show()
  4268. end
  4269.  
  4270. ScriptViewer.Init = function()
  4271. window = Lib.Window.new()
  4272. window:SetTitle("Script Viewer")
  4273. window:Resize(500, 400)
  4274. ScriptViewer.Window = window
  4275.  
  4276. codeFrame = Lib.CodeFrame.new()
  4277. codeFrame.Frame.Position = UDim2.new(0,0,0,20)
  4278. codeFrame.Frame.Size = UDim2.new(1,0,1,-20)
  4279. codeFrame.Frame.Parent = window.GuiElems.Content
  4280.  
  4281. -- TODO: REMOVE AND MAKE BETTER
  4282. local copy = Instance.new("TextButton", window.GuiElems.Content)
  4283. copy.BackgroundTransparency = 1
  4284. copy.Size = UDim2.new(0.5,0,0,20)
  4285. copy.Text = "Copy to Clipboard"
  4286. copy.TextColor3 = Color3.new(1,1,1)
  4287.  
  4288. copy.MouseButton1Click:Connect(function()
  4289. local source = codeFrame:GetText()
  4290. env.setclipboard(source)
  4291. end)
  4292.  
  4293. local save = Instance.new("TextButton",window.GuiElems.Content)
  4294. save.BackgroundTransparency = 1
  4295. save.Position = UDim2.new(0.35,0,0,0)
  4296. save.Size = UDim2.new(0.3,0,0,20)
  4297. save.Text = "Save to File"
  4298. save.TextColor3 = Color3.new(1,1,1)
  4299.  
  4300. save.MouseButton1Click:Connect(function()
  4301. local source = codeFrame:GetText()
  4302. local filename = "Place_"..game.PlaceId.."_Script_"..os.time()..".txt"
  4303.  
  4304. env.writefile(filename, source)
  4305. if env.movefileas then
  4306. env.movefileas(filename, ".txt")
  4307. end
  4308. end)
  4309.  
  4310. local dumpbtn = Instance.new("TextButton",window.GuiElems.Content)
  4311. dumpbtn.BackgroundTransparency = 1
  4312. dumpbtn.Position = UDim2.new(0.7,0,0,0)
  4313. dumpbtn.Size = UDim2.new(0.3,0,0,20)
  4314. dumpbtn.Text = "Dump Functions"
  4315. dumpbtn.TextColor3 = Color3.new(1,1,1)
  4316.  
  4317. dumpbtn.MouseButton1Click:Connect(function()
  4318. if PreviousScr ~= nil then
  4319. pcall(function()
  4320. -- thanks King.Kevin#6025 you'll obviously be credited (no discord tag since that can easily be impersonated)
  4321. local getgc = getgc or get_gc_objects
  4322. local getupvalues = (debug and debug.getupvalues) or getupvalues or getupvals
  4323. local getconstants = (debug and debug.getconstants) or getconstants or getconsts
  4324. local getinfo = (debug and (debug.getinfo or debug.info)) or getinfo
  4325. local original = ("\n-- // Function Dumper made by King.Kevin\n-- // Script Path: %s\n\n--[["):format(PreviousScr:GetFullName())
  4326. local dump = original
  4327. local functions, function_count, data_base = {}, 0, {}
  4328. function functions:add_to_dump(str, indentation, new_line)
  4329. local new_line = new_line or true
  4330. dump = dump .. ("%s%s%s"):format(string.rep(" ", indentation), tostring(str), new_line and "\n" or "")
  4331. end
  4332. function functions:get_function_name(func)
  4333. local n = getinfo(func).name
  4334. return n ~= "" and n or "Unknown Name"
  4335. end
  4336. function functions:dump_table(input, indent, index)
  4337. local indent = indent < 0 and 0 or indent
  4338. functions:add_to_dump(("%s [%s] %s"):format(tostring(index), tostring(typeof(input)), tostring(input)), indent - 1)
  4339. local count = 0
  4340. for index, value in pairs(input) do
  4341. count = count + 1
  4342. if type(value) == "function" then
  4343. functions:add_to_dump(("%d [function] = %s"):format(count, functions:get_function_name(value)), indent)
  4344. elseif type(value) == "table" then
  4345. if not data_base[value] then
  4346. data_base[value] = true
  4347. functions:add_to_dump(("%d [table]:"):format(count), indent)
  4348. functions:dump_table(value, indent + 1, index)
  4349. else
  4350. functions:add_to_dump(("%d [table] (Recursive table detected)"):format(count), indent)
  4351. end
  4352. else
  4353. functions:add_to_dump(("%d [%s] = %s"):format(count, tostring(typeof(value)), tostring(value)), indent)
  4354. end
  4355. end
  4356. end
  4357. function functions:dump_function(input, indent)
  4358. functions:add_to_dump(("\nFunction Dump: %s"):format(functions:get_function_name(input)), indent)
  4359. functions:add_to_dump(("\nFunction Upvalues: %s"):format(functions:get_function_name(input)), indent)
  4360. for index, upvalue in pairs(getupvalues(input)) do
  4361. if type(upvalue) == "function" then
  4362. functions:add_to_dump(("%d [function] = %s"):format(index, functions:get_function_name(upvalue)), indent + 1)
  4363. elseif type(upvalue) == "table" then
  4364. if not data_base[upvalue] then
  4365. data_base[upvalue] = true
  4366. functions:add_to_dump(("%d [table]:"):format(index), indent + 1)
  4367. functions:dump_table(upvalue, indent + 2, index)
  4368. else
  4369. functions:add_to_dump(("%d [table] (Recursive table detected)"):format(index), indent + 1)
  4370. end
  4371. else
  4372. functions:add_to_dump(("%d [%s] = %s"):format(index, tostring(typeof(upvalue)), tostring(upvalue)), indent + 1)
  4373. end
  4374. end
  4375. functions:add_to_dump(("\nFunction Constants: %s"):format(functions:get_function_name(input)), indent)
  4376. for index, constant in pairs(getconstants(input)) do
  4377. if type(constant) == "function" then
  4378. functions:add_to_dump(("%d [function] = %s"):format(index, functions:get_function_name(constant)), indent + 1)
  4379. elseif type(constant) == "table" then
  4380. if not data_base[constant] then
  4381. data_base[constant] = true
  4382. functions:add_to_dump(("%d [table]:"):format(index), indent + 1)
  4383. functions:dump_table(constant, indent + 2, index)
  4384. else
  4385. functions:add_to_dump(("%d [table] (Recursive table detected)"):format(index), indent + 1)
  4386. end
  4387. else
  4388. functions:add_to_dump(("%d [%s] = %s"):format(index, tostring(typeof(constant)), tostring(constant)), indent + 1)
  4389. end
  4390. end
  4391. end
  4392. for _, _function in pairs(getgc()) do
  4393. if typeof(_function) == "function" and getfenv(_function).script and getfenv(_function).script == PreviousScr then
  4394. functions:dump_function(_function, 0)
  4395. functions:add_to_dump("\n" .. ("="):rep(100), 0, false)
  4396. end
  4397. end
  4398. local source = codeFrame:GetText()
  4399.  
  4400. if dump ~= original then source = source .. dump .. "]]" end
  4401. codeFrame:SetText(source)
  4402. end)
  4403. end
  4404. end)
  4405. end
  4406.  
  4407. return ScriptViewer
  4408. end
  4409.  
  4410. return {InitDeps = initDeps, InitAfterMain = initAfterMain, Main = main}
  4411. end,
  4412. Lib = function()
  4413. --[[
  4414. Lib Module
  4415.  
  4416. Container for functions and classes
  4417. ]]
  4418.  
  4419. -- Common Locals
  4420. local Main,Lib,Apps,Settings -- Main Containers
  4421. local Explorer, Properties, ScriptViewer, Notebook -- Major Apps
  4422. local API,RMD,env,service,plr,create,createSimple -- Main Locals
  4423.  
  4424. local function initDeps(data)
  4425. Main = data.Main
  4426. Lib = data.Lib
  4427. Apps = data.Apps
  4428. Settings = data.Settings
  4429.  
  4430. API = data.API
  4431. RMD = data.RMD
  4432. env = data.env
  4433. service = data.service
  4434. plr = data.plr
  4435. create = data.create
  4436. createSimple = data.createSimple
  4437. end
  4438.  
  4439. local function initAfterMain()
  4440. Explorer = Apps.Explorer
  4441. Properties = Apps.Properties
  4442. ScriptViewer = Apps.ScriptViewer
  4443. Notebook = Apps.Notebook
  4444. end
  4445.  
  4446. local function main()
  4447. local Lib = {}
  4448.  
  4449. local renderStepped = service.RunService.RenderStepped
  4450. local signalWait = renderStepped.wait
  4451. local PH = newproxy() -- Placeholder, must be replaced in constructor
  4452. local SIGNAL = newproxy()
  4453.  
  4454. -- Usually for classes that work with a Roblox Object
  4455. local function initObj(props,mt)
  4456. local type = type
  4457. local function copy(t)
  4458. local res = {}
  4459. for i,v in pairs(t) do
  4460. if v == SIGNAL then
  4461. res[i] = Lib.Signal.new()
  4462. elseif type(v) == "table" then
  4463. res[i] = copy(v)
  4464. else
  4465. res[i] = v
  4466. end
  4467. end
  4468. return res
  4469. end
  4470.  
  4471. local newObj = copy(props)
  4472. return setmetatable(newObj,mt)
  4473. end
  4474.  
  4475. local function getGuiMT(props,funcs)
  4476. return {__index = function(self,ind) if not props[ind] then return funcs[ind] or self.Gui[ind] end end,
  4477. __newindex = function(self,ind,val) if not props[ind] then self.Gui[ind] = val else rawset(self,ind,val) end end}
  4478. end
  4479.  
  4480. -- Functions
  4481.  
  4482. Lib.FormatLuaString = (function()
  4483. local string = string
  4484. local gsub = string.gsub
  4485. local format = string.format
  4486. local char = string.char
  4487. local cleanTable = {['"'] = '\\"', ['\\'] = '\\\\'}
  4488. for i = 0,31 do
  4489. cleanTable[char(i)] = "\\"..format("%03d",i)
  4490. end
  4491. for i = 127,255 do
  4492. cleanTable[char(i)] = "\\"..format("%03d",i)
  4493. end
  4494.  
  4495. return function(str)
  4496. return gsub(str,"[\"\\\0-\31\127-\255]",cleanTable)
  4497. end
  4498. end)()
  4499.  
  4500. Lib.CheckMouseInGui = function(gui)
  4501. if gui == nil then return false end
  4502. local mouse = Main.Mouse
  4503. local guiPosition = gui.AbsolutePosition
  4504. local guiSize = gui.AbsoluteSize
  4505.  
  4506. return mouse.X >= guiPosition.X and mouse.X < guiPosition.X + guiSize.X and mouse.Y >= guiPosition.Y and mouse.Y < guiPosition.Y + guiSize.Y
  4507. end
  4508.  
  4509. Lib.IsShiftDown = function()
  4510. return service.UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or service.UserInputService:IsKeyDown(Enum.KeyCode.RightShift)
  4511. end
  4512.  
  4513. Lib.IsCtrlDown = function()
  4514. return service.UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) or service.UserInputService:IsKeyDown(Enum.KeyCode.RightControl)
  4515. end
  4516.  
  4517. Lib.CreateArrow = function(size,num,dir)
  4518. local max = num
  4519. local arrowFrame = createSimple("Frame",{
  4520. BackgroundTransparency = 1,
  4521. Name = "Arrow",
  4522. Size = UDim2.new(0,size,0,size)
  4523. })
  4524. if dir == "up" then
  4525. for i = 1,num do
  4526. local newLine = createSimple("Frame",{
  4527. BackgroundColor3 = Color3.new(220/255,220/255,220/255),
  4528. BorderSizePixel = 0,
  4529. Position = UDim2.new(0,math.floor(size/2)-(i-1),0,math.floor(size/2)+i-math.floor(max/2)-1),
  4530. Size = UDim2.new(0,i+(i-1),0,1),
  4531. Parent = arrowFrame
  4532. })
  4533. end
  4534. return arrowFrame
  4535. elseif dir == "down" then
  4536. for i = 1,num do
  4537. local newLine = createSimple("Frame",{
  4538. BackgroundColor3 = Color3.new(220/255,220/255,220/255),
  4539. BorderSizePixel = 0,
  4540. Position = UDim2.new(0,math.floor(size/2)-(i-1),0,math.floor(size/2)-i+math.floor(max/2)+1),
  4541. Size = UDim2.new(0,i+(i-1),0,1),
  4542. Parent = arrowFrame
  4543. })
  4544. end
  4545. return arrowFrame
  4546. elseif dir == "left" then
  4547. for i = 1,num do
  4548. local newLine = createSimple("Frame",{
  4549. BackgroundColor3 = Color3.new(220/255,220/255,220/255),
  4550. BorderSizePixel = 0,
  4551. Position = UDim2.new(0,math.floor(size/2)+i-math.floor(max/2)-1,0,math.floor(size/2)-(i-1)),
  4552. Size = UDim2.new(0,1,0,i+(i-1)),
  4553. Parent = arrowFrame
  4554. })
  4555. end
  4556. return arrowFrame
  4557. elseif dir == "right" then
  4558. for i = 1,num do
  4559. local newLine = createSimple("Frame",{
  4560. BackgroundColor3 = Color3.new(220/255,220/255,220/255),
  4561. BorderSizePixel = 0,
  4562. Position = UDim2.new(0,math.floor(size/2)-i+math.floor(max/2)+1,0,math.floor(size/2)-(i-1)),
  4563. Size = UDim2.new(0,1,0,i+(i-1)),
  4564. Parent = arrowFrame
  4565. })
  4566. end
  4567. return arrowFrame
  4568. end
  4569. error("r u ok")
  4570. end
  4571.  
  4572. Lib.ParseXML = (function()
  4573. local func = function()
  4574. -- Only exists to parse RMD
  4575. -- from https://github.com/jonathanpoelen/xmlparser
  4576.  
  4577. local string, print, pairs = string, print, pairs
  4578.  
  4579. -- http://lua-users.org/wiki/StringTrim
  4580. local trim = function(s)
  4581. local from = s:match"^%s*()"
  4582. return from > #s and "" or s:match(".*%S", from)
  4583. end
  4584.  
  4585. local gtchar = string.byte('>', 1)
  4586. local slashchar = string.byte('/', 1)
  4587. local D = string.byte('D', 1)
  4588. local E = string.byte('E', 1)
  4589.  
  4590. function parse(s, evalEntities)
  4591. -- remove comments
  4592. s = s:gsub('<!%-%-(.-)%-%->', '')
  4593.  
  4594. local entities, tentities = {}
  4595.  
  4596. if evalEntities then
  4597. local pos = s:find('<[_%w]')
  4598. if pos then
  4599. s:sub(1, pos):gsub('<!ENTITY%s+([_%w]+)%s+(.)(.-)%2', function(name, q, entity)
  4600. entities[#entities+1] = {name=name, value=entity}
  4601. end)
  4602. tentities = createEntityTable(entities)
  4603. s = replaceEntities(s:sub(pos), tentities)
  4604. end
  4605. end
  4606.  
  4607. local t, l = {}, {}
  4608.  
  4609. local addtext = function(txt)
  4610. txt = txt:match'^%s*(.*%S)' or ''
  4611. if #txt ~= 0 then
  4612. t[#t+1] = {text=txt}
  4613. end
  4614. end
  4615.  
  4616. s:gsub('<([?!/]?)([-:_%w]+)%s*(/?>?)([^<]*)', function(type, name, closed, txt)
  4617. -- open
  4618. if #type == 0 then
  4619. local a = {}
  4620. if #closed == 0 then
  4621. local len = 0
  4622. for all,aname,_,value,starttxt in string.gmatch(txt, "(.-([-_%w]+)%s*=%s*(.)(.-)%3%s*(/?>?))") do
  4623. len = len + #all
  4624. a[aname] = value
  4625. if #starttxt ~= 0 then
  4626. txt = txt:sub(len+1)
  4627. closed = starttxt
  4628. break
  4629. end
  4630. end
  4631. end
  4632. t[#t+1] = {tag=name, attrs=a, children={}}
  4633.  
  4634. if closed:byte(1) ~= slashchar then
  4635. l[#l+1] = t
  4636. t = t[#t].children
  4637. end
  4638.  
  4639. addtext(txt)
  4640. -- close
  4641. elseif '/' == type then
  4642. t = l[#l]
  4643. l[#l] = nil
  4644.  
  4645. addtext(txt)
  4646. -- ENTITY
  4647. elseif '!' == type then
  4648. if E == name:byte(1) then
  4649. txt:gsub('([_%w]+)%s+(.)(.-)%2', function(name, q, entity)
  4650. entities[#entities+1] = {name=name, value=entity}
  4651. end, 1)
  4652. end
  4653. -- elseif '?' == type then
  4654. -- print('? ' .. name .. ' // ' .. attrs .. '$$')
  4655. -- elseif '-' == type then
  4656. -- print('comment ' .. name .. ' // ' .. attrs .. '$$')
  4657. -- else
  4658. -- print('o ' .. #p .. ' // ' .. name .. ' // ' .. attrs .. '$$')
  4659. end
  4660. end)
  4661.  
  4662. return {children=t, entities=entities, tentities=tentities}
  4663. end
  4664.  
  4665. function parseText(txt)
  4666. return parse(txt)
  4667. end
  4668.  
  4669. function defaultEntityTable()
  4670. return { quot='"', apos='\'', lt='<', gt='>', amp='&', tab='\t', nbsp=' ', }
  4671. end
  4672.  
  4673. function replaceEntities(s, entities)
  4674. return s:gsub('&([^;]+);', entities)
  4675. end
  4676.  
  4677. function createEntityTable(docEntities, resultEntities)
  4678. entities = resultEntities or defaultEntityTable()
  4679. for _,e in pairs(docEntities) do
  4680. e.value = replaceEntities(e.value, entities)
  4681. entities[e.name] = e.value
  4682. end
  4683. return entities
  4684. end
  4685.  
  4686. return parseText
  4687. end
  4688. local newEnv = setmetatable({},{__index = getfenv()})
  4689. setfenv(func,newEnv)
  4690. return func()
  4691. end)()
  4692.  
  4693. Lib.FastWait = function(s)
  4694. if not s then return signalWait(renderStepped) end
  4695. local start = tick()
  4696. while tick() - start < s do signalWait(renderStepped) end
  4697. end
  4698.  
  4699. Lib.ButtonAnim = function(button,data)
  4700. local holding = false
  4701. local disabled = false
  4702. local mode = data and data.Mode or 1
  4703. local control = {}
  4704.  
  4705. if mode == 2 then
  4706. local lerpTo = data.LerpTo or Color3.new(0,0,0)
  4707. local delta = data.LerpDelta or 0.2
  4708. control.StartColor = data.StartColor or button.BackgroundColor3
  4709. control.PressColor = data.PressColor or control.StartColor:lerp(lerpTo,delta)
  4710. control.HoverColor = data.HoverColor or control.StartColor:lerp(control.PressColor,0.6)
  4711. control.OutlineColor = data.OutlineColor
  4712. end
  4713.  
  4714. button.InputBegan:Connect(function(input)
  4715. if disabled then return end
  4716.  
  4717. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  4718. if not holding then
  4719. if mode == 1 then
  4720. button.BackgroundTransparency = 0.4
  4721. elseif mode == 2 then
  4722. button.BackgroundColor3 = control.HoverColor
  4723. end
  4724. end
  4725. elseif input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  4726. holding = true
  4727. if mode == 1 then
  4728. button.BackgroundTransparency = 0
  4729. elseif mode == 2 then
  4730. button.BackgroundColor3 = control.PressColor
  4731. if control.OutlineColor then button.BorderColor3 = control.PressColor end
  4732. end
  4733. end
  4734. end)
  4735.  
  4736. button.InputEnded:Connect(function(input)
  4737. if disabled then return end
  4738.  
  4739. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  4740. if not holding then
  4741. if mode == 1 then
  4742. button.BackgroundTransparency = 1
  4743. elseif mode == 2 then
  4744. button.BackgroundColor3 = control.StartColor
  4745. end
  4746. end
  4747. elseif input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  4748. holding = false
  4749. if mode == 1 then
  4750. button.BackgroundTransparency = Lib.CheckMouseInGui(button) and 0.4 or 1
  4751. elseif mode == 2 then
  4752. button.BackgroundColor3 = Lib.CheckMouseInGui(button) and control.HoverColor or control.StartColor
  4753. if control.OutlineColor then button.BorderColor3 = control.OutlineColor end
  4754. end
  4755. end
  4756. end)
  4757.  
  4758. control.Disable = function()
  4759. disabled = true
  4760. holding = false
  4761.  
  4762. if mode == 1 then
  4763. button.BackgroundTransparency = 1
  4764. elseif mode == 2 then
  4765. button.BackgroundColor3 = control.StartColor
  4766. end
  4767. end
  4768.  
  4769. control.Enable = function()
  4770. disabled = false
  4771. end
  4772.  
  4773. return control
  4774. end
  4775.  
  4776. Lib.FindAndRemove = function(t,item)
  4777. local pos = table.find(t,item)
  4778. if pos then table.remove(t,pos) end
  4779. end
  4780.  
  4781. Lib.AttachTo = function(obj,data)
  4782. local target,posOffX,posOffY,sizeOffX,sizeOffY,resize,con
  4783. local disabled = false
  4784.  
  4785. local function update()
  4786. if not obj or not target then return end
  4787.  
  4788. local targetPos = target.AbsolutePosition
  4789. local targetSize = target.AbsoluteSize
  4790. obj.Position = UDim2.new(0,targetPos.X + posOffX,0,targetPos.Y + posOffY)
  4791. if resize then obj.Size = UDim2.new(0,targetSize.X + sizeOffX,0,targetSize.Y + sizeOffY) end
  4792. end
  4793.  
  4794. local function setup(o,data)
  4795. obj = o
  4796. data = data or {}
  4797. target = data.Target
  4798. posOffX = data.PosOffX or 0
  4799. posOffY = data.PosOffY or 0
  4800. sizeOffX = data.SizeOffX or 0
  4801. sizeOffY = data.SizeOffY or 0
  4802. resize = data.Resize or false
  4803.  
  4804. if con then con:Disconnect() con = nil end
  4805. if target then
  4806. con = target.Changed:Connect(function(prop)
  4807. if not disabled and prop == "AbsolutePosition" or prop == "AbsoluteSize" then
  4808. update()
  4809. end
  4810. end)
  4811. end
  4812.  
  4813. update()
  4814. end
  4815. setup(obj,data)
  4816.  
  4817. return {
  4818. SetData = function(obj,data)
  4819. setup(obj,data)
  4820. end,
  4821. Enable = function()
  4822. disabled = false
  4823. update()
  4824. end,
  4825. Disable = function()
  4826. disabled = true
  4827. end,
  4828. Destroy = function()
  4829. con:Disconnect()
  4830. con = nil
  4831. end,
  4832. }
  4833. end
  4834.  
  4835. Lib.ProtectedGuis = {}
  4836.  
  4837. Lib.ShowGui = function(gui)
  4838. if env.gethui then
  4839. gui.Parent = env.gethui()
  4840. elseif env.protectgui then
  4841. env.protectgui(gui)
  4842. gui.Parent = Main.GuiHolder
  4843. else
  4844. gui.Parent = Main.GuiHolder
  4845. end
  4846. end
  4847.  
  4848. Lib.ColorToBytes = function(col)
  4849. local round = math.round
  4850. return string.format("%d, %d, %d",round(col.r*255),round(col.g*255),round(col.b*255))
  4851. end
  4852.  
  4853. Lib.ReadFile = function(filename)
  4854. if not env.readfile then return end
  4855.  
  4856. local s,contents = pcall(env.readfile,filename)
  4857. if s and contents then return contents end
  4858. end
  4859.  
  4860. Lib.DeferFunc = function(f,...)
  4861. signalWait(renderStepped)
  4862. return f(...)
  4863. end
  4864.  
  4865. Lib.LoadCustomAsset = function(filepath)
  4866. if not env.getcustomasset or not env.isfile or not env.isfile(filepath) then return end
  4867.  
  4868. return env.getcustomasset(filepath)
  4869. end
  4870.  
  4871. Lib.FetchCustomAsset = function(url,filepath)
  4872. if not env.writefile then return end
  4873.  
  4874. local s,data = pcall(oldgame.HttpGet,game,url)
  4875. if not s then return end
  4876.  
  4877. env.writefile(filepath,data)
  4878. return Lib.LoadCustomAsset(filepath)
  4879. end
  4880.  
  4881. -- Classes
  4882.  
  4883. Lib.Signal = (function()
  4884. local funcs = {}
  4885.  
  4886. local disconnect = function(con)
  4887. local pos = table.find(con.Signal.Connections,con)
  4888. if pos then table.remove(con.Signal.Connections,pos) end
  4889. end
  4890.  
  4891. funcs.Connect = function(self,func)
  4892. if type(func) ~= "function" then error("Attempt to connect a non-function") end
  4893. local con = {
  4894. Signal = self,
  4895. Func = func,
  4896. Disconnect = disconnect
  4897. }
  4898. self.Connections[#self.Connections+1] = con
  4899. return con
  4900. end
  4901.  
  4902. funcs.Fire = function(self,...)
  4903. for i,v in next,self.Connections do
  4904. xpcall(coroutine.wrap(v.Func),function(e) warn(e.."\n"..debug.traceback()) end,...)
  4905. end
  4906. end
  4907.  
  4908. local mt = {
  4909. __index = funcs,
  4910. __tostring = function(self)
  4911. return "Signal: " .. tostring(#self.Connections) .. " Connections"
  4912. end
  4913. }
  4914.  
  4915. local function new()
  4916. local obj = {}
  4917. obj.Connections = {}
  4918.  
  4919. return setmetatable(obj,mt)
  4920. end
  4921.  
  4922. return {new = new}
  4923. end)()
  4924.  
  4925. Lib.Set = (function()
  4926. local funcs = {}
  4927.  
  4928. funcs.Add = function(self,obj)
  4929. if self.Map[obj] then return end
  4930.  
  4931. local list = self.List
  4932. list[#list+1] = obj
  4933. self.Map[obj] = true
  4934. self.Changed:Fire()
  4935. end
  4936.  
  4937. funcs.AddTable = function(self,t)
  4938. local changed
  4939. local list,map = self.List,self.Map
  4940. for i = 1,#t do
  4941. local elem = t[i]
  4942. if not map[elem] then
  4943. list[#list+1] = elem
  4944. map[elem] = true
  4945. changed = true
  4946. end
  4947. end
  4948. if changed then self.Changed:Fire() end
  4949. end
  4950.  
  4951. funcs.Remove = function(self,obj)
  4952. if not self.Map[obj] then return end
  4953.  
  4954. local list = self.List
  4955. local pos = table.find(list,obj)
  4956. if pos then table.remove(list,pos) end
  4957. self.Map[obj] = nil
  4958. self.Changed:Fire()
  4959. end
  4960.  
  4961. funcs.RemoveTable = function(self,t)
  4962. local changed
  4963. local list,map = self.List,self.Map
  4964. local removeSet = {}
  4965. for i = 1,#t do
  4966. local elem = t[i]
  4967. map[elem] = nil
  4968. removeSet[elem] = true
  4969. end
  4970.  
  4971. for i = #list,1,-1 do
  4972. local elem = list[i]
  4973. if removeSet[elem] then
  4974. table.remove(list,i)
  4975. changed = true
  4976. end
  4977. end
  4978. if changed then self.Changed:Fire() end
  4979. end
  4980.  
  4981. funcs.Set = function(self,obj)
  4982. if #self.List == 1 and self.List[1] == obj then return end
  4983.  
  4984. self.List = {obj}
  4985. self.Map = {[obj] = true}
  4986. self.Changed:Fire()
  4987. end
  4988.  
  4989. funcs.SetTable = function(self,t)
  4990. local newList,newMap = {},{}
  4991. self.List,self.Map = newList,newMap
  4992. table.move(t,1,#t,1,newList)
  4993. for i = 1,#t do
  4994. newMap[t[i]] = true
  4995. end
  4996. self.Changed:Fire()
  4997. end
  4998.  
  4999. funcs.Clear = function(self)
  5000. if #self.List == 0 then return end
  5001. self.List = {}
  5002. self.Map = {}
  5003. self.Changed:Fire()
  5004. end
  5005.  
  5006. local mt = {__index = funcs}
  5007.  
  5008. local function new()
  5009. local obj = setmetatable({
  5010. List = {},
  5011. Map = {},
  5012. Changed = Lib.Signal.new()
  5013. },mt)
  5014.  
  5015. return obj
  5016. end
  5017.  
  5018. return {new = new}
  5019. end)()
  5020.  
  5021. Lib.IconMap = (function()
  5022. local funcs = {}
  5023. local _MapId, _Icons = (483448923), {
  5024. ["Accessory"] = 32;
  5025. ["Accoutrement"] = 32;
  5026. ["AdService"] = 73;
  5027. ["Animation"] = 60;
  5028. ["AnimationController"] = 60;
  5029. ["AnimationTrack"] = 60;
  5030. ["Animator"] = 60;
  5031. ["ArcHandles"] = 56;
  5032. ["AssetService"] = 72;
  5033. ["Attachment"] = 34;
  5034. ["Backpack"] = 20;
  5035. ["BadgeService"] = 75;
  5036. ["BallSocketConstraint"] = 89;
  5037. ["BillboardGui"] = 64;
  5038. ["BinaryStringValue"] = 4;
  5039. ["BindableEvent"] = 67;
  5040. ["BindableFunction"] = 66;
  5041. ["BlockMesh"] = 8;
  5042. ["BloomEffect"] = 90;
  5043. ["BlurEffect"] = 90;
  5044. ["BodyAngularVelocity"] = 14;
  5045. ["BodyForce"] = 14;
  5046. ["BodyGyro"] = 14;
  5047. ["BodyPosition"] = 14;
  5048. ["BodyThrust"] = 14;
  5049. ["BodyVelocity"] = 14;
  5050. ["BoolValue"] = 4;
  5051. ["BoxHandleAdornment"] = 54;
  5052. ["BrickColorValue"] = 4;
  5053. ["Camera"] = 5;
  5054. ["CFrameValue"] = 4;
  5055. ["CharacterMesh"] = 60;
  5056. ["Chat"] = 33;
  5057. ["ClickDetector"] = 41;
  5058. ["CollectionService"] = 30;
  5059. ["Color3Value"] = 4;
  5060. ["ColorCorrectionEffect"] = 90;
  5061. ["ConeHandleAdornment"] = 54;
  5062. ["Configuration"] = 58;
  5063. ["ContentProvider"] = 72;
  5064. ["ContextActionService"] = 41;
  5065. ["CoreGui"] = 46;
  5066. ["CoreScript"] = 18;
  5067. ["CornerWedgePart"] = 1;
  5068. ["CustomEvent"] = 4;
  5069. ["CustomEventReceiver"] = 4;
  5070. ["CylinderHandleAdornment"] = 54;
  5071. ["CylinderMesh"] = 8;
  5072. ["CylindricalConstraint"] = 89;
  5073. ["Debris"] = 30;
  5074. ["Decal"] = 7;
  5075. ["Dialog"] = 62;
  5076. ["DialogChoice"] = 63;
  5077. ["DoubleConstrainedValue"] = 4;
  5078. ["Explosion"] = 36;
  5079. ["FileMesh"] = 8;
  5080. ["Fire"] = 61;
  5081. ["Flag"] = 38;
  5082. ["FlagStand"] = 39;
  5083. ["FloorWire"] = 4;
  5084. ["Folder"] = 70;
  5085. ["ForceField"] = 37;
  5086. ["Frame"] = 48;
  5087. ["GamePassService"] = 19;
  5088. ["Glue"] = 34;
  5089. ["GuiButton"] = 52;
  5090. ["GuiMain"] = 47;
  5091. ["GuiService"] = 47;
  5092. ["Handles"] = 53;
  5093. ["HapticService"] = 84;
  5094. ["Hat"] = 45;
  5095. ["HingeConstraint"] = 89;
  5096. ["Hint"] = 33;
  5097. ["HopperBin"] = 22;
  5098. ["HttpService"] = 76;
  5099. ["Humanoid"] = 9;
  5100. ["ImageButton"] = 52;
  5101. ["ImageLabel"] = 49;
  5102. ["InsertService"] = 72;
  5103. ["IntConstrainedValue"] = 4;
  5104. ["IntValue"] = 4;
  5105. ["JointInstance"] = 34;
  5106. ["JointsService"] = 34;
  5107. ["Keyframe"] = 60;
  5108. ["KeyframeSequence"] = 60;
  5109. ["KeyframeSequenceProvider"] = 60;
  5110. ["Lighting"] = 13;
  5111. ["LineHandleAdornment"] = 54;
  5112. ["LocalScript"] = 18;
  5113. ["LogService"] = 87;
  5114. ["MarketplaceService"] = 46;
  5115. ["Message"] = 33;
  5116. ["Model"] = 2;
  5117. ["ModuleScript"] = 71;
  5118. ["Motor"] = 34;
  5119. ["Motor6D"] = 34;
  5120. ["MoveToConstraint"] = 89;
  5121. ["NegateOperation"] = 78;
  5122. ["NetworkClient"] = 16;
  5123. ["NetworkReplicator"] = 29;
  5124. ["NetworkServer"] = 15;
  5125. ["NumberValue"] = 4;
  5126. ["ObjectValue"] = 4;
  5127. ["Pants"] = 44;
  5128. ["ParallelRampPart"] = 1;
  5129. ["Part"] = 1;
  5130. ["ParticleEmitter"] = 69;
  5131. ["PartPairLasso"] = 57;
  5132. ["PathfindingService"] = 37;
  5133. ["Platform"] = 35;
  5134. ["Player"] = 12;
  5135. ["PlayerGui"] = 46;
  5136. ["Players"] = 21;
  5137. ["PlayerScripts"] = 82;
  5138. ["PointLight"] = 13;
  5139. ["PointsService"] = 83;
  5140. ["Pose"] = 60;
  5141. ["PrismaticConstraint"] = 89;
  5142. ["PrismPart"] = 1;
  5143. ["PyramidPart"] = 1;
  5144. ["RayValue"] = 4;
  5145. ["ReflectionMetadata"] = 86;
  5146. ["ReflectionMetadataCallbacks"] = 86;
  5147. ["ReflectionMetadataClass"] = 86;
  5148. ["ReflectionMetadataClasses"] = 86;
  5149. ["ReflectionMetadataEnum"] = 86;
  5150. ["ReflectionMetadataEnumItem"] = 86;
  5151. ["ReflectionMetadataEnums"] = 86;
  5152. ["ReflectionMetadataEvents"] = 86;
  5153. ["ReflectionMetadataFunctions"] = 86;
  5154. ["ReflectionMetadataMember"] = 86;
  5155. ["ReflectionMetadataProperties"] = 86;
  5156. ["ReflectionMetadataYieldFunctions"] = 86;
  5157. ["RemoteEvent"] = 80;
  5158. ["RemoteFunction"] = 79;
  5159. ["ReplicatedFirst"] = 72;
  5160. ["ReplicatedStorage"] = 72;
  5161. ["RightAngleRampPart"] = 1;
  5162. ["RocketPropulsion"] = 14;
  5163. ["RodConstraint"] = 89;
  5164. ["RopeConstraint"] = 89;
  5165. ["Rotate"] = 34;
  5166. ["RotateP"] = 34;
  5167. ["RotateV"] = 34;
  5168. ["RunService"] = 66;
  5169. ["ScreenGui"] = 47;
  5170. ["Script"] = 6;
  5171. ["ScrollingFrame"] = 48;
  5172. ["Seat"] = 35;
  5173. ["Selection"] = 55;
  5174. ["SelectionBox"] = 54;
  5175. ["SelectionPartLasso"] = 57;
  5176. ["SelectionPointLasso"] = 57;
  5177. ["SelectionSphere"] = 54;
  5178. ["ServerScriptService"] = 0;
  5179. ["ServerStorage"] = 74;
  5180. ["Shirt"] = 43;
  5181. ["ShirtGraphic"] = 40;
  5182. ["SkateboardPlatform"] = 35;
  5183. ["Sky"] = 28;
  5184. ["SlidingBallConstraint"] = 89;
  5185. ["Smoke"] = 59;
  5186. ["Snap"] = 34;
  5187. ["Sound"] = 11;
  5188. ["SoundService"] = 31;
  5189. ["Sparkles"] = 42;
  5190. ["SpawnLocation"] = 25;
  5191. ["SpecialMesh"] = 8;
  5192. ["SphereHandleAdornment"] = 54;
  5193. ["SpotLight"] = 13;
  5194. ["SpringConstraint"] = 89;
  5195. ["StarterCharacterScripts"] = 82;
  5196. ["StarterGear"] = 20;
  5197. ["StarterGui"] = 46;
  5198. ["StarterPack"] = 20;
  5199. ["StarterPlayer"] = 88;
  5200. ["StarterPlayerScripts"] = 82;
  5201. ["Status"] = 2;
  5202. ["StringValue"] = 4;
  5203. ["SunRaysEffect"] = 90;
  5204. ["SurfaceGui"] = 64;
  5205. ["SurfaceLight"] = 13;
  5206. ["SurfaceSelection"] = 55;
  5207. ["Team"] = 24;
  5208. ["Teams"] = 23;
  5209. ["TeleportService"] = 81;
  5210. ["Terrain"] = 65;
  5211. ["TerrainRegion"] = 65;
  5212. ["TestService"] = 68;
  5213. ["TextBox"] = 51;
  5214. ["TextButton"] = 51;
  5215. ["TextLabel"] = 50;
  5216. ["Texture"] = 10;
  5217. ["TextureTrail"] = 4;
  5218. ["Tool"] = 17;
  5219. ["TouchTransmitter"] = 37;
  5220. ["TrussPart"] = 1;
  5221. ["UnionOperation"] = 77;
  5222. ["UserInputService"] = 84;
  5223. ["Vector3Value"] = 4;
  5224. ["VehicleSeat"] = 35;
  5225. ["VelocityMotor"] = 34;
  5226. ["WedgePart"] = 1;
  5227. ["Weld"] = 34;
  5228. ["Workspace"] = 19;
  5229.  
  5230. }
  5231. funcs.ExplorerIcons = { ["MapId"] = _MapId, ["Icons"] = _Icons }
  5232.  
  5233. funcs.GetLabel = function(self)
  5234. local label = Instance.new("ImageLabel")
  5235. self:SetupLabel(label)
  5236. return label
  5237. end
  5238.  
  5239. funcs.SetupLabel = function(self,obj)
  5240. obj.BackgroundTransparency = 1
  5241. obj.ImageRectOffset = Vector2.new(0, 0)
  5242. obj.ImageRectSize = Vector2.new(self.IconSizeX, self.IconSizeY)
  5243. obj.ScaleType = Enum.ScaleType.Crop
  5244. obj.Size = UDim2.new(0, self.IconSizeX, 0, self.IconSizeY)
  5245. end
  5246.  
  5247. funcs.Display = function(self,obj,index)
  5248. obj.Image = self.MapId
  5249. if not self.NumX then
  5250. obj.ImageRectOffset = Vector2.new(self.IconSizeX*index, 0)
  5251. else
  5252. obj.ImageRectOffset = Vector2.new(self.IconSizeX*(index % self.NumX), self.IconSizeY*math.floor(index / self.NumX))
  5253. end
  5254. end
  5255.  
  5256. funcs.DisplayByKey = function(self, obj, key)
  5257. if self.IndexDict[key] then
  5258. self:Display(obj, self.IndexDict[key])
  5259. else
  5260. local rmdEntry = RMD.Classes[obj.ClassName]
  5261. Explorer.ClassIcons:Display(obj, rmdEntry and rmdEntry.ExplorerImageIndex or 0)
  5262. end
  5263. end
  5264.  
  5265. funcs.IconDehash = function(self, _id)
  5266. return math.floor(_id / 14 % 14), math.floor(_id % 14)
  5267. end
  5268.  
  5269. funcs.GetExplorerIcon = function(self, obj, index)
  5270. index = (self.ExplorerIcons.Icons[index] or 0)
  5271. local row, col = self:IconDehash(index)
  5272. local MapSize = Vector2.new(256, 256)
  5273. local pad, border = 2, 1
  5274. local IconSize = 16
  5275.  
  5276. obj.Position = UDim2.new(-col - (pad * (col + 1) + border) / IconSize, 0, -row - (pad * (row + 1) + border) / IconSize, 0)
  5277. obj.Size = UDim2.new(MapSize.X / IconSize, 0, MapSize.Y / IconSize, 0)
  5278. end
  5279.  
  5280. funcs.DisplayExplorerIcons = function(self, Frame, index)
  5281. if Frame:FindFirstChild("IconMap") then
  5282. self:GetExplorerIcon(Frame.IconMap, index)
  5283. else
  5284. Frame.ClipsDescendants = true
  5285.  
  5286. local obj = Instance.new("ImageLabel", Frame)
  5287. obj.BackgroundTransparency = 1
  5288. obj.Image = ("http://www.roblox.com/asset/?id=" .. (self.ExplorerIcons.MapId))
  5289. obj.Name = "IconMap"
  5290. self:GetExplorerIcon(obj, index)
  5291. end
  5292. end
  5293.  
  5294. funcs.SetDict = function(self,dict)
  5295. self.IndexDict = dict
  5296. end
  5297.  
  5298. local mt = {}
  5299. mt.__index = funcs
  5300.  
  5301. local function new(mapId,mapSizeX,mapSizeY,iconSizeX,iconSizeY)
  5302. local obj = setmetatable({
  5303. MapId = mapId,
  5304. MapSizeX = mapSizeX,
  5305. MapSizeY = mapSizeY,
  5306. IconSizeX = iconSizeX,
  5307. IconSizeY = iconSizeY,
  5308. NumX = mapSizeX/iconSizeX,
  5309. IndexDict = {}
  5310. }, mt)
  5311. return obj
  5312. end
  5313.  
  5314. local function newLinear(mapId,iconSizeX,iconSizeY)
  5315. local obj = setmetatable({
  5316. MapId = mapId,
  5317. IconSizeX = iconSizeX,
  5318. IconSizeY = iconSizeY,
  5319. IndexDict = {}
  5320. },mt)
  5321. return obj
  5322. end
  5323.  
  5324. return {new = new, newLinear = newLinear}
  5325. end)()
  5326.  
  5327. Lib.ScrollBar = (function()
  5328. local funcs = {}
  5329. local user = service.UserInputService
  5330. local mouse = plr:GetMouse()
  5331. local checkMouseInGui = Lib.CheckMouseInGui
  5332. local createArrow = Lib.CreateArrow
  5333.  
  5334. local function drawThumb(self)
  5335. local total = self.TotalSpace
  5336. local visible = self.VisibleSpace
  5337. local index = self.Index
  5338. local scrollThumb = self.GuiElems.ScrollThumb
  5339. local scrollThumbFrame = self.GuiElems.ScrollThumbFrame
  5340.  
  5341. if not (self:CanScrollUp() or self:CanScrollDown()) then
  5342. scrollThumb.Visible = false
  5343. else
  5344. scrollThumb.Visible = true
  5345. end
  5346.  
  5347. if self.Horizontal then
  5348. scrollThumb.Size = UDim2.new(visible/total,0,1,0)
  5349. if scrollThumb.AbsoluteSize.X < 16 then
  5350. scrollThumb.Size = UDim2.new(0,16,1,0)
  5351. end
  5352. local fs = scrollThumbFrame.AbsoluteSize.X
  5353. local bs = scrollThumb.AbsoluteSize.X
  5354. scrollThumb.Position = UDim2.new(self:GetScrollPercent()*(fs-bs)/fs,0,0,0)
  5355. else
  5356. scrollThumb.Size = UDim2.new(1,0,visible/total,0)
  5357. if scrollThumb.AbsoluteSize.Y < 16 then
  5358. scrollThumb.Size = UDim2.new(1,0,0,16)
  5359. end
  5360. local fs = scrollThumbFrame.AbsoluteSize.Y
  5361. local bs = scrollThumb.AbsoluteSize.Y
  5362. scrollThumb.Position = UDim2.new(0,0,self:GetScrollPercent()*(fs-bs)/fs,0)
  5363. end
  5364. end
  5365.  
  5366. local function createFrame(self)
  5367. local newFrame = createSimple("Frame",{Style=0,Active=true,AnchorPoint=Vector2.new(0,0),BackgroundColor3=Color3.new(0.35294118523598,0.35294118523598,0.35294118523598),BackgroundTransparency=0,BorderColor3=Color3.new(0.10588236153126,0.16470588743687,0.20784315466881),BorderSizePixel=0,ClipsDescendants=false,Draggable=false,Position=UDim2.new(1,-16,0,0),Rotation=0,Selectable=false,Size=UDim2.new(0,16,1,0),SizeConstraint=0,Visible=true,ZIndex=1,Name="ScrollBar",})
  5368. local button1, button2
  5369.  
  5370. if self.Horizontal then
  5371. newFrame.Size = UDim2.new(1,0,0,16)
  5372. button1 = createSimple("ImageButton",{
  5373. Parent = newFrame,
  5374. Name = "Left",
  5375. Size = UDim2.new(0,16,0,16),
  5376. BackgroundTransparency = 1,
  5377. BorderSizePixel = 0,
  5378. AutoButtonColor = false
  5379. })
  5380. createArrow(16,4,"left").Parent = button1
  5381. button2 = createSimple("ImageButton",{
  5382. Parent = newFrame,
  5383. Name = "Right",
  5384. Position = UDim2.new(1,-16,0,0),
  5385. Size = UDim2.new(0,16,0,16),
  5386. BackgroundTransparency = 1,
  5387. BorderSizePixel = 0,
  5388. AutoButtonColor = false
  5389. })
  5390. createArrow(16,4,"right").Parent = button2
  5391. else
  5392. newFrame.Size = UDim2.new(0,16,1,0)
  5393. button1 = createSimple("ImageButton",{
  5394. Parent = newFrame,
  5395. Name = "Up",
  5396. Size = UDim2.new(0,16,0,16),
  5397. BackgroundTransparency = 1,
  5398. BorderSizePixel = 0,
  5399. AutoButtonColor = false
  5400. })
  5401. createArrow(16,4,"up").Parent = button1
  5402. button2 = createSimple("ImageButton",{
  5403. Parent = newFrame,
  5404. Name = "Down",
  5405. Position = UDim2.new(0,0,1,-16),
  5406. Size = UDim2.new(0,16,0,16),
  5407. BackgroundTransparency = 1,
  5408. BorderSizePixel = 0,
  5409. AutoButtonColor = false
  5410. })
  5411. createArrow(16,4,"down").Parent = button2
  5412. end
  5413.  
  5414. local scrollThumbFrame = createSimple("ImageButton", {
  5415. BackgroundTransparency = 1,
  5416. Parent = newFrame
  5417. })
  5418. if self.Horizontal then
  5419. scrollThumbFrame.Position = UDim2.new(0,16,0,0)
  5420. scrollThumbFrame.Size = UDim2.new(1,-32,1,0)
  5421. else
  5422. scrollThumbFrame.Position = UDim2.new(0,0,0,16)
  5423. scrollThumbFrame.Size = UDim2.new(1,0,1,-32)
  5424. end
  5425.  
  5426. local scrollThumb = createSimple("Frame", {
  5427. BackgroundColor3 = Color3.new(120/255, 120/255, 120/255),
  5428. BorderSizePixel = 0,
  5429. Parent = scrollThumbFrame
  5430. })
  5431.  
  5432. local markerFrame = createSimple("Frame", {
  5433. BackgroundTransparency = 1,
  5434. Name = "Markers",
  5435. Size = UDim2.new(1, 0, 1, 0),
  5436. Parent = scrollThumbFrame
  5437. })
  5438.  
  5439. local buttonPress = false
  5440. local thumbPress = false
  5441. local thumbFramePress = false
  5442.  
  5443. local function handleButtonPress(button, scrollDirection)
  5444. if self:CanScroll(scrollDirection) then
  5445. button.BackgroundTransparency = 0.5
  5446. self:ScrollToDirection(scrollDirection)
  5447. self.Scrolled:Fire()
  5448. local buttonTick = tick()
  5449. local releaseEvent
  5450. releaseEvent = user.InputEnded:Connect(function(input)
  5451. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  5452. releaseEvent:Disconnect()
  5453. button.BackgroundTransparency = checkMouseInGui(button) and 0.8 or 1
  5454. buttonPress = false
  5455. end
  5456. end)
  5457. while buttonPress do
  5458. if tick() - buttonTick >= 0.25 and self:CanScroll(scrollDirection) then
  5459. self:ScrollToDirection(scrollDirection)
  5460. self.Scrolled:Fire()
  5461. end
  5462. task.wait()
  5463. end
  5464. end
  5465. end
  5466.  
  5467. button1.MouseButton1Down:Connect(function(input)
  5468. buttonPress = true
  5469. handleButtonPress(button1, "Up")
  5470. end)
  5471.  
  5472. button1.InputEnded:Connect(function(input)
  5473. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  5474. button1.BackgroundTransparency = 1
  5475. end
  5476. end)
  5477.  
  5478. button2.MouseButton1Down:Connect(function(input)
  5479. buttonPress = true
  5480. handleButtonPress(button2, "Down")
  5481. end)
  5482.  
  5483. button2.InputEnded:Connect(function(input)
  5484. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  5485. button2.BackgroundTransparency = 1
  5486. end
  5487. end)
  5488.  
  5489. scrollThumb.InputBegan:Connect(function(input)
  5490. if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
  5491. local dir = self.Horizontal and "X" or "Y"
  5492. local lastThumbPos = nil
  5493. thumbPress = true
  5494. scrollThumb.BackgroundTransparency = 0
  5495. local mouseOffset = mouse[dir] - scrollThumb.AbsolutePosition[dir]
  5496. local releaseEvent
  5497. local mouseEvent
  5498.  
  5499. releaseEvent = user.InputEnded:Connect(function(input)
  5500. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  5501. releaseEvent:Disconnect()
  5502. if mouseEvent then mouseEvent:Disconnect() end
  5503. scrollThumb.BackgroundTransparency = 0.2
  5504. thumbPress = false
  5505. end
  5506. end)
  5507.  
  5508. mouseEvent = user.InputChanged:Connect(function(input)
  5509. if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and thumbPress then
  5510. local thumbFrameSize = scrollThumbFrame.AbsoluteSize[dir] - scrollThumb.AbsoluteSize[dir]
  5511. local pos = mouse[dir] - scrollThumbFrame.AbsolutePosition[dir] - mouseOffset
  5512. if pos > thumbFrameSize then pos = thumbFrameSize
  5513. elseif pos < 0 then pos = 0 end
  5514. if lastThumbPos ~= pos then
  5515. lastThumbPos = pos
  5516. self:ScrollTo(math.floor(0.5 + pos / thumbFrameSize * (self.TotalSpace - self.VisibleSpace)))
  5517. end
  5518. end
  5519. end)
  5520. end
  5521. end)
  5522.  
  5523. scrollThumb.InputEnded:Connect(function(input)
  5524. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  5525. scrollThumb.BackgroundTransparency = 0
  5526. end
  5527. end)
  5528.  
  5529. scrollThumbFrame.InputBegan:Connect(function(input)
  5530. if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and not checkMouseInGui(scrollThumb) then
  5531. local dir = self.Horizontal and "X" or "Y"
  5532. local scrollDir = (mouse[dir] >= scrollThumb.AbsolutePosition[dir] + scrollThumb.AbsoluteSize[dir]) and 1 or 0
  5533. local function doTick()
  5534. local scrollSize = self.VisibleSpace - 1
  5535. if scrollDir == 0 and mouse[dir] < scrollThumb.AbsolutePosition[dir] then
  5536. self:ScrollTo(self.Index - scrollSize)
  5537. elseif scrollDir == 1 and mouse[dir] >= scrollThumb.AbsolutePosition[dir] + scrollThumb.AbsoluteSize[dir] then
  5538. self:ScrollTo(self.Index + scrollSize)
  5539. end
  5540. end
  5541.  
  5542. thumbPress = false
  5543. thumbFramePress = true
  5544. doTick()
  5545. local thumbFrameTick = tick()
  5546. local releaseEvent
  5547. releaseEvent = user.InputEnded:Connect(function(input)
  5548. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  5549. releaseEvent:Disconnect()
  5550. thumbFramePress = false
  5551. end
  5552. end)
  5553.  
  5554. while thumbFramePress do
  5555. if tick() - thumbFrameTick >= 0.3 and checkMouseInGui(scrollThumbFrame) then
  5556. doTick()
  5557. end
  5558. task.wait()
  5559. end
  5560. end
  5561. end)
  5562.  
  5563. newFrame.MouseWheelForward:Connect(function()
  5564. self:ScrollTo(self.Index - self.WheelIncrement)
  5565. end)
  5566.  
  5567. newFrame.MouseWheelBackward:Connect(function()
  5568. self:ScrollTo(self.Index + self.WheelIncrement)
  5569. end)
  5570.  
  5571. self.GuiElems.ScrollThumb = scrollThumb
  5572. self.GuiElems.ScrollThumbFrame = scrollThumbFrame
  5573. self.GuiElems.Button1 = button1
  5574. self.GuiElems.Button2 = button2
  5575. self.GuiElems.MarkerFrame = markerFrame
  5576.  
  5577. return newFrame
  5578. end
  5579.  
  5580. funcs.Update = function(self,nocallback)
  5581. local total = self.TotalSpace
  5582. local visible = self.VisibleSpace
  5583. local index = self.Index
  5584. local button1 = self.GuiElems.Button1
  5585. local button2 = self.GuiElems.Button2
  5586.  
  5587. self.Index = math.clamp(self.Index, 0, math.max(0, total - visible))
  5588.  
  5589. if self.LastTotalSpace ~= self.TotalSpace then
  5590. self.LastTotalSpace = self.TotalSpace
  5591. self:UpdateMarkers()
  5592. end
  5593.  
  5594. if self:CanScrollUp() then
  5595. for i,v in pairs(button1.Arrow:GetChildren()) do
  5596. v.BackgroundTransparency = 0
  5597. end
  5598. else
  5599. button1.BackgroundTransparency = 1
  5600. for i,v in pairs(button1.Arrow:GetChildren()) do
  5601. v.BackgroundTransparency = 0.5
  5602. end
  5603. end
  5604. if self:CanScrollDown() then
  5605. for i,v in pairs(button2.Arrow:GetChildren()) do
  5606. v.BackgroundTransparency = 0
  5607. end
  5608. else
  5609. button2.BackgroundTransparency = 1
  5610. for i,v in pairs(button2.Arrow:GetChildren()) do
  5611. v.BackgroundTransparency = 0.5
  5612. end
  5613. end
  5614.  
  5615. drawThumb(self)
  5616. end
  5617.  
  5618. funcs.UpdateMarkers = function(self)
  5619. local markerFrame = self.GuiElems.MarkerFrame
  5620. markerFrame:ClearAllChildren()
  5621.  
  5622. for i,v in pairs(self.Markers) do
  5623. if i < self.TotalSpace then
  5624. createSimple("Frame", {
  5625. BackgroundTransparency = 0,
  5626. BackgroundColor3 = v,
  5627. BorderSizePixel = 0,
  5628. Position = self.Horizontal and UDim2.new(i/self.TotalSpace,0,1,-6) or UDim2.new(1,-6,i/self.TotalSpace,0),
  5629. Size = self.Horizontal and UDim2.new(0,1,0,6) or UDim2.new(0,6,0,1),
  5630. Name = "Marker"..tostring(i),
  5631. Parent = markerFrame
  5632. })
  5633. end
  5634. end
  5635. end
  5636.  
  5637. funcs.AddMarker = function(self,ind,color)
  5638. self.Markers[ind] = color or Color3.new(0,0,0)
  5639. end
  5640. funcs.ScrollTo = function(self, ind, nocallback)
  5641. self.Index = ind
  5642. self:Update()
  5643. if not nocallback then
  5644. self.Scrolled:Fire()
  5645. end
  5646. end
  5647. funcs.ScrollUp = function(self)
  5648. self.Index = self.Index - self.Increment
  5649. self:Update()
  5650. end
  5651. funcs.CanScroll = function(self, direction)
  5652. if direction == "Up" then
  5653. return self:CanScrollUp()
  5654. elseif direction == "Down" then
  5655. return self:CanScrollDown()
  5656. end
  5657. return false
  5658. end
  5659. funcs.ScrollDown = function(self)
  5660. self.Index = self.Index + self.Increment
  5661. self:Update()
  5662. end
  5663. funcs.CanScrollUp = function(self)
  5664. return self.Index > 0
  5665. end
  5666. funcs.CanScrollDown = function(self)
  5667. return self.Index + self.VisibleSpace < self.TotalSpace
  5668. end
  5669. funcs.GetScrollPercent = function(self)
  5670. return self.Index/(self.TotalSpace-self.VisibleSpace)
  5671. end
  5672. funcs.SetScrollPercent = function(self,perc)
  5673. self.Index = math.floor(perc*(self.TotalSpace-self.VisibleSpace))
  5674. self:Update()
  5675. end
  5676. funcs.ScrollToDirection = function(self, Direaction)
  5677. if Direaction == "Up" then
  5678. self:ScrollUp()
  5679. elseif Direaction == "Down" then
  5680. self:ScrollDown()
  5681. end
  5682. end
  5683.  
  5684. funcs.Texture = function(self,data)
  5685. self.ThumbColor = data.ThumbColor or Color3.new(0,0,0)
  5686. self.ThumbSelectColor = data.ThumbSelectColor or Color3.new(0,0,0)
  5687. self.GuiElems.ScrollThumb.BackgroundColor3 = data.ThumbColor or Color3.new(0,0,0)
  5688. self.Gui.BackgroundColor3 = data.FrameColor or Color3.new(0,0,0)
  5689. self.GuiElems.Button1.BackgroundColor3 = data.ButtonColor or Color3.new(0,0,0)
  5690. self.GuiElems.Button2.BackgroundColor3 = data.ButtonColor or Color3.new(0,0,0)
  5691. for i,v in pairs(self.GuiElems.Button1.Arrow:GetChildren()) do
  5692. v.BackgroundColor3 = data.ArrowColor or Color3.new(0,0,0)
  5693. end
  5694. for i,v in pairs(self.GuiElems.Button2.Arrow:GetChildren()) do
  5695. v.BackgroundColor3 = data.ArrowColor or Color3.new(0,0,0)
  5696. end
  5697. end
  5698.  
  5699. funcs.SetScrollFrame = function(self,frame)
  5700. if self.ScrollUpEvent then self.ScrollUpEvent:Disconnect() self.ScrollUpEvent = nil end
  5701. if self.ScrollDownEvent then self.ScrollDownEvent:Disconnect() self.ScrollDownEvent = nil end
  5702. self.ScrollUpEvent = frame.MouseWheelForward:Connect(function() self:ScrollTo(self.Index - self.WheelIncrement) end)
  5703. self.ScrollDownEvent = frame.MouseWheelBackward:Connect(function() self:ScrollTo(self.Index + self.WheelIncrement) end)
  5704. end
  5705.  
  5706. local mt = {}
  5707. mt.__index = funcs
  5708.  
  5709. local function new(hor)
  5710. local obj = setmetatable({
  5711. Index = 0,
  5712. VisibleSpace = 0,
  5713. TotalSpace = 0,
  5714. Increment = 1,
  5715. WheelIncrement = 1,
  5716. Markers = {},
  5717. GuiElems = {},
  5718. Horizontal = hor,
  5719. LastTotalSpace = 0,
  5720. Scrolled = Lib.Signal.new()
  5721. },mt)
  5722. obj.Gui = createFrame(obj)
  5723. obj:Texture({
  5724. ThumbColor = Color3.fromRGB(60,60,60),
  5725. ThumbSelectColor = Color3.fromRGB(75,75,75),
  5726. ArrowColor = Color3.new(1,1,1),
  5727. FrameColor = Color3.fromRGB(40,40,40),
  5728. ButtonColor = Color3.fromRGB(75,75,75)
  5729. })
  5730. return obj
  5731. end
  5732.  
  5733. return {new = new}
  5734. end)()
  5735.  
  5736. Lib.Window = (function()
  5737. local funcs = {}
  5738. local static = {MinWidth = 200, FreeWidth = 200}
  5739. local mouse = plr:GetMouse()
  5740. local sidesGui, alignIndicator
  5741. local visibleWindows = {}
  5742. local leftSide = {Width = 300, Windows = {}, ResizeCons = {}, Hidden = true}
  5743. local rightSide = {Width = 300, Windows = {}, ResizeCons = {}, Hidden = true}
  5744.  
  5745. local displayOrderStart
  5746. local sideDisplayOrder
  5747. local sideTweenInfo = TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
  5748. local tweens = {}
  5749. local isA = game.IsA
  5750.  
  5751. local theme = {
  5752. MainColor1 = Color3.fromRGB(52,52,52),
  5753. MainColor2 = Color3.fromRGB(45,45,45),
  5754. Button = Color3.fromRGB(60,60,60)
  5755. }
  5756.  
  5757. local function stopTweens()
  5758. for i = 1,#tweens do
  5759. tweens[i]:Cancel()
  5760. end
  5761. tweens = {}
  5762. end
  5763.  
  5764. local function resizeHook(self,resizer,dir)
  5765. local guiMain = self.GuiElems.Main
  5766. resizer.InputBegan:Connect(function(input)
  5767. if not self.Dragging and not self.Resizing and self.Resizable and self.ResizableInternal then
  5768. local isH = dir:find("[WE]") and true
  5769. local isV = dir:find("[NS]") and true
  5770. local signX = dir:find("W",1,true) and -1 or 1
  5771. local signY = dir:find("N",1,true) and -1 or 1
  5772.  
  5773. if self.Minimized and isV then return end
  5774.  
  5775. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  5776. resizer.BackgroundTransparency = 0.5
  5777. elseif input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  5778. local releaseEvent, mouseEvent
  5779.  
  5780. local offX = input.Position.X - resizer.AbsolutePosition.X
  5781. local offY = input.Position.Y - resizer.AbsolutePosition.Y
  5782.  
  5783. self.Resizing = resizer
  5784. resizer.BackgroundTransparency = 1
  5785.  
  5786. releaseEvent = service.UserInputService.InputEnded:Connect(function(input)
  5787. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  5788. releaseEvent:Disconnect()
  5789. if mouseEvent then mouseEvent:Disconnect() end
  5790. self.Resizing = false
  5791. resizer.BackgroundTransparency = 1
  5792. end
  5793. end)
  5794.  
  5795. mouseEvent = service.UserInputService.InputChanged:Connect(function(input)
  5796. if self.Resizable and self.ResizableInternal and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
  5797. self:StopTweens()
  5798. local deltaX = input.Position.X - resizer.AbsolutePosition.X - offX
  5799. local deltaY = input.Position.Y - resizer.AbsolutePosition.Y - offY
  5800.  
  5801. if guiMain.AbsoluteSize.X + deltaX * signX < self.MinX then deltaX = signX * (self.MinX - guiMain.AbsoluteSize.X) end
  5802. if guiMain.AbsoluteSize.Y + deltaY * signY < self.MinY then deltaY = signY * (self.MinY - guiMain.AbsoluteSize.Y) end
  5803. if signY < 0 and guiMain.AbsolutePosition.Y + deltaY < 0 then deltaY = -guiMain.AbsolutePosition.Y end
  5804.  
  5805. guiMain.Position = guiMain.Position + UDim2.new(0, (signX < 0 and deltaX or 0), 0, (signY < 0 and deltaY or 0))
  5806. self.SizeX = self.SizeX + (isH and deltaX * signX or 0)
  5807. self.SizeY = self.SizeY + (isV and deltaY * signY or 0)
  5808. guiMain.Size = UDim2.new(0, self.SizeX, 0, self.Minimized and 20 or self.SizeY)
  5809. end
  5810. end)
  5811. end
  5812. end
  5813. end)
  5814.  
  5815. resizer.InputEnded:Connect(function(input)
  5816. if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and self.Resizing ~= resizer then
  5817. resizer.BackgroundTransparency = 1
  5818. end
  5819. end)
  5820. end
  5821.  
  5822. local updateWindows
  5823.  
  5824. local function moveToTop(window)
  5825. local found = table.find(visibleWindows,window)
  5826. if found then
  5827. table.remove(visibleWindows,found)
  5828. table.insert(visibleWindows,1,window)
  5829. updateWindows()
  5830. end
  5831. end
  5832.  
  5833. local function sideHasRoom(side,neededSize)
  5834. local maxY = sidesGui.AbsoluteSize.Y - (math.max(0,#side.Windows - 1) * 4)
  5835. local inc = 0
  5836. for i,v in pairs(side.Windows) do
  5837. inc = inc + (v.MinY or 100)
  5838. if inc > maxY - neededSize then return false end
  5839. end
  5840.  
  5841. return true
  5842. end
  5843.  
  5844. local function getSideInsertPos(side,curY)
  5845. local pos = #side.Windows + 1
  5846. local range = {0,sidesGui.AbsoluteSize.Y}
  5847.  
  5848. for i,v in pairs(side.Windows) do
  5849. local midPos = v.PosY + v.SizeY/2
  5850. if curY <= midPos then
  5851. pos = i
  5852. range[2] = midPos
  5853. break
  5854. else
  5855. range[1] = midPos
  5856. end
  5857. end
  5858.  
  5859. return pos,range
  5860. end
  5861.  
  5862. local function focusInput(self,obj)
  5863. if isA(obj,"GuiButton") then
  5864. obj.MouseButton1Down:Connect(function()
  5865. moveToTop(self)
  5866. end)
  5867. elseif isA(obj,"TextBox") then
  5868. obj.Focused:Connect(function()
  5869. moveToTop(self)
  5870. end)
  5871. end
  5872. end
  5873.  
  5874. local createGui = function(self)
  5875. local gui = create({
  5876. {1,"ScreenGui",{Name="Window",}},
  5877. {2,"Frame",{Active=true,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Name="Main",Parent={1},Position=UDim2.new(0.40000000596046,0,0.40000000596046,0),Size=UDim2.new(0,300,0,300),}},
  5878. {3,"Frame",{BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderSizePixel=0,Name="Content",Parent={2},Position=UDim2.new(0,0,0,20),Size=UDim2.new(1,0,1,-20),ClipsDescendants=true}},
  5879. {4,"Frame",{BackgroundColor3=Color3.fromRGB(33,33,33),BorderSizePixel=0,Name="Line",Parent={3},Size=UDim2.new(1,0,0,1),}},
  5880. {5,"TextButton",{Text="",AutoButtonColor=false,BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),BorderSizePixel=0,Name="TopBar",Parent={2},Size=UDim2.new(1,0,0,20),}},
  5881. {6,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={5},Position=UDim2.new(0,5,0,0),Size=UDim2.new(1,-10,0,20),Text="Window",TextColor3=Color3.new(1,1,1),TextSize=14,TextXAlignment=0,}},
  5882. {7,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Close",Parent={5},Position=UDim2.new(1,-18,0,2),Size=UDim2.new(0,16,0,16),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,}},
  5883. {8,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://5054663650",Parent={7},Position=UDim2.new(0,3,0,3),Size=UDim2.new(0,10,0,10),}},
  5884. {9,"UICorner",{CornerRadius=UDim.new(0,4),Parent={7},}},
  5885. {10,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Minimize",Parent={5},Position=UDim2.new(1,-36,0,2),Size=UDim2.new(0,16,0,16),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,}},
  5886. {11,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://5034768003",Parent={10},Position=UDim2.new(0,3,0,3),Size=UDim2.new(0,10,0,10),}},
  5887. {12,"UICorner",{CornerRadius=UDim.new(0,4),Parent={10},}},
  5888. {13,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Image="rbxassetid://1427967925",Name="Outlines",Parent={2},Position=UDim2.new(0,-5,0,-5),ScaleType=1,Size=UDim2.new(1,10,1,10),SliceCenter=Rect.new(6,6,25,25),TileSize=UDim2.new(0,20,0,20),}},
  5889. {14,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Name="ResizeControls",Parent={2},Position=UDim2.new(0,-5,0,-5),Size=UDim2.new(1,10,1,10),}},
  5890. {15,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.27450981736183,0.27450981736183,0.27450981736183),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="North",Parent={14},Position=UDim2.new(0,5,0,0),Size=UDim2.new(1,-10,0,5),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  5891. {16,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.27450981736183,0.27450981736183,0.27450981736183),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="South",Parent={14},Position=UDim2.new(0,5,1,-5),Size=UDim2.new(1,-10,0,5),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  5892. {17,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.27450981736183,0.27450981736183,0.27450981736183),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="NorthEast",Parent={14},Position=UDim2.new(1,-5,0,0),Size=UDim2.new(0,5,0,5),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  5893. {18,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.27450981736183,0.27450981736183,0.27450981736183),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="East",Parent={14},Position=UDim2.new(1,-5,0,5),Size=UDim2.new(0,5,1,-10),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  5894. {19,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.27450981736183,0.27450981736183,0.27450981736183),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="West",Parent={14},Position=UDim2.new(0,0,0,5),Size=UDim2.new(0,5,1,-10),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  5895. {20,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.27450981736183,0.27450981736183,0.27450981736183),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="SouthEast",Parent={14},Position=UDim2.new(1,-5,1,-5),Size=UDim2.new(0,5,0,5),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  5896. {21,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.27450981736183,0.27450981736183,0.27450981736183),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="NorthWest",Parent={14},Size=UDim2.new(0,5,0,5),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  5897. {22,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.27450981736183,0.27450981736183,0.27450981736183),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="SouthWest",Parent={14},Position=UDim2.new(0,0,1,-5),Size=UDim2.new(0,5,0,5),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  5898. })
  5899.  
  5900. local guiMain = gui.Main
  5901. local guiTopBar = guiMain.TopBar
  5902. local guiResizeControls = guiMain.ResizeControls
  5903.  
  5904. self.GuiElems.Main = guiMain
  5905. self.GuiElems.TopBar = guiMain.TopBar
  5906. self.GuiElems.Content = guiMain.Content
  5907. self.GuiElems.Line = guiMain.Content.Line
  5908. self.GuiElems.Outlines = guiMain.Outlines
  5909. self.GuiElems.Title = guiTopBar.Title
  5910. self.GuiElems.Close = guiTopBar.Close
  5911. self.GuiElems.Minimize = guiTopBar.Minimize
  5912. self.GuiElems.ResizeControls = guiResizeControls
  5913. self.ContentPane = guiMain.Content
  5914.  
  5915. local ButtonDown = false
  5916. guiTopBar.MouseButton1Down:Connect(function() ButtonDown = true end)
  5917. guiTopBar.MouseButton1Up:Connect(function() ButtonDown = false end)
  5918.  
  5919. guiTopBar.InputBegan:Connect(function(input)
  5920. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  5921. if self.Draggable then
  5922. local releaseEvent, mouseEvent
  5923.  
  5924. local maxX = sidesGui.AbsoluteSize.X
  5925. local initX = guiMain.AbsolutePosition.X
  5926. local initY = guiMain.AbsolutePosition.Y
  5927. local offX = input.Position.X - initX
  5928. local offY = input.Position.Y - initY
  5929.  
  5930. local alignInsertPos, alignInsertSide
  5931.  
  5932. guiDragging = true
  5933.  
  5934. releaseEvent = service.UserInputService.InputEnded:Connect(function(input)
  5935. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  5936. releaseEvent:Disconnect()
  5937. if mouseEvent then mouseEvent:Disconnect() end
  5938. guiDragging = false
  5939. alignIndicator.Parent = nil
  5940. if alignInsertSide then
  5941. local targetSide = (alignInsertSide == "left" and leftSide) or (alignInsertSide == "right" and rightSide)
  5942. self:AlignTo(targetSide, alignInsertPos)
  5943. end
  5944. end
  5945. end)
  5946.  
  5947. mouseEvent = service.UserInputService.InputChanged:Connect(function(input)
  5948. if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and self.Draggable and not self.Closed and ButtonDown then
  5949. if self.Aligned then
  5950. if leftSide.Resizing or rightSide.Resizing then return end
  5951. local posX, posY = input.Position.X - offX, input.Position.Y - offY
  5952. local delta = math.sqrt((posX - initX)^2 + (posY - initY)^2)
  5953. if delta >= 5 then
  5954. self:SetAligned(false)
  5955. end
  5956. else
  5957. local inputX, inputY = input.Position.X, input.Position.Y
  5958. local posX, posY = inputX - offX, inputY - offY
  5959. if posY < 0 then posY = 0 end
  5960. guiMain.Position = UDim2.new(0, posX, 0, posY)
  5961.  
  5962. if self.Resizable and self.Alignable then
  5963. if inputX < 25 then
  5964. if sideHasRoom(leftSide, self.MinY or 100) then
  5965. local insertPos, range = getSideInsertPos(leftSide, inputY)
  5966. alignIndicator.Indicator.Position = UDim2.new(0, -15, 0, range[1])
  5967. alignIndicator.Indicator.Size = UDim2.new(0, 40, 0, range[2] - range[1])
  5968. Lib.ShowGui(alignIndicator)
  5969. alignInsertPos = insertPos
  5970. alignInsertSide = "left"
  5971. return
  5972. end
  5973. elseif inputX >= maxX - 25 then
  5974. if sideHasRoom(rightSide, self.MinY or 100) then
  5975. local insertPos, range = getSideInsertPos(rightSide, inputY)
  5976. alignIndicator.Indicator.Position = UDim2.new(0, maxX - 25, 0, range[1])
  5977. alignIndicator.Indicator.Size = UDim2.new(0, 40, 0, range[2] - range[1])
  5978. Lib.ShowGui(alignIndicator)
  5979. alignInsertPos = insertPos
  5980. alignInsertSide = "right"
  5981. return
  5982. end
  5983. end
  5984. end
  5985. alignIndicator.Parent = nil
  5986. alignInsertPos = nil
  5987. alignInsertSide = nil
  5988. end
  5989. end
  5990. end)
  5991. end
  5992. end
  5993. end)
  5994.  
  5995. guiTopBar.Close.MouseButton1Click:Connect(function()
  5996. if self.Closed then return end
  5997. self:Close()
  5998. end)
  5999.  
  6000. guiTopBar.Minimize.MouseButton1Click:Connect(function()
  6001. if self.Closed then return end
  6002. if self.Aligned then
  6003. self:SetAligned(false)
  6004. else
  6005. self:SetMinimized()
  6006. end
  6007. end)
  6008.  
  6009. guiTopBar.Minimize.MouseButton2Click:Connect(function()
  6010. if self.Closed then return end
  6011. if not self.Aligned then
  6012. self:SetMinimized(nil,2)
  6013. guiTopBar.Minimize.BackgroundTransparency = 1
  6014. end
  6015. end)
  6016.  
  6017. guiMain.InputBegan:Connect(function(input)
  6018. if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and not self.Aligned and not self.Closed then
  6019. moveToTop(self)
  6020. end
  6021. end)
  6022.  
  6023. guiMain:GetPropertyChangedSignal("AbsolutePosition"):Connect(function()
  6024. local absPos = guiMain.AbsolutePosition
  6025. self.PosX = absPos.X
  6026. self.PosY = absPos.Y
  6027. end)
  6028.  
  6029. resizeHook(self,guiResizeControls.North,"N")
  6030. resizeHook(self,guiResizeControls.NorthEast,"NE")
  6031. resizeHook(self,guiResizeControls.East,"E")
  6032. resizeHook(self,guiResizeControls.SouthEast,"SE")
  6033. resizeHook(self,guiResizeControls.South,"S")
  6034. resizeHook(self,guiResizeControls.SouthWest,"SW")
  6035. resizeHook(self,guiResizeControls.West,"W")
  6036. resizeHook(self,guiResizeControls.NorthWest,"NW")
  6037.  
  6038. guiMain.Size = UDim2.new(0,self.SizeX,0,self.SizeY)
  6039.  
  6040. gui.DescendantAdded:Connect(function(obj) focusInput(self,obj) end)
  6041. local descs = gui:GetDescendants()
  6042. for i = 1,#descs do
  6043. focusInput(self,descs[i])
  6044. end
  6045.  
  6046. self.MinimizeAnim = Lib.ButtonAnim(guiTopBar.Minimize)
  6047. self.CloseAnim = Lib.ButtonAnim(guiTopBar.Close)
  6048.  
  6049. return gui
  6050. end
  6051.  
  6052. local function updateSideFrames(noTween)
  6053. stopTweens()
  6054. leftSide.Frame.Size = UDim2.new(0,leftSide.Width,1,0)
  6055. rightSide.Frame.Size = UDim2.new(0,rightSide.Width,1,0)
  6056. leftSide.Frame.Resizer.Position = UDim2.new(0,leftSide.Width,0,0)
  6057. rightSide.Frame.Resizer.Position = UDim2.new(0,-5,0,0)
  6058.  
  6059. --leftSide.Frame.Visible = (#leftSide.Windows > 0)
  6060. --rightSide.Frame.Visible = (#rightSide.Windows > 0)
  6061.  
  6062. --[[if #leftSide.Windows > 0 and leftSide.Frame.Position == UDim2.new(0,-leftSide.Width-5,0,0) then
  6063. leftSide.Frame:TweenPosition(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.3,true)
  6064. elseif #leftSide.Windows == 0 and leftSide.Frame.Position == UDim2.new(0,0,0,0) then
  6065. leftSide.Frame:TweenPosition(UDim2.new(0,-leftSide.Width-5,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.3,true)
  6066. end
  6067. local rightTweenPos = (#rightSide.Windows == 0 and UDim2.new(1,5,0,0) or UDim2.new(1,-rightSide.Width,0,0))
  6068. rightSide.Frame:TweenPosition(rightTweenPos,Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.3,true)]]
  6069. local leftHidden = #leftSide.Windows == 0 or leftSide.Hidden
  6070. local rightHidden = #rightSide.Windows == 0 or rightSide.Hidden
  6071. local leftPos = (leftHidden and UDim2.new(0,-leftSide.Width-10,0,0) or UDim2.new(0,0,0,0))
  6072. local rightPos = (rightHidden and UDim2.new(1,10,0,0) or UDim2.new(1,-rightSide.Width,0,0))
  6073.  
  6074. sidesGui.LeftToggle.Text = leftHidden and ">" or "<"
  6075. sidesGui.RightToggle.Text = rightHidden and "<" or ">"
  6076.  
  6077. if not noTween then
  6078. local function insertTween(...)
  6079. local tween = service.TweenService:Create(...)
  6080. tweens[#tweens+1] = tween
  6081. tween:Play()
  6082. end
  6083. insertTween(leftSide.Frame,sideTweenInfo,{Position = leftPos})
  6084. insertTween(rightSide.Frame,sideTweenInfo,{Position = rightPos})
  6085. insertTween(sidesGui.LeftToggle,sideTweenInfo,{Position = UDim2.new(0,#leftSide.Windows == 0 and -16 or 0,0,-36)})
  6086. insertTween(sidesGui.RightToggle,sideTweenInfo,{Position = UDim2.new(1,#rightSide.Windows == 0 and 0 or -16,0,-36)})
  6087. else
  6088. leftSide.Frame.Position = leftPos
  6089. rightSide.Frame.Position = rightPos
  6090. sidesGui.LeftToggle.Position = UDim2.new(0,#leftSide.Windows == 0 and -16 or 0,0,-36)
  6091. sidesGui.RightToggle.Position = UDim2.new(1,#rightSide.Windows == 0 and 0 or -16,0,-36)
  6092. end
  6093. end
  6094.  
  6095. local function getSideFramePos(side)
  6096. local leftHidden = #leftSide.Windows == 0 or leftSide.Hidden
  6097. local rightHidden = #rightSide.Windows == 0 or rightSide.Hidden
  6098. if side == leftSide then
  6099. return (leftHidden and UDim2.new(0,-leftSide.Width-10,0,0) or UDim2.new(0,0,0,0))
  6100. else
  6101. return (rightHidden and UDim2.new(1,10,0,0) or UDim2.new(1,-rightSide.Width,0,0))
  6102. end
  6103. end
  6104.  
  6105. local function sideResized(side)
  6106. local currentPos = 0
  6107. local sideFramePos = getSideFramePos(side)
  6108. for i,v in pairs(side.Windows) do
  6109. v.SizeX = side.Width
  6110. v.GuiElems.Main.Size = UDim2.new(0,side.Width,0,v.SizeY)
  6111. v.GuiElems.Main.Position = UDim2.new(sideFramePos.X.Scale,sideFramePos.X.Offset,0,currentPos)
  6112. currentPos = currentPos + v.SizeY+4
  6113. end
  6114. end
  6115.  
  6116. local function sideResizerHook(resizer,dir,side,pos)
  6117. local mouse = Main.Mouse
  6118. local windows = side.Windows
  6119.  
  6120. resizer.InputBegan:Connect(function(input)
  6121. if not side.Resizing then
  6122. if input.UserInputType == Enum.UserInputType.MouseMovement then
  6123. resizer.BackgroundColor3 = theme.MainColor2
  6124. elseif input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  6125. local releaseEvent, inputEvent
  6126.  
  6127. local offX = input.Position.X - resizer.AbsolutePosition.X
  6128. local offY = input.Position.Y - resizer.AbsolutePosition.Y
  6129.  
  6130. side.Resizing = resizer
  6131. resizer.BackgroundColor3 = theme.MainColor2
  6132.  
  6133. releaseEvent = service.UserInputService.InputEnded:Connect(function(input)
  6134. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  6135. releaseEvent:Disconnect()
  6136. if inputEvent then inputEvent:Disconnect() end
  6137. side.Resizing = false
  6138. resizer.BackgroundColor3 = theme.Button
  6139. end
  6140. end)
  6141.  
  6142. inputEvent = service.UserInputService.InputChanged:Connect(function(input)
  6143. if not resizer.Parent then
  6144. releaseEvent:Disconnect()
  6145. if inputEvent then inputEvent:Disconnect() end
  6146. side.Resizing = false
  6147. return
  6148. end
  6149.  
  6150. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  6151. if dir == "V" then
  6152. local delta = input.Position.Y - resizer.AbsolutePosition.Y - offY
  6153.  
  6154. if delta > 0 then
  6155. local neededSize = delta
  6156. for i = pos + 1, #windows do
  6157. local window = windows[i]
  6158. local newSize = math.max(window.SizeY - neededSize, (window.MinY or 100))
  6159. neededSize = neededSize - (window.SizeY - newSize)
  6160. window.SizeY = newSize
  6161. end
  6162. windows[pos].SizeY = windows[pos].SizeY + math.max(0, delta - neededSize)
  6163. else
  6164. local neededSize = -delta
  6165. for i = pos, 1, -1 do
  6166. local window = windows[i]
  6167. local newSize = math.max(window.SizeY - neededSize, (window.MinY or 100))
  6168. neededSize = neededSize - (window.SizeY - newSize)
  6169. window.SizeY = newSize
  6170. end
  6171. windows[pos + 1].SizeY = windows[pos + 1].SizeY + math.max(0, -delta - neededSize)
  6172. end
  6173.  
  6174. updateSideFrames()
  6175. sideResized(side)
  6176. elseif dir == "H" then
  6177. local maxWidth = math.max(300, sidesGui.AbsoluteSize.X - static.FreeWidth)
  6178. local otherSide = (side == leftSide and rightSide or leftSide)
  6179. local delta = input.Position.X - resizer.AbsolutePosition.X - offX
  6180. delta = (side == leftSide and delta or -delta)
  6181.  
  6182. local proposedSize = math.max(static.MinWidth, side.Width + delta)
  6183. if proposedSize + otherSide.Width <= maxWidth then
  6184. side.Width = proposedSize
  6185. else
  6186. local newOtherSize = maxWidth - proposedSize
  6187. if newOtherSize >= static.MinWidth then
  6188. side.Width = proposedSize
  6189. otherSide.Width = newOtherSize
  6190. else
  6191. side.Width = maxWidth - static.MinWidth
  6192. otherSide.Width = static.MinWidth
  6193. end
  6194. end
  6195.  
  6196. updateSideFrames(true)
  6197. sideResized(side)
  6198. sideResized(otherSide)
  6199. end
  6200. end
  6201. end)
  6202. end
  6203. end
  6204. end)
  6205.  
  6206. resizer.InputEnded:Connect(function(input)
  6207. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  6208. if side.Resizing ~= resizer then
  6209. resizer.BackgroundColor3 = theme.Button
  6210. end
  6211. end
  6212. end)
  6213.  
  6214. end
  6215.  
  6216. local function renderSide(side,noTween) -- TODO: Use existing resizers
  6217. local currentPos = 0
  6218. local sideFramePos = getSideFramePos(side)
  6219. local template = side.WindowResizer:Clone()
  6220. for i,v in pairs(side.ResizeCons) do v:Disconnect() end
  6221. for i,v in pairs(side.Frame:GetChildren()) do if v.Name == "WindowResizer" then v:Destroy() end end
  6222. side.ResizeCons = {}
  6223. side.Resizing = nil
  6224.  
  6225. for i,v in pairs(side.Windows) do
  6226. v.SidePos = i
  6227. local isEnd = i == #side.Windows
  6228. local size = UDim2.new(0,side.Width,0,v.SizeY)
  6229. local pos = UDim2.new(sideFramePos.X.Scale,sideFramePos.X.Offset,0,currentPos)
  6230. Lib.ShowGui(v.Gui)
  6231. --v.GuiElems.Main:TweenSizeAndPosition(size,pos,Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.3,true)
  6232. if noTween then
  6233. v.GuiElems.Main.Size = size
  6234. v.GuiElems.Main.Position = pos
  6235. else
  6236. local tween = service.TweenService:Create(v.GuiElems.Main,sideTweenInfo,{Size = size, Position = pos})
  6237. tweens[#tweens+1] = tween
  6238. tween:Play()
  6239. end
  6240. currentPos = currentPos + v.SizeY+4
  6241.  
  6242. if not isEnd then
  6243. local newTemplate = template:Clone()
  6244. newTemplate.Position = UDim2.new(1,-side.Width,0,currentPos-4)
  6245. side.ResizeCons[#side.ResizeCons+1] = v.Gui.Main:GetPropertyChangedSignal("Size"):Connect(function()
  6246. newTemplate.Position = UDim2.new(1,-side.Width,0, v.GuiElems.Main.Position.Y.Offset + v.GuiElems.Main.Size.Y.Offset)
  6247. end)
  6248. side.ResizeCons[#side.ResizeCons+1] = v.Gui.Main:GetPropertyChangedSignal("Position"):Connect(function()
  6249. newTemplate.Position = UDim2.new(1,-side.Width,0, v.GuiElems.Main.Position.Y.Offset + v.GuiElems.Main.Size.Y.Offset)
  6250. end)
  6251. sideResizerHook(newTemplate,"V",side,i)
  6252. newTemplate.Parent = side.Frame
  6253. end
  6254. end
  6255.  
  6256. --side.Frame.Back.Position = UDim2.new(0,0,0,0)
  6257. --side.Frame.Back.Size = UDim2.new(0,side.Width,1,0)
  6258. end
  6259.  
  6260. local function updateSide(side,noTween)
  6261. local oldHeight = 0
  6262. local currentPos = 0
  6263. local neededSize = 0
  6264. local windows = side.Windows
  6265. local height = sidesGui.AbsoluteSize.Y - (math.max(0,#windows - 1) * 4)
  6266.  
  6267. for i,v in pairs(windows) do oldHeight = oldHeight + v.SizeY end
  6268. for i,v in pairs(windows) do
  6269. if i == #windows then
  6270. v.SizeY = height-currentPos
  6271. neededSize = math.max(0,(v.MinY or 100)-v.SizeY)
  6272. else
  6273. v.SizeY = math.max(math.floor(v.SizeY/oldHeight*height),v.MinY or 100)
  6274. end
  6275. currentPos = currentPos + v.SizeY
  6276. end
  6277.  
  6278. if neededSize > 0 then
  6279. for i = #windows-1,1,-1 do
  6280. local window = windows[i]
  6281. local newSize = math.max(window.SizeY-neededSize,(window.MinY or 100))
  6282. neededSize = neededSize - (window.SizeY - newSize)
  6283. window.SizeY = newSize
  6284. end
  6285. local lastWindow = windows[#windows]
  6286. lastWindow.SizeY = (lastWindow.MinY or 100)-neededSize
  6287. end
  6288. renderSide(side,noTween)
  6289. end
  6290.  
  6291. updateWindows = function(noTween)
  6292. updateSideFrames(noTween)
  6293. updateSide(leftSide,noTween)
  6294. updateSide(rightSide,noTween)
  6295. local count = 0
  6296. for i = #visibleWindows,1,-1 do
  6297. visibleWindows[i].Gui.DisplayOrder = displayOrderStart + count
  6298. Lib.ShowGui(visibleWindows[i].Gui)
  6299. count = count + 1
  6300. end
  6301.  
  6302. --[[local leftTweenPos = (#leftSide.Windows == 0 and UDim2.new(0,-leftSide.Width-5,0,0) or UDim2.new(0,0,0,0))
  6303. leftSide.Frame:TweenPosition(leftTweenPos,Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.3,true)
  6304. local rightTweenPos = (#rightSide.Windows == 0 and UDim2.new(1,5,0,0) or UDim2.new(1,-rightSide.Width,0,0))
  6305. rightSide.Frame:TweenPosition(rightTweenPos,Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.3,true)]]
  6306. end
  6307.  
  6308. funcs.SetMinimized = function(self,set,mode)
  6309. local oldVal = self.Minimized
  6310. local newVal
  6311. if set == nil then newVal = not self.Minimized else newVal = set end
  6312. self.Minimized = newVal
  6313. if not mode then mode = 1 end
  6314.  
  6315. local resizeControls = self.GuiElems.ResizeControls
  6316. local minimizeControls = {"North","NorthEast","NorthWest","South","SouthEast","SouthWest"}
  6317. for i = 1,#minimizeControls do
  6318. local control = resizeControls:FindFirstChild(minimizeControls[i])
  6319. if control then control.Visible = not newVal end
  6320. end
  6321.  
  6322. if mode == 1 or mode == 2 then
  6323. self:StopTweens()
  6324. if mode == 1 then
  6325. self.GuiElems.Main:TweenSize(UDim2.new(0,self.SizeX,0,newVal and 20 or self.SizeY),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,0.25,true)
  6326. else
  6327. local maxY = sidesGui.AbsoluteSize.Y
  6328. local newPos = UDim2.new(0,self.PosX,0,newVal and math.min(maxY-20,self.PosY + self.SizeY - 20) or math.max(0,self.PosY - self.SizeY + 20))
  6329.  
  6330. self.GuiElems.Main:TweenPosition(newPos,Enum.EasingDirection.Out,Enum.EasingStyle.Quart,0.25,true)
  6331. self.GuiElems.Main:TweenSize(UDim2.new(0,self.SizeX,0,newVal and 20 or self.SizeY),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,0.25,true)
  6332. end
  6333. self.GuiElems.Minimize.ImageLabel.Image = newVal and "rbxassetid://5060023708" or "rbxassetid://5034768003"
  6334. end
  6335.  
  6336. if oldVal ~= newVal then
  6337. if newVal then
  6338. self.OnMinimize:Fire()
  6339. else
  6340. self.OnRestore:Fire()
  6341. end
  6342. end
  6343. end
  6344.  
  6345. funcs.Resize = function(self,sizeX,sizeY)
  6346. self.SizeX = sizeX or self.SizeX
  6347. self.SizeY = sizeY or self.SizeY
  6348. self.GuiElems.Main.Size = UDim2.new(0,self.SizeX,0,self.SizeY)
  6349. end
  6350.  
  6351. funcs.SetSize = funcs.Resize
  6352.  
  6353. funcs.SetTitle = function(self,title)
  6354. self.GuiElems.Title.Text = title
  6355. end
  6356.  
  6357. funcs.SetResizable = function(self,val)
  6358. self.Resizable = val
  6359. self.GuiElems.ResizeControls.Visible = self.Resizable and self.ResizableInternal
  6360. end
  6361.  
  6362. funcs.SetResizableInternal = function(self,val)
  6363. self.ResizableInternal = val
  6364. self.GuiElems.ResizeControls.Visible = self.Resizable and self.ResizableInternal
  6365. end
  6366.  
  6367. funcs.SetAligned = function(self,val)
  6368. self.Aligned = val
  6369. self:SetResizableInternal(not val)
  6370. self.GuiElems.Main.Active = not val
  6371. self.GuiElems.Main.Outlines.Visible = not val
  6372. if not val then
  6373. for i,v in pairs(leftSide.Windows) do if v == self then table.remove(leftSide.Windows,i) break end end
  6374. for i,v in pairs(rightSide.Windows) do if v == self then table.remove(rightSide.Windows,i) break end end
  6375. if not table.find(visibleWindows,self) then table.insert(visibleWindows,1,self) end
  6376. self.GuiElems.Minimize.ImageLabel.Image = "rbxassetid://5034768003"
  6377. self.Side = nil
  6378. updateWindows()
  6379. else
  6380. self:SetMinimized(false,3)
  6381. for i,v in pairs(visibleWindows) do if v == self then table.remove(visibleWindows,i) break end end
  6382. self.GuiElems.Minimize.ImageLabel.Image = "rbxassetid://5448127505"
  6383. end
  6384. end
  6385.  
  6386. funcs.Add = function(self,obj,name)
  6387. if type(obj) == "table" and obj.Gui and obj.Gui:IsA("GuiObject") then
  6388. obj.Gui.Parent = self.ContentPane
  6389. else
  6390. obj.Parent = self.ContentPane
  6391. end
  6392. if name then self.Elements[name] = obj end
  6393. end
  6394.  
  6395. funcs.GetElement = function(self,obj,name)
  6396. return self.Elements[name]
  6397. end
  6398.  
  6399. funcs.AlignTo = function(self,side,pos,size,silent)
  6400. if table.find(side.Windows,self) or self.Closed then return end
  6401.  
  6402. size = size or self.SizeY
  6403. if size > 0 and size <= 1 then
  6404. local totalSideHeight = 0
  6405. for i,v in pairs(side.Windows) do totalSideHeight = totalSideHeight + v.SizeY end
  6406. self.SizeY = (totalSideHeight > 0 and totalSideHeight * size * 2) or size
  6407. else
  6408. self.SizeY = (size > 0 and size or 100)
  6409. end
  6410.  
  6411. self:SetAligned(true)
  6412. self.Side = side
  6413. self.SizeX = side.Width
  6414. self.Gui.DisplayOrder = sideDisplayOrder + 1
  6415. for i,v in pairs(side.Windows) do v.Gui.DisplayOrder = sideDisplayOrder end
  6416. pos = math.min(#side.Windows+1, pos or 1)
  6417. self.SidePos = pos
  6418. table.insert(side.Windows, pos, self)
  6419.  
  6420. if not silent then
  6421. side.Hidden = false
  6422. end
  6423. -- updateWindows(silent)
  6424. end
  6425.  
  6426. funcs.Close = function(self)
  6427. self.Closed = true
  6428. self:SetResizableInternal(false)
  6429.  
  6430. Lib.FindAndRemove(leftSide.Windows,self)
  6431. Lib.FindAndRemove(rightSide.Windows,self)
  6432. Lib.FindAndRemove(visibleWindows,self)
  6433.  
  6434. self.MinimizeAnim.Disable()
  6435. self.CloseAnim.Disable()
  6436. self.ClosedSide = self.Side
  6437. self.Side = nil
  6438. self.OnDeactivate:Fire()
  6439.  
  6440. if not self.Aligned then
  6441. self:StopTweens()
  6442. local ti = TweenInfo.new(0.2,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
  6443.  
  6444. local closeTime = tick()
  6445. self.LastClose = closeTime
  6446.  
  6447. self:DoTween(self.GuiElems.Main,ti,{Size = UDim2.new(0,self.SizeX,0,20)})
  6448. self:DoTween(self.GuiElems.Title,ti,{TextTransparency = 1})
  6449. self:DoTween(self.GuiElems.Minimize.ImageLabel,ti,{ImageTransparency = 1})
  6450. self:DoTween(self.GuiElems.Close.ImageLabel,ti,{ImageTransparency = 1})
  6451. Lib.FastWait(0.2)
  6452. if closeTime ~= self.LastClose then return end
  6453.  
  6454. self:DoTween(self.GuiElems.TopBar,ti,{BackgroundTransparency = 1})
  6455. self:DoTween(self.GuiElems.Outlines,ti,{ImageTransparency = 1})
  6456. Lib.FastWait(0.2)
  6457. if closeTime ~= self.LastClose then return end
  6458. end
  6459.  
  6460. self.Aligned = false
  6461. self.Gui.Parent = nil
  6462. updateWindows(true)
  6463. end
  6464.  
  6465. funcs.Hide = funcs.Close
  6466.  
  6467. funcs.IsVisible = function(self)
  6468. return not self.Closed and ((self.Side and not self.Side.Hidden) or not self.Side)
  6469. end
  6470.  
  6471. funcs.IsContentVisible = function(self)
  6472. return self:IsVisible() and not self.Minimized
  6473. end
  6474.  
  6475. funcs.Focus = function(self)
  6476. moveToTop(self)
  6477. end
  6478.  
  6479. funcs.MoveInBoundary = function(self)
  6480. local posX,posY = self.PosX,self.PosY
  6481. local maxX,maxY = sidesGui.AbsoluteSize.X,sidesGui.AbsoluteSize.Y
  6482. posX = math.min(posX,maxX-self.SizeX)
  6483. posY = math.min(posY,maxY-20)
  6484. self.GuiElems.Main.Position = UDim2.new(0,posX,0,posY)
  6485. end
  6486.  
  6487. funcs.DoTween = function(self,...)
  6488. local tween = service.TweenService:Create(...)
  6489. self.Tweens[#self.Tweens+1] = tween
  6490. tween:Play()
  6491. end
  6492.  
  6493. funcs.StopTweens = function(self)
  6494. for i,v in pairs(self.Tweens) do
  6495. v:Cancel()
  6496. end
  6497. self.Tweens = {}
  6498. end
  6499.  
  6500. funcs.Show = function(self,data)
  6501. return static.ShowWindow(self,data)
  6502. end
  6503.  
  6504. funcs.ShowAndFocus = function(self,data)
  6505. static.ShowWindow(self,data)
  6506. service.RunService.RenderStepped:wait()
  6507. self:Focus()
  6508. end
  6509.  
  6510. static.ShowWindow = function(window,data)
  6511. data = data or {}
  6512. local align = data.Align
  6513. local pos = data.Pos
  6514. local size = data.Size
  6515. local targetSide = (align == "left" and leftSide) or (align == "right" and rightSide)
  6516.  
  6517. if not window.Closed then
  6518. if not window.Aligned then
  6519. window:SetMinimized(false)
  6520. elseif window.Side and not data.Silent then
  6521. static.SetSideVisible(window.Side,true)
  6522. end
  6523. return
  6524. end
  6525.  
  6526. window.Closed = false
  6527. window.LastClose = tick()
  6528. window.GuiElems.Title.TextTransparency = 0
  6529. window.GuiElems.Minimize.ImageLabel.ImageTransparency = 0
  6530. window.GuiElems.Close.ImageLabel.ImageTransparency = 0
  6531. window.GuiElems.TopBar.BackgroundTransparency = 0
  6532. window.GuiElems.Outlines.ImageTransparency = 0
  6533. window.GuiElems.Minimize.ImageLabel.Image = "rbxassetid://5034768003"
  6534. window.GuiElems.Main.Active = true
  6535. window.GuiElems.Main.Outlines.Visible = true
  6536. window:SetMinimized(false,3)
  6537. window:SetResizableInternal(true)
  6538. window.MinimizeAnim.Enable()
  6539. window.CloseAnim.Enable()
  6540.  
  6541. if align then
  6542. window:AlignTo(targetSide,pos,size,data.Silent)
  6543. else
  6544. if align == nil and window.ClosedSide then -- Regular open
  6545. window:AlignTo(window.ClosedSide,window.SidePos,size,true)
  6546. static.SetSideVisible(window.ClosedSide,true)
  6547. else
  6548. if table.find(visibleWindows,window) then return end
  6549.  
  6550. -- TODO: make better
  6551. window.GuiElems.Main.Size = UDim2.new(0,window.SizeX,0,20)
  6552. local ti = TweenInfo.new(0.2,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
  6553. window:StopTweens()
  6554. window:DoTween(window.GuiElems.Main,ti,{Size = UDim2.new(0,window.SizeX,0,window.SizeY)})
  6555.  
  6556. window.SizeY = size or window.SizeY
  6557. table.insert(visibleWindows,1,window)
  6558. updateWindows()
  6559. end
  6560. end
  6561.  
  6562. window.ClosedSide = nil
  6563. window.OnActivate:Fire()
  6564. end
  6565.  
  6566. static.ToggleSide = function(name)
  6567. local side = (name == "left" and leftSide or rightSide)
  6568. side.Hidden = not side.Hidden
  6569. for i,v in pairs(side.Windows) do
  6570. if side.Hidden then
  6571. v.OnDeactivate:Fire()
  6572. else
  6573. v.OnActivate:Fire()
  6574. end
  6575. end
  6576. updateWindows()
  6577. end
  6578.  
  6579. static.SetSideVisible = function(s,vis)
  6580. local side = (type(s) == "table" and s) or (s == "left" and leftSide or rightSide)
  6581. side.Hidden = not vis
  6582. for i,v in pairs(side.Windows) do
  6583. if side.Hidden then
  6584. v.OnDeactivate:Fire()
  6585. else
  6586. v.OnActivate:Fire()
  6587. end
  6588. end
  6589. updateWindows()
  6590. end
  6591.  
  6592. static.Init = function()
  6593. displayOrderStart = Main.DisplayOrders.Window
  6594. sideDisplayOrder = Main.DisplayOrders.SideWindow
  6595.  
  6596. sidesGui = Instance.new("ScreenGui")
  6597. local leftFrame = create({
  6598. {1,"Frame",{Active=true,Name="LeftSide",BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderSizePixel=0,}},
  6599. {2,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2549019753933,0.2549019753933,0.2549019753933),BorderSizePixel=0,Font=3,Name="Resizer",Parent={1},Size=UDim2.new(0,5,1,0),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  6600. {3,"Frame",{BackgroundColor3=Color3.new(0.14117647707462,0.14117647707462,0.14117647707462),BorderSizePixel=0,Name="Line",Parent={2},Position=UDim2.new(0,0,0,0),Size=UDim2.new(0,1,1,0),}},
  6601. {4,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2549019753933,0.2549019753933,0.2549019753933),BorderSizePixel=0,Font=3,Name="WindowResizer",Parent={1},Position=UDim2.new(1,-300,0,0),Size=UDim2.new(1,0,0,4),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  6602. {5,"Frame",{BackgroundColor3=Color3.new(0.14117647707462,0.14117647707462,0.14117647707462),BorderSizePixel=0,Name="Line",Parent={4},Size=UDim2.new(1,0,0,1),}},
  6603. })
  6604. leftSide.Frame = leftFrame
  6605. leftFrame.Position = UDim2.new(0,-leftSide.Width-10,0,0)
  6606. leftSide.WindowResizer = leftFrame.WindowResizer
  6607. leftFrame.WindowResizer.Parent = nil
  6608. leftFrame.Parent = sidesGui
  6609.  
  6610. local rightFrame = create({
  6611. {1,"Frame",{Active=true,Name="RightSide",BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderSizePixel=0,}},
  6612. {2,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2549019753933,0.2549019753933,0.2549019753933),BorderSizePixel=0,Font=3,Name="Resizer",Parent={1},Size=UDim2.new(0,5,1,0),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  6613. {3,"Frame",{BackgroundColor3=Color3.new(0.14117647707462,0.14117647707462,0.14117647707462),BorderSizePixel=0,Name="Line",Parent={2},Position=UDim2.new(0,4,0,0),Size=UDim2.new(0,1,1,0),}},
  6614. {4,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2549019753933,0.2549019753933,0.2549019753933),BorderSizePixel=0,Font=3,Name="WindowResizer",Parent={1},Position=UDim2.new(1,-300,0,0),Size=UDim2.new(1,0,0,4),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  6615. {5,"Frame",{BackgroundColor3=Color3.new(0.14117647707462,0.14117647707462,0.14117647707462),BorderSizePixel=0,Name="Line",Parent={4},Size=UDim2.new(1,0,0,1),}},
  6616. })
  6617. rightSide.Frame = rightFrame
  6618. rightFrame.Position = UDim2.new(1,10,0,0)
  6619. rightSide.WindowResizer = rightFrame.WindowResizer
  6620. rightFrame.WindowResizer.Parent = nil
  6621. rightFrame.Parent = sidesGui
  6622.  
  6623. sideResizerHook(leftFrame.Resizer,"H",leftSide)
  6624. sideResizerHook(rightFrame.Resizer,"H",rightSide)
  6625.  
  6626. alignIndicator = Instance.new("ScreenGui")
  6627. alignIndicator.DisplayOrder = Main.DisplayOrders.Core
  6628. local indicator = Instance.new("Frame",alignIndicator)
  6629. indicator.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
  6630. indicator.BorderSizePixel = 0
  6631. indicator.BackgroundTransparency = 0.8
  6632. indicator.Name = "Indicator"
  6633. local corner = Instance.new("UICorner",indicator)
  6634. corner.CornerRadius = UDim.new(0,10)
  6635.  
  6636. local leftToggle = create({{1,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),BorderColor3=Color3.new(0.14117647707462,0.14117647707462,0.14117647707462),BorderMode=2,Font=10,Name="LeftToggle",Position=UDim2.new(0,0,0,-36),Size=UDim2.new(0,16,0,36),Text="<",TextColor3=Color3.new(1,1,1),TextSize=14,}}})
  6637. local rightToggle = leftToggle:Clone()
  6638. rightToggle.Name = "RightToggle"
  6639. rightToggle.Position = UDim2.new(1,-16,0,-36)
  6640. Lib.ButtonAnim(leftToggle,{Mode = 2,PressColor = Color3.fromRGB(32,32,32)})
  6641. Lib.ButtonAnim(rightToggle,{Mode = 2,PressColor = Color3.fromRGB(32,32,32)})
  6642.  
  6643. leftToggle.MouseButton1Click:Connect(function()
  6644. static.ToggleSide("left")
  6645. end)
  6646.  
  6647. rightToggle.MouseButton1Click:Connect(function()
  6648. static.ToggleSide("right")
  6649. end)
  6650.  
  6651. leftToggle.Parent = sidesGui
  6652. rightToggle.Parent = sidesGui
  6653.  
  6654. sidesGui:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
  6655. local maxWidth = math.max(300,sidesGui.AbsoluteSize.X-static.FreeWidth)
  6656. leftSide.Width = math.max(static.MinWidth,math.min(leftSide.Width,maxWidth-rightSide.Width))
  6657. rightSide.Width = math.max(static.MinWidth,math.min(rightSide.Width,maxWidth-leftSide.Width))
  6658. for i = 1,#visibleWindows do
  6659. visibleWindows[i]:MoveInBoundary()
  6660. end
  6661. updateWindows(true)
  6662. end)
  6663.  
  6664. sidesGui.DisplayOrder = sideDisplayOrder - 1
  6665. Lib.ShowGui(sidesGui)
  6666. updateSideFrames()
  6667. end
  6668.  
  6669. local mt = {__index = funcs}
  6670. static.new = function()
  6671. local obj = setmetatable({
  6672. Minimized = false,
  6673. Dragging = false,
  6674. Resizing = false,
  6675. Aligned = false,
  6676. Draggable = true,
  6677. Resizable = true,
  6678. ResizableInternal = true,
  6679. Alignable = true,
  6680. Closed = true,
  6681. SizeX = 300,
  6682. SizeY = 300,
  6683. MinX = 200,
  6684. MinY = 200,
  6685. PosX = 0,
  6686. PosY = 0,
  6687. GuiElems = {},
  6688. Tweens = {},
  6689. Elements = {},
  6690. OnActivate = Lib.Signal.new(),
  6691. OnDeactivate = Lib.Signal.new(),
  6692. OnMinimize = Lib.Signal.new(),
  6693. OnRestore = Lib.Signal.new()
  6694. },mt)
  6695. obj.Gui = createGui(obj)
  6696. return obj
  6697. end
  6698.  
  6699. return static
  6700. end)()
  6701.  
  6702. Lib.ContextMenu = (function()
  6703. local funcs = {}
  6704. local mouse
  6705.  
  6706. local function createGui(self)
  6707. local contextGui = create({
  6708. {1,"ScreenGui",{DisplayOrder=1000000,Name="Context",ZIndexBehavior=1,}},
  6709. {2,"Frame",{Active=true,BackgroundColor3=Color3.new(0.14117647707462,0.14117647707462,0.14117647707462),BorderColor3=Color3.new(0.14117647707462,0.14117647707462,0.14117647707462),Name="Main",Parent={1},Position=UDim2.new(0.5,-100,0.5,-150),Size=UDim2.new(0,200,0,100),}},
  6710. {3,"UICorner",{CornerRadius=UDim.new(0,4),Parent={2},}},
  6711. {4,"Frame",{BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),Name="Container",Parent={2},Position=UDim2.new(0,1,0,1),Size=UDim2.new(1,-2,1,-2),}},
  6712. {5,"UICorner",{CornerRadius=UDim.new(0,4),Parent={4},}},
  6713. {6,"ScrollingFrame",{Active=true,BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),BackgroundTransparency=1,BorderSizePixel=0,CanvasSize=UDim2.new(0,0,0,0),Name="List",Parent={4},Position=UDim2.new(0,2,0,2),ScrollBarImageColor3=Color3.new(0,0,0),ScrollBarThickness=4,Size=UDim2.new(1,-4,1,-4),VerticalScrollBarInset=1,}},
  6714. {7,"UIListLayout",{Parent={6},SortOrder=2,}},
  6715. {8,"Frame",{BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),BorderSizePixel=0,Name="SearchFrame",Parent={4},Size=UDim2.new(1,0,0,24),Visible=false,}},
  6716. {9,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.1176470592618,0.1176470592618,0.1176470592618),BorderSizePixel=0,Name="SearchContainer",Parent={8},Position=UDim2.new(0,3,0,3),Size=UDim2.new(1,-6,0,18),}},
  6717. {10,"TextBox",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="SearchBox",Parent={9},PlaceholderColor3=Color3.new(0.39215689897537,0.39215689897537,0.39215689897537),PlaceholderText="Search",Position=UDim2.new(0,4,0,0),Size=UDim2.new(1,-8,0,18),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,TextXAlignment=0,}},
  6718. {11,"UICorner",{CornerRadius=UDim.new(0,2),Parent={9},}},
  6719. {12,"Frame",{BackgroundColor3=Color3.new(0.14117647707462,0.14117647707462,0.14117647707462),BorderSizePixel=0,Name="Line",Parent={8},Position=UDim2.new(0,0,1,0),Size=UDim2.new(1,0,0,1),}},
  6720. {13,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),BackgroundTransparency=1,BorderColor3=Color3.new(0.33725491166115,0.49019610881805,0.73725491762161),BorderSizePixel=0,Font=3,Name="Entry",Parent={1},Size=UDim2.new(1,0,0,22),Text="",TextSize=14,Visible=false,}},
  6721. {14,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="EntryName",Parent={13},Position=UDim2.new(0,24,0,0),Size=UDim2.new(1,-24,1,0),Text="Duplicate",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  6722. {15,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Shortcut",Parent={13},Position=UDim2.new(0,24,0,0),Size=UDim2.new(1,-30,1,0),Text="Ctrl+D",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  6723. {16,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,ImageRectOffset=Vector2.new(304,0),ImageRectSize=Vector2.new(16,16),Name="Icon",Parent={13},Position=UDim2.new(0,2,0,3),ScaleType=4,Size=UDim2.new(0,16,0,16),}},
  6724. {17,"UICorner",{CornerRadius=UDim.new(0,4),Parent={13},}},
  6725. {18,"Frame",{BackgroundColor3=Color3.new(0.21568629145622,0.21568629145622,0.21568629145622),BackgroundTransparency=1,BorderSizePixel=0,Name="Divider",Parent={1},Position=UDim2.new(0,0,0,20),Size=UDim2.new(1,0,0,7),Visible=false,}},
  6726. {19,"Frame",{BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),BorderSizePixel=0,Name="Line",Parent={18},Position=UDim2.new(0,0,0.5,0),Size=UDim2.new(1,0,0,1),}},
  6727. {20,"TextLabel",{AnchorPoint=Vector2.new(0,0.5),BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="DividerName",Parent={18},Position=UDim2.new(0,2,0.5,0),Size=UDim2.new(1,-4,1,0),Text="Objects",TextColor3=Color3.new(1,1,1),TextSize=14,TextTransparency=0.60000002384186,TextXAlignment=0,Visible=false,}}
  6728. })
  6729.  
  6730. self.GuiElems.Main = contextGui.Main
  6731. self.GuiElems.List = contextGui.Main.Container.List
  6732. self.GuiElems.Entry = contextGui.Entry
  6733. self.GuiElems.Divider = contextGui.Divider
  6734. self.GuiElems.SearchFrame = contextGui.Main.Container.SearchFrame
  6735. self.GuiElems.SearchBar = self.GuiElems.SearchFrame.SearchContainer.SearchBox
  6736. Lib.ViewportTextBox.convert(self.GuiElems.SearchBar)
  6737.  
  6738. self.GuiElems.SearchBar:GetPropertyChangedSignal("Text"):Connect(function()
  6739. local lower,find = string.lower,string.find
  6740. local searchText = lower(self.GuiElems.SearchBar.Text)
  6741. local items = self.Items
  6742. local map = self.ItemToEntryMap
  6743.  
  6744. if searchText ~= "" then
  6745. local results = {}
  6746. local count = 1
  6747. for i = 1,#items do
  6748. local item = items[i]
  6749. local entry = map[item]
  6750. if entry then
  6751. if not item.Divider and find(lower(item.Name),searchText,1,true) then
  6752. results[count] = item
  6753. count = count + 1
  6754. else
  6755. entry.Visible = false
  6756. end
  6757. end
  6758. end
  6759. table.sort(results,function(a,b) return a.Name < b.Name end)
  6760. for i = 1,#results do
  6761. local entry = map[results[i]]
  6762. entry.LayoutOrder = i
  6763. entry.Visible = true
  6764. end
  6765. else
  6766. for i = 1,#items do
  6767. local entry = map[items[i]]
  6768. if entry then entry.LayoutOrder = i entry.Visible = true end
  6769. end
  6770. end
  6771.  
  6772. local toSize = self.GuiElems.List.UIListLayout.AbsoluteContentSize.Y + 6
  6773. self.GuiElems.List.CanvasSize = UDim2.new(0,0,0,toSize-6)
  6774. end)
  6775.  
  6776. return contextGui
  6777. end
  6778.  
  6779. funcs.Add = function(self,item)
  6780. local newItem = {
  6781. Name = item.Name or "Item",
  6782. Icon = item.Icon or "",
  6783. Shortcut = item.Shortcut or "",
  6784. OnClick = item.OnClick,
  6785. OnHover = item.OnHover,
  6786. Disabled = item.Disabled or false,
  6787. DisabledIcon = item.DisabledIcon or "",
  6788. IconMap = item.IconMap,
  6789. OnRightClick = item.OnRightClick
  6790. }
  6791.  
  6792. if self.QueuedDivider then
  6793. local text = self.QueuedDividerText and #self.QueuedDividerText > 0 and self.QueuedDividerText
  6794. self:AddDivider(text)
  6795. end
  6796. self.Items[#self.Items+1] = newItem
  6797. self.Updated = nil
  6798. end
  6799.  
  6800. funcs.AddRegistered = function(self,name,disabled)
  6801. if not self.Registered[name] then error(name.." is not registered") end
  6802.  
  6803. if self.QueuedDivider then
  6804. local text = self.QueuedDividerText and #self.QueuedDividerText > 0 and self.QueuedDividerText
  6805. self:AddDivider(text)
  6806. end
  6807. self.Registered[name].Disabled = disabled
  6808. self.Items[#self.Items+1] = self.Registered[name]
  6809. self.Updated = nil
  6810. end
  6811.  
  6812. funcs.Register = function(self,name,item)
  6813. self.Registered[name] = {
  6814. Name = item.Name or "Item",
  6815. Icon = item.Icon or "",
  6816. Shortcut = item.Shortcut or "",
  6817. OnClick = item.OnClick,
  6818. OnHover = item.OnHover,
  6819. DisabledIcon = item.DisabledIcon or "",
  6820. IconMap = item.IconMap,
  6821. OnRightClick = item.OnRightClick
  6822. }
  6823. end
  6824.  
  6825. funcs.UnRegister = function(self,name)
  6826. self.Registered[name] = nil
  6827. end
  6828.  
  6829. funcs.AddDivider = function(self,text)
  6830. self.QueuedDivider = false
  6831. local textWidth = text and service.TextService:GetTextSize(text,14,Enum.Font.SourceSans,Vector2.new(999999999,20)).X or nil
  6832. table.insert(self.Items,{Divider = true, Text = text, TextSize = textWidth and textWidth+4})
  6833. self.Updated = nil
  6834. end
  6835.  
  6836. funcs.QueueDivider = function(self,text)
  6837. self.QueuedDivider = true
  6838. self.QueuedDividerText = text or ""
  6839. end
  6840.  
  6841. funcs.Clear = function(self)
  6842. self.Items = {}
  6843. self.Updated = nil
  6844. end
  6845.  
  6846. funcs.Refresh = function(self)
  6847. for i,v in pairs(self.GuiElems.List:GetChildren()) do
  6848. if not v:IsA("UIListLayout") then
  6849. v:Destroy()
  6850. end
  6851. end
  6852. local map = {}
  6853. self.ItemToEntryMap = map
  6854.  
  6855. local dividerFrame = self.GuiElems.Divider
  6856. local contextList = self.GuiElems.List
  6857. local entryFrame = self.GuiElems.Entry
  6858. local items = self.Items
  6859.  
  6860. for i = 1,#items do
  6861. local item = items[i]
  6862. if item.Divider then
  6863. local newDivider = dividerFrame:Clone()
  6864. newDivider.Line.BackgroundColor3 = self.Theme.DividerColor
  6865. if item.Text then
  6866. newDivider.Size = UDim2.new(1,0,0,20)
  6867. newDivider.Line.Position = UDim2.new(0,item.TextSize,0.5,0)
  6868. newDivider.Line.Size = UDim2.new(1,-item.TextSize,0,1)
  6869. newDivider.DividerName.TextColor3 = self.Theme.TextColor
  6870. newDivider.DividerName.Text = item.Text
  6871. newDivider.DividerName.Visible = true
  6872. end
  6873. newDivider.Visible = true
  6874. map[item] = newDivider
  6875. newDivider.Parent = contextList
  6876. else
  6877. local newEntry = entryFrame:Clone()
  6878. newEntry.BackgroundColor3 = self.Theme.HighlightColor
  6879. newEntry.EntryName.TextColor3 = self.Theme.TextColor
  6880. newEntry.EntryName.Text = item.Name
  6881. newEntry.Shortcut.Text = item.Shortcut
  6882. if item.Disabled then
  6883. newEntry.EntryName.TextColor3 = Color3.new(150/255,150/255,150/255)
  6884. newEntry.Shortcut.TextColor3 = Color3.new(150/255,150/255,150/255)
  6885. end
  6886.  
  6887. if self.Iconless then
  6888. newEntry.EntryName.Position = UDim2.new(0,2,0,0)
  6889. newEntry.EntryName.Size = UDim2.new(1,-4,0,20)
  6890. newEntry.Icon.Visible = false
  6891. else
  6892. local iconIndex = item.Disabled and item.DisabledIcon or item.Icon
  6893. -- Explorer.MiscIcons:DisplayExplorerIcons(newEntry.Icon, iconIndex)
  6894. if item.IconMap then
  6895. if type(iconIndex) == "number" then
  6896. item.IconMap:Display(newEntry.Icon, iconIndex)
  6897. elseif type(iconIndex) == "string" then
  6898. item.IconMap:DisplayByKey(newEntry.Icon, iconIndex)
  6899. end
  6900. elseif type(iconIndex) == "string" then
  6901. newEntry.Icon.Image = iconIndex
  6902. end
  6903. end
  6904.  
  6905. if not item.Disabled then
  6906. if item.OnClick then
  6907. newEntry.MouseButton1Click:Connect(function()
  6908. item.OnClick(item.Name)
  6909. if not item.NoHide then
  6910. self:Hide()
  6911. end
  6912. end)
  6913. end
  6914.  
  6915. if item.OnRightClick then
  6916. newEntry.MouseButton2Click:Connect(function()
  6917. item.OnRightClick(item.Name)
  6918. if not item.NoHide then
  6919. self:Hide()
  6920. end
  6921. end)
  6922. end
  6923. end
  6924.  
  6925. newEntry.InputBegan:Connect(function(input)
  6926. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  6927. newEntry.BackgroundTransparency = 0
  6928. end
  6929. end)
  6930.  
  6931. newEntry.InputEnded:Connect(function(input)
  6932. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  6933. newEntry.BackgroundTransparency = 1
  6934. end
  6935. end)
  6936.  
  6937. newEntry.Visible = true
  6938. map[item] = newEntry
  6939. newEntry.Parent = contextList
  6940. end
  6941. end
  6942. self.Updated = true
  6943. end
  6944.  
  6945. funcs.Show = function(self,x,y)
  6946. local elems = self.GuiElems
  6947. elems.SearchFrame.Visible = self.SearchEnabled
  6948. elems.List.Position = UDim2.new(0,2,0,2 + (self.SearchEnabled and 24 or 0))
  6949. elems.List.Size = UDim2.new(1,-4,1,-4 - (self.SearchEnabled and 24 or 0))
  6950. if self.SearchEnabled and self.ClearSearchOnShow then elems.SearchBar.Text = "" end
  6951. self.GuiElems.List.CanvasPosition = Vector2.new(0,0)
  6952.  
  6953. if not self.Updated then
  6954. self:Refresh()
  6955. end
  6956.  
  6957. -- Vars
  6958. local reverseY = false
  6959. local x,y = x or mouse.X, y or mouse.Y
  6960. local maxX,maxY = mouse.ViewSizeX,mouse.ViewSizeY
  6961.  
  6962. -- Position and show
  6963. if x + self.Width > maxX then
  6964. x = self.ReverseX and x - self.Width or maxX - self.Width
  6965. end
  6966. elems.Main.Position = UDim2.new(0,x,0,y)
  6967. elems.Main.Size = UDim2.new(0,self.Width,0,0)
  6968. self.Gui.DisplayOrder = Main.DisplayOrders.Menu
  6969. Lib.ShowGui(self.Gui)
  6970.  
  6971. -- Size adjustment
  6972. local toSize = elems.List.UIListLayout.AbsoluteContentSize.Y + 6 -- Padding
  6973. if self.MaxHeight and toSize > self.MaxHeight then
  6974. elems.List.CanvasSize = UDim2.new(0,0,0,toSize-6)
  6975. toSize = self.MaxHeight
  6976. else
  6977. elems.List.CanvasSize = UDim2.new(0,0,0,0)
  6978. end
  6979. if y + toSize > maxY then reverseY = true end
  6980.  
  6981. -- Close event
  6982. local closable
  6983. if self.CloseEvent then self.CloseEvent:Disconnect() end
  6984. self.CloseEvent = service.UserInputService.InputBegan:Connect(function(input)
  6985. if not closable then return end
  6986.  
  6987. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  6988. if not Lib.CheckMouseInGui(elems.Main) then
  6989. self.CloseEvent:Disconnect()
  6990. self:Hide()
  6991. end
  6992. end
  6993. end)
  6994.  
  6995. -- Resize
  6996. if reverseY then
  6997. elems.Main.Position = UDim2.new(0,x,0,y-(self.ReverseYOffset or 0))
  6998. local newY = y - toSize - (self.ReverseYOffset or 0)
  6999. y = newY >= 0 and newY or 0
  7000. elems.Main:TweenSizeAndPosition(UDim2.new(0,self.Width,0,toSize),UDim2.new(0,x,0,y),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,0.2,true)
  7001. else
  7002. elems.Main:TweenSize(UDim2.new(0,self.Width,0,toSize),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,0.2,true)
  7003. end
  7004.  
  7005. -- Close debounce
  7006. Lib.FastWait()
  7007. if self.SearchEnabled and self.FocusSearchOnShow then elems.SearchBar:CaptureFocus() end
  7008. closable = true
  7009. end
  7010.  
  7011. funcs.Hide = function(self)
  7012. self.Gui.Parent = nil
  7013. end
  7014.  
  7015. funcs.ApplyTheme = function(self,data)
  7016. local theme = self.Theme
  7017. theme.ContentColor = data.ContentColor or Settings.Theme.Menu
  7018. theme.OutlineColor = data.OutlineColor or Settings.Theme.Menu
  7019. theme.DividerColor = data.DividerColor or Settings.Theme.Outline2
  7020. theme.TextColor = data.TextColor or Settings.Theme.Text
  7021. theme.HighlightColor = data.HighlightColor or Settings.Theme.Main1
  7022.  
  7023. self.GuiElems.Main.BackgroundColor3 = theme.OutlineColor
  7024. self.GuiElems.Main.Container.BackgroundColor3 = theme.ContentColor
  7025. end
  7026.  
  7027. local mt = {__index = funcs}
  7028. local function new()
  7029. if not mouse then mouse = Main.Mouse or service.Players.LocalPlayer:GetMouse() end
  7030.  
  7031. local obj = setmetatable({
  7032. Width = 200,
  7033. MaxHeight = nil,
  7034. Iconless = false,
  7035. SearchEnabled = false,
  7036. ClearSearchOnShow = true,
  7037. FocusSearchOnShow = true,
  7038. Updated = false,
  7039. QueuedDivider = false,
  7040. QueuedDividerText = "",
  7041. Items = {},
  7042. Registered = {},
  7043. GuiElems = {},
  7044. Theme = {}
  7045. },mt)
  7046. obj.Gui = createGui(obj)
  7047. obj:ApplyTheme({})
  7048. return obj
  7049. end
  7050.  
  7051. return {new = new}
  7052. end)()
  7053.  
  7054. Lib.CodeFrame = (function()
  7055. local funcs = {}
  7056.  
  7057. local typeMap = {
  7058. [1] = "String",
  7059. [2] = "String",
  7060. [3] = "String",
  7061. [4] = "Comment",
  7062. [5] = "Operator",
  7063. [6] = "Number",
  7064. [7] = "Keyword",
  7065. [8] = "BuiltIn",
  7066. [9] = "LocalMethod",
  7067. [10] = "LocalProperty",
  7068. [11] = "Nil",
  7069. [12] = "Bool",
  7070. [13] = "Function",
  7071. [14] = "Local",
  7072. [15] = "Self",
  7073. [16] = "FunctionName",
  7074. [17] = "Bracket"
  7075. }
  7076.  
  7077. local specialKeywordsTypes = {
  7078. ["nil"] = 11,
  7079. ["true"] = 12,
  7080. ["false"] = 12,
  7081. ["function"] = 13,
  7082. ["local"] = 14,
  7083. ["self"] = 15
  7084. }
  7085.  
  7086. local keywords = {
  7087. ["and"] = true,
  7088. ["break"] = true,
  7089. ["do"] = true,
  7090. ["else"] = true,
  7091. ["elseif"] = true,
  7092. ["end"] = true,
  7093. ["false"] = true,
  7094. ["for"] = true,
  7095. ["function"] = true,
  7096. ["if"] = true,
  7097. ["in"] = true,
  7098. ["local"] = true,
  7099. ["nil"] = true,
  7100. ["not"] = true,
  7101. ["or"] = true,
  7102. ["repeat"] = true,
  7103. ["return"] = true,
  7104. ["then"] = true,
  7105. ["true"] = true,
  7106. ["until"] = true,
  7107. ["while"] = true,
  7108. ["plugin"] = true
  7109. }
  7110.  
  7111. local builtIns = {
  7112. ["delay"] = true,
  7113. ["elapsedTime"] = true,
  7114. ["require"] = true,
  7115. ["spawn"] = true,
  7116. ["tick"] = true,
  7117. ["time"] = true,
  7118. ["typeof"] = true,
  7119. ["UserSettings"] = true,
  7120. ["wait"] = true,
  7121. ["warn"] = true,
  7122. ["game"] = true,
  7123. ["shared"] = true,
  7124. ["script"] = true,
  7125. ["workspace"] = true,
  7126. ["assert"] = true,
  7127. ["collectgarbage"] = true,
  7128. ["error"] = true,
  7129. ["getfenv"] = true,
  7130. ["getmetatable"] = true,
  7131. ["ipairs"] = true,
  7132. ["loadstring"] = true,
  7133. ["newproxy"] = true,
  7134. ["next"] = true,
  7135. ["pairs"] = true,
  7136. ["pcall"] = true,
  7137. ["print"] = true,
  7138. ["rawequal"] = true,
  7139. ["rawget"] = true,
  7140. ["rawset"] = true,
  7141. ["select"] = true,
  7142. ["setfenv"] = true,
  7143. ["setmetatable"] = true,
  7144. ["tonumber"] = true,
  7145. ["tostring"] = true,
  7146. ["type"] = true,
  7147. ["unpack"] = true,
  7148. ["xpcall"] = true,
  7149. ["_G"] = true,
  7150. ["_VERSION"] = true,
  7151. ["coroutine"] = true,
  7152. ["debug"] = true,
  7153. ["math"] = true,
  7154. ["os"] = true,
  7155. ["string"] = true,
  7156. ["table"] = true,
  7157. ["bit32"] = true,
  7158. ["utf8"] = true,
  7159. ["Axes"] = true,
  7160. ["BrickColor"] = true,
  7161. ["CFrame"] = true,
  7162. ["Color3"] = true,
  7163. ["ColorSequence"] = true,
  7164. ["ColorSequenceKeypoint"] = true,
  7165. ["DockWidgetPluginGuiInfo"] = true,
  7166. ["Enum"] = true,
  7167. ["Faces"] = true,
  7168. ["Instance"] = true,
  7169. ["NumberRange"] = true,
  7170. ["NumberSequence"] = true,
  7171. ["NumberSequenceKeypoint"] = true,
  7172. ["PathWaypoint"] = true,
  7173. ["PhysicalProperties"] = true,
  7174. ["Random"] = true,
  7175. ["Ray"] = true,
  7176. ["Rect"] = true,
  7177. ["Region3"] = true,
  7178. ["Region3int16"] = true,
  7179. ["TweenInfo"] = true,
  7180. ["UDim"] = true,
  7181. ["UDim2"] = true,
  7182. ["Vector2"] = true,
  7183. ["Vector2int16"] = true,
  7184. ["Vector3"] = true,
  7185. ["Vector3int16"] = true
  7186. }
  7187.  
  7188. local builtInInited = false
  7189.  
  7190. local richReplace = {
  7191. ["'"] = "&apos;",
  7192. ["\""] = "&quot;",
  7193. ["<"] = "&lt;",
  7194. [">"] = "&gt;",
  7195. ["&"] = "&amp;"
  7196. }
  7197.  
  7198. local tabSub = "\t"
  7199. local tabReplacement = (" %s "):format(tabSub)
  7200.  
  7201. local tabJumps = {
  7202. [("[^%s] "):format(tabSub)] = 0,
  7203. [(" %s"):format(tabSub)] = -1,
  7204. [("%s "):format(tabSub)] = 2,
  7205. [(" [^%s]"):format(tabSub)] = 1,
  7206. }
  7207.  
  7208. local tweenService = service.TweenService
  7209. local lineTweens = {}
  7210.  
  7211. local function initBuiltIn()
  7212. local env = getfenv()
  7213. local type = type
  7214. local tostring = tostring
  7215. for name,_ in next,builtIns do
  7216. local envVal = env[name]
  7217. if type(envVal) == "table" then
  7218. local items = {}
  7219. for i,v in next,envVal do
  7220. items[i] = true
  7221. end
  7222. builtIns[name] = items
  7223. end
  7224. end
  7225.  
  7226. local enumEntries = {}
  7227. local enums = Enum:GetEnums()
  7228. for i = 1,#enums do
  7229. enumEntries[tostring(enums[i])] = true
  7230. end
  7231. builtIns["Enum"] = enumEntries
  7232.  
  7233. builtInInited = true
  7234. end
  7235.  
  7236. local function setupEditBox(obj)
  7237. local editBox = obj.GuiElems.EditBox
  7238.  
  7239. editBox.Focused:Connect(function()
  7240. obj:ConnectEditBoxEvent()
  7241. obj.Editing = true
  7242. end)
  7243.  
  7244. editBox.FocusLost:Connect(function()
  7245. obj:DisconnectEditBoxEvent()
  7246. obj.Editing = false
  7247. end)
  7248.  
  7249. editBox:GetPropertyChangedSignal("Text"):Connect(function()
  7250. local text = editBox.Text
  7251. if #text == 0 or obj.EditBoxCopying then return end
  7252. editBox.Text = ""
  7253. obj:AppendText(text)
  7254. end)
  7255. end
  7256.  
  7257. local function setupMouseSelection(obj)
  7258. local mouse = plr:GetMouse()
  7259. local codeFrame = obj.GuiElems.LinesFrame
  7260. local lines = obj.Lines
  7261.  
  7262. codeFrame.InputBegan:Connect(function(input)
  7263. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  7264. local fontSizeX, fontSizeY = math.ceil(obj.FontSize / 2), obj.FontSize
  7265. local relX = input.Position.X - codeFrame.AbsolutePosition.X
  7266. local relY = input.Position.Y - codeFrame.AbsolutePosition.Y
  7267. local selX = math.round(relX / fontSizeX) + obj.ViewX
  7268. local selY = math.floor(relY / fontSizeY) + obj.ViewY
  7269. local releaseEvent, inputEvent, scrollEvent
  7270. local scrollPowerV, scrollPowerH = 0, 0
  7271. selY = math.min(#lines - 1, selY)
  7272. local relativeLine = lines[selY + 1] or ""
  7273. selX = math.min(#relativeLine, selX + obj:TabAdjust(selX, selY))
  7274.  
  7275. obj.SelectionRange = {{-1, -1}, {-1, -1}}
  7276. obj:MoveCursor(selX, selY)
  7277. obj.FloatCursorX = selX
  7278.  
  7279. local function updateSelection()
  7280. local relX = input.Position.X - codeFrame.AbsolutePosition.X
  7281. local relY = input.Position.Y - codeFrame.AbsolutePosition.Y
  7282. local sel2X = math.max(0, math.round(relX / fontSizeX) + obj.ViewX)
  7283. local sel2Y = math.max(0, math.floor(relY / fontSizeY) + obj.ViewY)
  7284.  
  7285. sel2Y = math.min(#lines - 1, sel2Y)
  7286. local relativeLine = lines[sel2Y + 1] or ""
  7287. sel2X = math.min(#relativeLine, sel2X + obj:TabAdjust(sel2X, sel2Y))
  7288.  
  7289. if sel2Y < selY or (sel2Y == selY and sel2X < selX) then
  7290. obj.SelectionRange = {{sel2X, sel2Y}, {selX, selY}}
  7291. else
  7292. obj.SelectionRange = {{selX, selY}, {sel2X, sel2Y}}
  7293. end
  7294.  
  7295. obj:MoveCursor(sel2X, sel2Y)
  7296. obj.FloatCursorX = sel2X
  7297. obj:Refresh()
  7298. end
  7299.  
  7300. releaseEvent = service.UserInputService.InputEnded:Connect(function(input)
  7301. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  7302. releaseEvent:Disconnect()
  7303. inputEvent:Disconnect()
  7304. scrollEvent:Disconnect()
  7305. obj:SetCopyableSelection()
  7306. end
  7307. end)
  7308.  
  7309. inputEvent = service.UserInputService.InputChanged:Connect(function(input)
  7310. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  7311. local upDelta = input.Position.Y - codeFrame.AbsolutePosition.Y
  7312. local downDelta = input.Position.Y - codeFrame.AbsolutePosition.Y - codeFrame.AbsoluteSize.Y
  7313. local leftDelta = input.Position.X - codeFrame.AbsolutePosition.X
  7314. local rightDelta = input.Position.X - codeFrame.AbsolutePosition.X - codeFrame.AbsoluteSize.X
  7315.  
  7316. scrollPowerV = 0
  7317. scrollPowerH = 0
  7318. if downDelta > 0 then
  7319. scrollPowerV = math.floor(downDelta * 0.05) + 1
  7320. elseif upDelta < 0 then
  7321. scrollPowerV = math.ceil(upDelta * 0.05) - 1
  7322. end
  7323. if rightDelta > 0 then
  7324. scrollPowerH = math.floor(rightDelta * 0.05) + 1
  7325. elseif leftDelta < 0 then
  7326. scrollPowerH = math.ceil(leftDelta * 0.05) - 1
  7327. end
  7328. updateSelection()
  7329. end
  7330. end)
  7331.  
  7332. scrollEvent = service.RunService.RenderStepped:Connect(function()
  7333. if scrollPowerV ~= 0 or scrollPowerH ~= 0 then
  7334. obj:ScrollDelta(scrollPowerH, scrollPowerV)
  7335. updateSelection()
  7336. end
  7337. end)
  7338.  
  7339. obj:Refresh()
  7340. end
  7341. end)
  7342.  
  7343. end
  7344.  
  7345. local function makeFrame(obj)
  7346. local frame = create({
  7347. {1,"Frame",{BackgroundColor3=Color3.new(0.15686275064945,0.15686275064945,0.15686275064945),BorderSizePixel = 0,Position=UDim2.new(0.5,-300,0.5,-200),Size=UDim2.new(0,600,0,400),}},
  7348. })
  7349. local elems = {}
  7350.  
  7351. local linesFrame = Instance.new("Frame")
  7352. linesFrame.Name = "Lines"
  7353. linesFrame.BackgroundTransparency = 1
  7354. linesFrame.Size = UDim2.new(1,0,1,0)
  7355. linesFrame.ClipsDescendants = true
  7356. linesFrame.Parent = frame
  7357.  
  7358. local lineNumbersLabel = Instance.new("TextLabel")
  7359. lineNumbersLabel.Name = "LineNumbers"
  7360. lineNumbersLabel.BackgroundTransparency = 1
  7361. lineNumbersLabel.Font = Enum.Font.Code
  7362. lineNumbersLabel.TextXAlignment = Enum.TextXAlignment.Right
  7363. lineNumbersLabel.TextYAlignment = Enum.TextYAlignment.Top
  7364. lineNumbersLabel.ClipsDescendants = true
  7365. lineNumbersLabel.RichText = true
  7366. lineNumbersLabel.Parent = frame
  7367.  
  7368. local cursor = Instance.new("Frame")
  7369. cursor.Name = "Cursor"
  7370. cursor.BackgroundColor3 = Color3.fromRGB(220,220,220)
  7371. cursor.BorderSizePixel = 0
  7372. cursor.Parent = frame
  7373.  
  7374. local editBox = Instance.new("TextBox")
  7375. editBox.Name = "EditBox"
  7376. editBox.MultiLine = true
  7377. editBox.Visible = false
  7378. editBox.Parent = frame
  7379.  
  7380. lineTweens.Invis = tweenService:Create(cursor,TweenInfo.new(0.4,Enum.EasingStyle.Quart,Enum.EasingDirection.Out),{BackgroundTransparency = 1})
  7381. lineTweens.Vis = tweenService:Create(cursor,TweenInfo.new(0.2,Enum.EasingStyle.Quart,Enum.EasingDirection.Out),{BackgroundTransparency = 0})
  7382.  
  7383. elems.LinesFrame = linesFrame
  7384. elems.LineNumbersLabel = lineNumbersLabel
  7385. elems.Cursor = cursor
  7386. elems.EditBox = editBox
  7387. elems.ScrollCorner = create({{1,"Frame",{BackgroundColor3=Color3.new(0.15686275064945,0.15686275064945,0.15686275064945),BorderSizePixel=0,Name="ScrollCorner",Position=UDim2.new(1,-16,1,-16),Size=UDim2.new(0,16,0,16),Visible=false,}}})
  7388.  
  7389. elems.ScrollCorner.Parent = frame
  7390. linesFrame.InputBegan:Connect(function(input)
  7391. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  7392. obj:SetEditing(true, input)
  7393. end
  7394. end)
  7395.  
  7396.  
  7397. obj.Frame = frame
  7398. obj.Gui = frame
  7399. obj.GuiElems = elems
  7400. setupEditBox(obj)
  7401. setupMouseSelection(obj)
  7402.  
  7403. return frame
  7404. end
  7405.  
  7406. funcs.GetSelectionText = function(self)
  7407. if not self:IsValidRange() then return "" end
  7408.  
  7409. local selectionRange = self.SelectionRange
  7410. local selX,selY = selectionRange[1][1], selectionRange[1][2]
  7411. local sel2X,sel2Y = selectionRange[2][1], selectionRange[2][2]
  7412. local deltaLines = sel2Y-selY
  7413. local lines = self.Lines
  7414.  
  7415. if not lines[selY+1] or not lines[sel2Y+1] then return "" end
  7416.  
  7417. if deltaLines == 0 then
  7418. return self:ConvertText(lines[selY+1]:sub(selX+1,sel2X), false)
  7419. end
  7420.  
  7421. local leftSub = lines[selY+1]:sub(selX+1)
  7422. local rightSub = lines[sel2Y+1]:sub(1,sel2X)
  7423.  
  7424. local result = leftSub.."\n"
  7425. for i = selY+1,sel2Y-1 do
  7426. result = result..lines[i+1].."\n"
  7427. end
  7428. result = result..rightSub
  7429.  
  7430. return self:ConvertText(result,false)
  7431. end
  7432.  
  7433. funcs.SetCopyableSelection = function(self)
  7434. local text = self:GetSelectionText()
  7435. local editBox = self.GuiElems.EditBox
  7436.  
  7437. self.EditBoxCopying = true
  7438. editBox.Text = text
  7439. editBox.SelectionStart = 1
  7440. editBox.CursorPosition = #editBox.Text + 1
  7441. self.EditBoxCopying = false
  7442. end
  7443.  
  7444. funcs.ConnectEditBoxEvent = function(self)
  7445. if self.EditBoxEvent then
  7446. self.EditBoxEvent:Disconnect()
  7447. end
  7448.  
  7449. self.EditBoxEvent = service.UserInputService.InputBegan:Connect(function(input)
  7450. if input.UserInputType ~= Enum.UserInputType.Keyboard then return end
  7451.  
  7452. local keycodes = Enum.KeyCode
  7453. local keycode = input.KeyCode
  7454.  
  7455. local function setupMove(key,func)
  7456. local endCon,finished
  7457. endCon = service.UserInputService.InputEnded:Connect(function(input)
  7458. if input.KeyCode ~= key then return end
  7459. endCon:Disconnect()
  7460. finished = true
  7461. end)
  7462. func()
  7463. Lib.FastWait(0.5)
  7464. while not finished do func() Lib.FastWait(0.03) end
  7465. end
  7466.  
  7467. if keycode == keycodes.Down then
  7468. setupMove(keycodes.Down,function()
  7469. self.CursorX = self.FloatCursorX
  7470. self.CursorY = self.CursorY + 1
  7471. self:UpdateCursor()
  7472. self:JumpToCursor()
  7473. end)
  7474. elseif keycode == keycodes.Up then
  7475. setupMove(keycodes.Up,function()
  7476. self.CursorX = self.FloatCursorX
  7477. self.CursorY = self.CursorY - 1
  7478. self:UpdateCursor()
  7479. self:JumpToCursor()
  7480. end)
  7481. elseif keycode == keycodes.Left then
  7482. setupMove(keycodes.Left,function()
  7483. local line = self.Lines[self.CursorY+1] or ""
  7484. self.CursorX = self.CursorX - 1 - (line:sub(self.CursorX-3,self.CursorX) == tabReplacement and 3 or 0)
  7485. if self.CursorX < 0 then
  7486. self.CursorY = self.CursorY - 1
  7487. local line2 = self.Lines[self.CursorY+1] or ""
  7488. self.CursorX = #line2
  7489. end
  7490. self.FloatCursorX = self.CursorX
  7491. self:UpdateCursor()
  7492. self:JumpToCursor()
  7493. end)
  7494. elseif keycode == keycodes.Right then
  7495. setupMove(keycodes.Right,function()
  7496. local line = self.Lines[self.CursorY+1] or ""
  7497. self.CursorX = self.CursorX + 1 + (line:sub(self.CursorX+1,self.CursorX+4) == tabReplacement and 3 or 0)
  7498. if self.CursorX > #line then
  7499. self.CursorY = self.CursorY + 1
  7500. self.CursorX = 0
  7501. end
  7502. self.FloatCursorX = self.CursorX
  7503. self:UpdateCursor()
  7504. self:JumpToCursor()
  7505. end)
  7506. elseif keycode == keycodes.Backspace then
  7507. setupMove(keycodes.Backspace,function()
  7508. local startRange,endRange
  7509. if self:IsValidRange() then
  7510. startRange = self.SelectionRange[1]
  7511. endRange = self.SelectionRange[2]
  7512. else
  7513. endRange = {self.CursorX,self.CursorY}
  7514. end
  7515.  
  7516. if not startRange then
  7517. local line = self.Lines[self.CursorY+1] or ""
  7518. self.CursorX = self.CursorX - 1 - (line:sub(self.CursorX-3,self.CursorX) == tabReplacement and 3 or 0)
  7519. if self.CursorX < 0 then
  7520. self.CursorY = self.CursorY - 1
  7521. local line2 = self.Lines[self.CursorY+1] or ""
  7522. self.CursorX = #line2
  7523. end
  7524. self.FloatCursorX = self.CursorX
  7525. self:UpdateCursor()
  7526.  
  7527. startRange = startRange or {self.CursorX,self.CursorY}
  7528. end
  7529.  
  7530. self:DeleteRange({startRange,endRange},false,true)
  7531. self:ResetSelection(true)
  7532. self:JumpToCursor()
  7533. end)
  7534. elseif keycode == keycodes.Delete then
  7535. setupMove(keycodes.Delete,function()
  7536. local startRange,endRange
  7537. if self:IsValidRange() then
  7538. startRange = self.SelectionRange[1]
  7539. endRange = self.SelectionRange[2]
  7540. else
  7541. startRange = {self.CursorX,self.CursorY}
  7542. end
  7543.  
  7544. if not endRange then
  7545. local line = self.Lines[self.CursorY+1] or ""
  7546. local endCursorX = self.CursorX + 1 + (line:sub(self.CursorX+1,self.CursorX+4) == tabReplacement and 3 or 0)
  7547. local endCursorY = self.CursorY
  7548. if endCursorX > #line then
  7549. endCursorY = endCursorY + 1
  7550. endCursorX = 0
  7551. end
  7552. self:UpdateCursor()
  7553.  
  7554. endRange = endRange or {endCursorX,endCursorY}
  7555. end
  7556.  
  7557. self:DeleteRange({startRange,endRange},false,true)
  7558. self:ResetSelection(true)
  7559. self:JumpToCursor()
  7560. end)
  7561. elseif service.UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then
  7562. if keycode == keycodes.A then
  7563. self.SelectionRange = {{0,0},{#self.Lines[#self.Lines],#self.Lines-1}}
  7564. self:SetCopyableSelection()
  7565. self:Refresh()
  7566. end
  7567. end
  7568. end)
  7569. end
  7570.  
  7571. funcs.DisconnectEditBoxEvent = function(self)
  7572. if self.EditBoxEvent then
  7573. self.EditBoxEvent:Disconnect()
  7574. end
  7575. end
  7576.  
  7577. funcs.ResetSelection = function(self,norefresh)
  7578. self.SelectionRange = {{-1,-1},{-1,-1}}
  7579. if not norefresh then self:Refresh() end
  7580. end
  7581.  
  7582. funcs.IsValidRange = function(self,range)
  7583. local selectionRange = range or self.SelectionRange
  7584. local selX,selY = selectionRange[1][1], selectionRange[1][2]
  7585. local sel2X,sel2Y = selectionRange[2][1], selectionRange[2][2]
  7586.  
  7587. if selX == -1 or (selX == sel2X and selY == sel2Y) then return false end
  7588.  
  7589. return true
  7590. end
  7591.  
  7592. funcs.DeleteRange = function(self,range,noprocess,updatemouse)
  7593. range = range or self.SelectionRange
  7594. if not self:IsValidRange(range) then return end
  7595.  
  7596. local lines = self.Lines
  7597. local selX,selY = range[1][1], range[1][2]
  7598. local sel2X,sel2Y = range[2][1], range[2][2]
  7599. local deltaLines = sel2Y-selY
  7600.  
  7601. if not lines[selY+1] or not lines[sel2Y+1] then return end
  7602.  
  7603. local leftSub = lines[selY+1]:sub(1,selX)
  7604. local rightSub = lines[sel2Y+1]:sub(sel2X+1)
  7605. lines[selY+1] = leftSub..rightSub
  7606.  
  7607. local remove = table.remove
  7608. for i = 1,deltaLines do
  7609. remove(lines,selY+2)
  7610. end
  7611.  
  7612. if range == self.SelectionRange then self.SelectionRange = {{-1,-1},{-1,-1}} end
  7613. if updatemouse then
  7614. self.CursorX = selX
  7615. self.CursorY = selY
  7616. self:UpdateCursor()
  7617. end
  7618.  
  7619. if not noprocess then
  7620. self:ProcessTextChange()
  7621. end
  7622. end
  7623.  
  7624. funcs.AppendText = function(self,text)
  7625. self:DeleteRange(nil,true,true)
  7626. local lines,cursorX,cursorY = self.Lines,self.CursorX,self.CursorY
  7627. local line = lines[cursorY+1]
  7628. local before = line:sub(1,cursorX)
  7629. local after = line:sub(cursorX+1)
  7630.  
  7631. text = text:gsub("\r\n","\n")
  7632. text = self:ConvertText(text,true) -- Tab Convert
  7633.  
  7634. local textLines = text:split("\n")
  7635. local insert = table.insert
  7636.  
  7637. for i = 1,#textLines do
  7638. local linePos = cursorY+i
  7639. if i > 1 then insert(lines,linePos,"") end
  7640.  
  7641. local textLine = textLines[i]
  7642. local newBefore = (i == 1 and before or "")
  7643. local newAfter = (i == #textLines and after or "")
  7644.  
  7645. lines[linePos] = newBefore..textLine..newAfter
  7646. end
  7647.  
  7648. if #textLines > 1 then cursorX = 0 end
  7649.  
  7650. self:ProcessTextChange()
  7651. self.CursorX = cursorX + #textLines[#textLines]
  7652. self.CursorY = cursorY + #textLines-1
  7653. self:UpdateCursor()
  7654. end
  7655.  
  7656. funcs.ScrollDelta = function(self,x,y)
  7657. self.ScrollV:ScrollTo(self.ScrollV.Index + y)
  7658. self.ScrollH:ScrollTo(self.ScrollH.Index + x)
  7659. end
  7660.  
  7661. -- x and y starts at 0
  7662. funcs.TabAdjust = function(self,x,y)
  7663. local lines = self.Lines
  7664. local line = lines[y+1]
  7665. x=x+1
  7666.  
  7667. if line then
  7668. local left = line:sub(x-1,x-1)
  7669. local middle = line:sub(x,x)
  7670. local right = line:sub(x+1,x+1)
  7671. local selRange = (#left > 0 and left or " ") .. (#middle > 0 and middle or " ") .. (#right > 0 and right or " ")
  7672.  
  7673. for i,v in pairs(tabJumps) do
  7674. if selRange:find(i) then
  7675. return v
  7676. end
  7677. end
  7678. end
  7679. return 0
  7680. end
  7681.  
  7682. funcs.SetEditing = function(self,on,input)
  7683. self:UpdateCursor(input)
  7684.  
  7685. if on then
  7686. if self.Editable then
  7687. self.GuiElems.EditBox.Text = ""
  7688. self.GuiElems.EditBox:CaptureFocus()
  7689. end
  7690. else
  7691. self.GuiElems.EditBox:ReleaseFocus()
  7692. end
  7693. end
  7694.  
  7695. funcs.CursorAnim = function(self,on)
  7696. local cursor = self.GuiElems.Cursor
  7697. local animTime = tick()
  7698. self.LastAnimTime = animTime
  7699.  
  7700. if not on then return end
  7701.  
  7702. lineTweens.Invis:Cancel()
  7703. lineTweens.Vis:Cancel()
  7704. cursor.BackgroundTransparency = 0
  7705.  
  7706. coroutine.wrap(function()
  7707. while self.Editable do
  7708. Lib.FastWait(0.5)
  7709. if self.LastAnimTime ~= animTime then return end
  7710. lineTweens.Invis:Play()
  7711. Lib.FastWait(0.4)
  7712. if self.LastAnimTime ~= animTime then return end
  7713. lineTweens.Vis:Play()
  7714. Lib.FastWait(0.2)
  7715. end
  7716. end)()
  7717. end
  7718.  
  7719. funcs.MoveCursor = function(self,x,y)
  7720. self.CursorX = x
  7721. self.CursorY = y
  7722. self:UpdateCursor()
  7723. self:JumpToCursor()
  7724. end
  7725.  
  7726. funcs.JumpToCursor = function(self)
  7727. self:Refresh()
  7728. end
  7729.  
  7730. funcs.UpdateCursor = function(self,input)
  7731. local linesFrame = self.GuiElems.LinesFrame
  7732. local cursor = self.GuiElems.Cursor
  7733. local hSize = math.max(0,linesFrame.AbsoluteSize.X)
  7734. local vSize = math.max(0,linesFrame.AbsoluteSize.Y)
  7735. local maxLines = math.ceil(vSize / self.FontSize)
  7736. local maxCols = math.ceil(hSize / math.ceil(self.FontSize/2))
  7737. local viewX,viewY = self.ViewX,self.ViewY
  7738. local totalLinesStr = tostring(#self.Lines)
  7739. local fontWidth = math.ceil(self.FontSize / 2)
  7740. local linesOffset = #totalLinesStr*fontWidth + 4*fontWidth
  7741.  
  7742. if input then
  7743. local linesFrame = self.GuiElems.LinesFrame
  7744. local frameX,frameY = linesFrame.AbsolutePosition.X,linesFrame.AbsolutePosition.Y
  7745. local mouseX,mouseY = input.Position.X,input.Position.Y
  7746. local fontSizeX,fontSizeY = math.ceil(self.FontSize/2),self.FontSize
  7747.  
  7748. self.CursorX = self.ViewX + math.round((mouseX - frameX) / fontSizeX)
  7749. self.CursorY = self.ViewY + math.floor((mouseY - frameY) / fontSizeY)
  7750. end
  7751.  
  7752. local cursorX,cursorY = self.CursorX,self.CursorY
  7753.  
  7754. local line = self.Lines[cursorY+1] or ""
  7755. if cursorX > #line then cursorX = #line
  7756. elseif cursorX < 0 then cursorX = 0 end
  7757.  
  7758. if cursorY >= #self.Lines then
  7759. cursorY = math.max(0,#self.Lines-1)
  7760. elseif cursorY < 0 then
  7761. cursorY = 0
  7762. end
  7763.  
  7764. cursorX = cursorX + self:TabAdjust(cursorX,cursorY)
  7765.  
  7766. -- Update modified
  7767. self.CursorX = cursorX
  7768. self.CursorY = cursorY
  7769.  
  7770. local cursorVisible = (cursorX >= viewX) and (cursorY >= viewY) and (cursorX <= viewX + maxCols) and (cursorY <= viewY + maxLines)
  7771. if cursorVisible then
  7772. local offX = (cursorX - viewX)
  7773. local offY = (cursorY - viewY)
  7774. cursor.Position = UDim2.new(0,linesOffset + offX*math.ceil(self.FontSize/2) - 1,0,offY*self.FontSize)
  7775. cursor.Size = UDim2.new(0,1,0,self.FontSize+2)
  7776. cursor.Visible = true
  7777. self:CursorAnim(true)
  7778. else
  7779. cursor.Visible = false
  7780. end
  7781. end
  7782.  
  7783. funcs.MapNewLines = function(self)
  7784. local newLines = {}
  7785. local count = 1
  7786. local text = self.Text
  7787. local find = string.find
  7788. local init = 1
  7789.  
  7790. local pos = find(text,"\n",init,true)
  7791. while pos do
  7792. newLines[count] = pos
  7793. count = count + 1
  7794. init = pos + 1
  7795. pos = find(text,"\n",init,true)
  7796. end
  7797.  
  7798. self.NewLines = newLines
  7799. end
  7800.  
  7801. funcs.PreHighlight = function(self)
  7802. local start = tick()
  7803. local text = self.Text:gsub("\\\\"," ")
  7804. --print("BACKSLASH SUB",tick()-start)
  7805. local textLen = #text
  7806. local found = {}
  7807. local foundMap = {}
  7808. local extras = {}
  7809. local find = string.find
  7810. local sub = string.sub
  7811. self.ColoredLines = {}
  7812.  
  7813. local function findAll(str,pattern,typ,raw)
  7814. local count = #found+1
  7815. local init = 1
  7816. local x,y,extra = find(str,pattern,init,raw)
  7817. while x do
  7818. found[count] = x
  7819. foundMap[x] = typ
  7820. if extra then
  7821. extras[x] = extra
  7822. end
  7823.  
  7824. count = count+1
  7825. init = y+1
  7826. x,y,extra = find(str,pattern,init,raw)
  7827. end
  7828. end
  7829. local start = tick()
  7830. findAll(text,'"',1,true)
  7831. findAll(text,"'",2,true)
  7832. findAll(text,"%[(=*)%[",3)
  7833. findAll(text,"--",4,true)
  7834. table.sort(found)
  7835.  
  7836. local newLines = self.NewLines
  7837. local curLine = 0
  7838. local lineTableCount = 1
  7839. local lineStart = 0
  7840. local lineEnd = 0
  7841. local lastEnding = 0
  7842. local foundHighlights = {}
  7843.  
  7844. for i = 1,#found do
  7845. local pos = found[i]
  7846. if pos <= lastEnding then continue end
  7847.  
  7848. local ending = pos
  7849. local typ = foundMap[pos]
  7850. if typ == 1 then
  7851. ending = find(text,'"',pos+1,true)
  7852. while ending and sub(text,ending-1,ending-1) == "\\" do
  7853. ending = find(text,'"',ending+1,true)
  7854. end
  7855. if not ending then ending = textLen end
  7856. elseif typ == 2 then
  7857. ending = find(text,"'",pos+1,true)
  7858. while ending and sub(text,ending-1,ending-1) == "\\" do
  7859. ending = find(text,"'",ending+1,true)
  7860. end
  7861. if not ending then ending = textLen end
  7862. elseif typ == 3 then
  7863. _,ending = find(text,"]"..extras[pos].."]",pos+1,true)
  7864. if not ending then ending = textLen end
  7865. elseif typ == 4 then
  7866. local ahead = foundMap[pos+2]
  7867.  
  7868. if ahead == 3 then
  7869. _,ending = find(text,"]"..extras[pos+2].."]",pos+1,true)
  7870. if not ending then ending = textLen end
  7871. else
  7872. ending = find(text,"\n",pos+1,true) or textLen
  7873. end
  7874. end
  7875.  
  7876. while pos > lineEnd do
  7877. curLine = curLine + 1
  7878. --lineTableCount = 1
  7879. lineEnd = newLines[curLine] or textLen+1
  7880. end
  7881. while true do
  7882. local lineTable = foundHighlights[curLine]
  7883. if not lineTable then lineTable = {} foundHighlights[curLine] = lineTable end
  7884. lineTable[pos] = {typ,ending}
  7885. --lineTableCount = lineTableCount + 1
  7886.  
  7887. if ending > lineEnd then
  7888. curLine = curLine + 1
  7889. lineEnd = newLines[curLine] or textLen+1
  7890. else
  7891. break
  7892. end
  7893. end
  7894.  
  7895. lastEnding = ending
  7896. --if i < 200 then print(curLine) end
  7897. end
  7898. self.PreHighlights = foundHighlights
  7899. --print(tick()-start)
  7900. --print(#found,curLine)
  7901. end
  7902.  
  7903. funcs.HighlightLine = function(self,line)
  7904. local cached = self.ColoredLines[line]
  7905. if cached then return cached end
  7906.  
  7907. local sub = string.sub
  7908. local find = string.find
  7909. local match = string.match
  7910. local highlights = {}
  7911. local preHighlights = self.PreHighlights[line] or {}
  7912. local lineText = self.Lines[line] or ""
  7913. local lineLen = #lineText
  7914. local lastEnding = 0
  7915. local currentType = 0
  7916. local lastWord = nil
  7917. local wordBeginsDotted = false
  7918. local funcStatus = 0
  7919. local lineStart = self.NewLines[line-1] or 0
  7920.  
  7921. local preHighlightMap = {}
  7922. for pos,data in next,preHighlights do
  7923. local relativePos = pos-lineStart
  7924. if relativePos < 1 then
  7925. currentType = data[1]
  7926. lastEnding = data[2] - lineStart
  7927. --warn(pos,data[2])
  7928. else
  7929. preHighlightMap[relativePos] = {data[1],data[2]-lineStart}
  7930. end
  7931. end
  7932.  
  7933. for col = 1,#lineText do
  7934. if col <= lastEnding then highlights[col] = currentType continue end
  7935.  
  7936. local pre = preHighlightMap[col]
  7937. if pre then
  7938. currentType = pre[1]
  7939. lastEnding = pre[2]
  7940. highlights[col] = currentType
  7941. wordBeginsDotted = false
  7942. lastWord = nil
  7943. funcStatus = 0
  7944. else
  7945. local char = sub(lineText,col,col)
  7946. if find(char,"[%a_]") then
  7947. local word = match(lineText,"[%a%d_]+",col)
  7948. local wordType = (keywords[word] and 7) or (builtIns[word] and 8)
  7949.  
  7950. lastEnding = col+#word-1
  7951.  
  7952. if wordType ~= 7 then
  7953. if wordBeginsDotted then
  7954. local prevBuiltIn = lastWord and builtIns[lastWord]
  7955. wordType = (prevBuiltIn and type(prevBuiltIn) == "table" and prevBuiltIn[word] and 8) or 10
  7956. end
  7957.  
  7958. if wordType ~= 8 then
  7959. local x,y,br = find(lineText,"^%s*([%({\"'])",lastEnding+1)
  7960. if x then
  7961. wordType = (funcStatus > 0 and br == "(" and 16) or 9
  7962. funcStatus = 0
  7963. end
  7964. end
  7965. else
  7966. wordType = specialKeywordsTypes[word] or wordType
  7967. funcStatus = (word == "function" and 1 or 0)
  7968. end
  7969.  
  7970. lastWord = word
  7971. wordBeginsDotted = false
  7972. if funcStatus > 0 then funcStatus = 1 end
  7973.  
  7974. if wordType then
  7975. currentType = wordType
  7976. highlights[col] = currentType
  7977. else
  7978. currentType = nil
  7979. end
  7980. elseif find(char,"%p") then
  7981. local isDot = (char == ".")
  7982. local isNum = isDot and find(sub(lineText,col+1,col+1),"%d")
  7983. highlights[col] = (isNum and 6 or 5)
  7984.  
  7985. if not isNum then
  7986. local dotStr = isDot and match(lineText,"%.%.?%.?",col)
  7987. if dotStr and #dotStr > 1 then
  7988. currentType = 5
  7989. lastEnding = col+#dotStr-1
  7990. wordBeginsDotted = false
  7991. lastWord = nil
  7992. funcStatus = 0
  7993. else
  7994. if isDot then
  7995. if wordBeginsDotted then
  7996. lastWord = nil
  7997. else
  7998. wordBeginsDotted = true
  7999. end
  8000. else
  8001. wordBeginsDotted = false
  8002. lastWord = nil
  8003. end
  8004.  
  8005. funcStatus = ((isDot or char == ":") and funcStatus == 1 and 2) or 0
  8006. end
  8007. end
  8008. elseif find(char,"%d") then
  8009. local _,endPos = find(lineText,"%x+",col)
  8010. local endPart = sub(lineText,endPos,endPos+1)
  8011. if (endPart == "e+" or endPart == "e-") and find(sub(lineText,endPos+2,endPos+2),"%d") then
  8012. endPos = endPos + 1
  8013. end
  8014. currentType = 6
  8015. lastEnding = endPos
  8016. highlights[col] = 6
  8017. wordBeginsDotted = false
  8018. lastWord = nil
  8019. funcStatus = 0
  8020. else
  8021. highlights[col] = currentType
  8022. local _,endPos = find(lineText,"%s+",col)
  8023. if endPos then
  8024. lastEnding = endPos
  8025. end
  8026. end
  8027. end
  8028. end
  8029.  
  8030. self.ColoredLines[line] = highlights
  8031. return highlights
  8032. end
  8033.  
  8034. funcs.Refresh = function(self)
  8035. local start = tick()
  8036.  
  8037. local linesFrame = self.Frame.Lines
  8038. local hSize = math.max(0,linesFrame.AbsoluteSize.X)
  8039. local vSize = math.max(0,linesFrame.AbsoluteSize.Y)
  8040. local maxLines = math.ceil(vSize / self.FontSize)
  8041. local maxCols = math.ceil(hSize / math.ceil(self.FontSize/2))
  8042. local gsub = string.gsub
  8043. local sub = string.sub
  8044.  
  8045. local viewX,viewY = self.ViewX,self.ViewY
  8046.  
  8047. local lineNumberStr = ""
  8048.  
  8049. for row = 1,maxLines do
  8050. local lineFrame = self.LineFrames[row]
  8051. if not lineFrame then
  8052. lineFrame = Instance.new("Frame")
  8053. lineFrame.Name = "Line"
  8054. lineFrame.Position = UDim2.new(0,0,0,(row-1)*self.FontSize)
  8055. lineFrame.Size = UDim2.new(1,0,0,self.FontSize)
  8056. lineFrame.BorderSizePixel = 0
  8057. lineFrame.BackgroundTransparency = 1
  8058.  
  8059. local selectionHighlight = Instance.new("Frame")
  8060. selectionHighlight.Name = "SelectionHighlight"
  8061. selectionHighlight.BorderSizePixel = 0
  8062. selectionHighlight.BackgroundColor3 = Settings.Theme.Syntax.SelectionBack
  8063. selectionHighlight.Parent = lineFrame
  8064.  
  8065. local label = Instance.new("TextLabel")
  8066. label.Name = "Label"
  8067. label.BackgroundTransparency = 1
  8068. label.Font = Enum.Font.Code
  8069. label.TextSize = self.FontSize
  8070. label.Size = UDim2.new(1,0,0,self.FontSize)
  8071. label.RichText = true
  8072. label.TextXAlignment = Enum.TextXAlignment.Left
  8073. label.TextColor3 = self.Colors.Text
  8074. label.ZIndex = 2
  8075. label.Parent = lineFrame
  8076.  
  8077. lineFrame.Parent = linesFrame
  8078. self.LineFrames[row] = lineFrame
  8079. end
  8080.  
  8081. local relaY = viewY + row
  8082. local lineText = self.Lines[relaY] or ""
  8083. local resText = ""
  8084. local highlights = self:HighlightLine(relaY)
  8085. local colStart = viewX + 1
  8086.  
  8087. local richTemplates = self.RichTemplates
  8088. local textTemplate = richTemplates.Text
  8089. local selectionTemplate = richTemplates.Selection
  8090. local curType = highlights[colStart]
  8091. local curTemplate = richTemplates[typeMap[curType]] or textTemplate
  8092.  
  8093. -- Selection Highlight
  8094. local selectionRange = self.SelectionRange
  8095. local selPos1 = selectionRange[1]
  8096. local selPos2 = selectionRange[2]
  8097. local selRow,selColumn = selPos1[2],selPos1[1]
  8098. local sel2Row,sel2Column = selPos2[2],selPos2[1]
  8099. local selRelaX,selRelaY = viewX,relaY-1
  8100.  
  8101. if selRelaY >= selPos1[2] and selRelaY <= selPos2[2] then
  8102. local fontSizeX = math.ceil(self.FontSize/2)
  8103. local posX = (selRelaY == selPos1[2] and selPos1[1] or 0) - viewX
  8104. local sizeX = (selRelaY == selPos2[2] and selPos2[1]-posX-viewX or maxCols+viewX)
  8105.  
  8106. lineFrame.SelectionHighlight.Position = UDim2.new(0,posX*fontSizeX,0,0)
  8107. lineFrame.SelectionHighlight.Size = UDim2.new(0,sizeX*fontSizeX,1,0)
  8108. lineFrame.SelectionHighlight.Visible = true
  8109. else
  8110. lineFrame.SelectionHighlight.Visible = false
  8111. end
  8112.  
  8113. -- Selection Text Color for first char
  8114. local inSelection = selRelaY >= selRow and selRelaY <= sel2Row and (selRelaY == selRow and viewX >= selColumn or selRelaY ~= selRow) and (selRelaY == sel2Row and viewX < sel2Column or selRelaY ~= sel2Row)
  8115. if inSelection then
  8116. curType = -999
  8117. curTemplate = selectionTemplate
  8118. end
  8119.  
  8120. for col = 2,maxCols do
  8121. local relaX = viewX + col
  8122. local selRelaX = relaX-1
  8123. local posType = highlights[relaX]
  8124.  
  8125. -- Selection Text Color
  8126. local inSelection = selRelaY >= selRow and selRelaY <= sel2Row and (selRelaY == selRow and selRelaX >= selColumn or selRelaY ~= selRow) and (selRelaY == sel2Row and selRelaX < sel2Column or selRelaY ~= sel2Row)
  8127. if inSelection then
  8128. posType = -999
  8129. end
  8130.  
  8131. if posType ~= curType then
  8132. local template = (inSelection and selectionTemplate) or richTemplates[typeMap[posType]] or textTemplate
  8133.  
  8134. if template ~= curTemplate then
  8135. local nextText = gsub(sub(lineText,colStart,relaX-1),"['\"<>&]",richReplace)
  8136. resText = resText .. (curTemplate ~= textTemplate and (curTemplate .. nextText .. "</font>") or nextText)
  8137. colStart = relaX
  8138. curTemplate = template
  8139. end
  8140. curType = posType
  8141. end
  8142. end
  8143.  
  8144. local lastText = gsub(sub(lineText,colStart,viewX+maxCols),"['\"<>&]",richReplace)
  8145. --warn("SUB",colStart,viewX+maxCols-1)
  8146. if #lastText > 0 then
  8147. resText = resText .. (curTemplate ~= textTemplate and (curTemplate .. lastText .. "</font>") or lastText)
  8148. end
  8149.  
  8150. if self.Lines[relaY] then
  8151. lineNumberStr = lineNumberStr .. (relaY == self.CursorY and ("<b>"..relaY.."</b>\n") or relaY .. "\n")
  8152. end
  8153.  
  8154. lineFrame.Label.Text = resText
  8155. end
  8156.  
  8157. for i = maxLines+1,#self.LineFrames do
  8158. self.LineFrames[i]:Destroy()
  8159. self.LineFrames[i] = nil
  8160. end
  8161.  
  8162. self.Frame.LineNumbers.Text = lineNumberStr
  8163. self:UpdateCursor()
  8164.  
  8165. --print("REFRESH TIME",tick()-start)
  8166. end
  8167.  
  8168. funcs.UpdateView = function(self)
  8169. local totalLinesStr = tostring(#self.Lines)
  8170. local fontWidth = math.ceil(self.FontSize / 2)
  8171. local linesOffset = #totalLinesStr*fontWidth + 4*fontWidth
  8172.  
  8173. local linesFrame = self.Frame.Lines
  8174. local hSize = linesFrame.AbsoluteSize.X
  8175. local vSize = linesFrame.AbsoluteSize.Y
  8176. local maxLines = math.ceil(vSize / self.FontSize)
  8177. local totalWidth = self.MaxTextCols*fontWidth
  8178. local scrollV = self.ScrollV
  8179. local scrollH = self.ScrollH
  8180.  
  8181. scrollV.VisibleSpace = maxLines
  8182. scrollV.TotalSpace = #self.Lines + 1
  8183. scrollH.VisibleSpace = math.ceil(hSize/fontWidth)
  8184. scrollH.TotalSpace = self.MaxTextCols + 1
  8185.  
  8186. scrollV.Gui.Visible = #self.Lines + 1 > maxLines
  8187. scrollH.Gui.Visible = totalWidth > hSize
  8188.  
  8189. local oldOffsets = self.FrameOffsets
  8190. self.FrameOffsets = Vector2.new(scrollV.Gui.Visible and -16 or 0, scrollH.Gui.Visible and -16 or 0)
  8191. if oldOffsets ~= self.FrameOffsets then
  8192. self:UpdateView()
  8193. else
  8194. scrollV:ScrollTo(self.ViewY,true)
  8195. scrollH:ScrollTo(self.ViewX,true)
  8196.  
  8197. if scrollV.Gui.Visible and scrollH.Gui.Visible then
  8198. scrollV.Gui.Size = UDim2.new(0,16,1,-16)
  8199. scrollH.Gui.Size = UDim2.new(1,-16,0,16)
  8200. self.GuiElems.ScrollCorner.Visible = true
  8201. else
  8202. scrollV.Gui.Size = UDim2.new(0,16,1,0)
  8203. scrollH.Gui.Size = UDim2.new(1,0,0,16)
  8204. self.GuiElems.ScrollCorner.Visible = false
  8205. end
  8206.  
  8207. self.ViewY = scrollV.Index
  8208. self.ViewX = scrollH.Index
  8209. self.Frame.Lines.Position = UDim2.new(0,linesOffset,0,0)
  8210. self.Frame.Lines.Size = UDim2.new(1,-linesOffset+oldOffsets.X,1,oldOffsets.Y)
  8211. self.Frame.LineNumbers.Position = UDim2.new(0,fontWidth,0,0)
  8212. self.Frame.LineNumbers.Size = UDim2.new(0,#totalLinesStr*fontWidth,1,oldOffsets.Y)
  8213. self.Frame.LineNumbers.TextSize = self.FontSize
  8214. end
  8215. end
  8216.  
  8217. funcs.ProcessTextChange = function(self)
  8218. local maxCols = 0
  8219. local lines = self.Lines
  8220.  
  8221. for i = 1,#lines do
  8222. local lineLen = #lines[i]
  8223. if lineLen > maxCols then
  8224. maxCols = lineLen
  8225. end
  8226. end
  8227.  
  8228. self.MaxTextCols = maxCols
  8229. self:UpdateView()
  8230. self.Text = table.concat(self.Lines,"\n")
  8231. self:MapNewLines()
  8232. self:PreHighlight()
  8233. self:Refresh()
  8234. --self.TextChanged:Fire()
  8235. end
  8236.  
  8237. funcs.ConvertText = function(self,text,toEditor)
  8238. if toEditor then
  8239. return text:gsub("\t",(" %s "):format(tabSub))
  8240. else
  8241. return text:gsub((" %s "):format(tabSub),"\t")
  8242. end
  8243. end
  8244.  
  8245. funcs.GetText = function(self) -- TODO: better (use new tab format)
  8246. local source = table.concat(self.Lines,"\n")
  8247. return self:ConvertText(source,false) -- Tab Convert
  8248. end
  8249.  
  8250. funcs.SetText = function(self,txt)
  8251. txt = self:ConvertText(txt,true) -- Tab Convert
  8252. local lines = self.Lines
  8253. table.clear(lines)
  8254. local count = 1
  8255.  
  8256. for line in txt:gmatch("([^\n\r]*)[\n\r]?") do
  8257. local len = #line
  8258. lines[count] = line
  8259. count = count + 1
  8260. end
  8261.  
  8262. self:ProcessTextChange()
  8263. end
  8264.  
  8265. funcs.MakeRichTemplates = function(self)
  8266. local floor = math.floor
  8267. local templates = {}
  8268.  
  8269. for name,color in pairs(self.Colors) do
  8270. templates[name] = ('<font color="rgb(%s,%s,%s)">'):format(floor(color.r*255),floor(color.g*255),floor(color.b*255))
  8271. end
  8272.  
  8273. self.RichTemplates = templates
  8274. end
  8275.  
  8276. funcs.ApplyTheme = function(self)
  8277. local colors = Settings.Theme.Syntax
  8278. self.Colors = colors
  8279. self.Frame.LineNumbers.TextColor3 = colors.Text
  8280. self.Frame.BackgroundColor3 = colors.Background
  8281. end
  8282.  
  8283. local mt = {__index = funcs}
  8284.  
  8285. local function new()
  8286. if not builtInInited then initBuiltIn() end
  8287.  
  8288. local scrollV = Lib.ScrollBar.new()
  8289. local scrollH = Lib.ScrollBar.new(true)
  8290. scrollH.Gui.Position = UDim2.new(0,0,1,-16)
  8291. local obj = setmetatable({
  8292. FontSize = 15,
  8293. ViewX = 0,
  8294. ViewY = 0,
  8295. Colors = Settings.Theme.Syntax,
  8296. ColoredLines = {},
  8297. Lines = {""},
  8298. LineFrames = {},
  8299. Editable = true,
  8300. Editing = false,
  8301. CursorX = 0,
  8302. CursorY = 0,
  8303. FloatCursorX = 0,
  8304. Text = "",
  8305. PreHighlights = {},
  8306. SelectionRange = {{-1,-1},{-1,-1}},
  8307. NewLines = {},
  8308. FrameOffsets = Vector2.new(0,0),
  8309. MaxTextCols = 0,
  8310. ScrollV = scrollV,
  8311. ScrollH = scrollH
  8312. },mt)
  8313.  
  8314. scrollV.WheelIncrement = 3
  8315. scrollH.Increment = 2
  8316. scrollH.WheelIncrement = 7
  8317.  
  8318. scrollV.Scrolled:Connect(function()
  8319. obj.ViewY = scrollV.Index
  8320. obj:Refresh()
  8321. end)
  8322.  
  8323. scrollH.Scrolled:Connect(function()
  8324. obj.ViewX = scrollH.Index
  8325. obj:Refresh()
  8326. end)
  8327.  
  8328. makeFrame(obj)
  8329. obj:MakeRichTemplates()
  8330. obj:ApplyTheme()
  8331. scrollV:SetScrollFrame(obj.Frame.Lines)
  8332. scrollV.Gui.Parent = obj.Frame
  8333. scrollH.Gui.Parent = obj.Frame
  8334.  
  8335. obj:UpdateView()
  8336. obj.Frame:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
  8337. obj:UpdateView()
  8338. obj:Refresh()
  8339. end)
  8340.  
  8341. return obj
  8342. end
  8343.  
  8344. return {new = new}
  8345. end)()
  8346.  
  8347. Lib.Checkbox = (function()
  8348. local funcs = {}
  8349. local c3 = Color3.fromRGB
  8350. local v2 = Vector2.new
  8351. local ud2s = UDim2.fromScale
  8352. local ud2o = UDim2.fromOffset
  8353. local ud = UDim.new
  8354. local max = math.max
  8355. local new = Instance.new
  8356. local TweenSize = new("Frame").TweenSize
  8357. local ti = TweenInfo.new
  8358. local delay = delay
  8359.  
  8360. local function ripple(object, color)
  8361. local circle = new('Frame')
  8362. circle.BackgroundColor3 = color
  8363. circle.BackgroundTransparency = 0.75
  8364. circle.BorderSizePixel = 0
  8365. circle.AnchorPoint = v2(0.5, 0.5)
  8366. circle.Size = ud2o()
  8367. circle.Position = ud2s(0.5, 0.5)
  8368. circle.Parent = object
  8369. local rounding = new('UICorner')
  8370. rounding.CornerRadius = ud(1)
  8371. rounding.Parent = circle
  8372.  
  8373. local abssz = object.AbsoluteSize
  8374. local size = max(abssz.X, abssz.Y) * 5/3
  8375.  
  8376. TweenSize(circle, ud2o(size, size), "Out", "Quart", 0.4)
  8377. service.TweenService:Create(circle, ti(0.4, Enum.EasingStyle.Quart, Enum.EasingDirection.In), {BackgroundTransparency = 1}):Play()
  8378.  
  8379. service.Debris:AddItem(circle, 0.4)
  8380. end
  8381.  
  8382. local function initGui(self,frame)
  8383. local checkbox = frame or create({
  8384. {1,"ImageButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Name="Checkbox",Position=UDim2.new(0,3,0,3),Size=UDim2.new(0,16,0,16),}},
  8385. {2,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Name="ripples",Parent={1},Size=UDim2.new(1,0,1,0),}},
  8386. {3,"Frame",{BackgroundColor3=Color3.new(0.10196078568697,0.10196078568697,0.10196078568697),BorderSizePixel=0,Name="outline",Parent={1},Size=UDim2.new(0,16,0,16),}},
  8387. {4,"Frame",{BackgroundColor3=Color3.new(0.14117647707462,0.14117647707462,0.14117647707462),BorderSizePixel=0,Name="filler",Parent={3},Position=UDim2.new(0,1,0,1),Size=UDim2.new(0,14,0,14),}},
  8388. {5,"Frame",{BackgroundColor3=Color3.new(0.90196084976196,0.90196084976196,0.90196084976196),BorderSizePixel=0,Name="top",Parent={4},Size=UDim2.new(0,16,0,0),}},
  8389. {6,"Frame",{AnchorPoint=Vector2.new(0,1),BackgroundColor3=Color3.new(0.90196084976196,0.90196084976196,0.90196084976196),BorderSizePixel=0,Name="bottom",Parent={4},Position=UDim2.new(0,0,0,14),Size=UDim2.new(0,16,0,0),}},
  8390. {7,"Frame",{BackgroundColor3=Color3.new(0.90196084976196,0.90196084976196,0.90196084976196),BorderSizePixel=0,Name="left",Parent={4},Size=UDim2.new(0,0,0,16),}},
  8391. {8,"Frame",{AnchorPoint=Vector2.new(1,0),BackgroundColor3=Color3.new(0.90196084976196,0.90196084976196,0.90196084976196),BorderSizePixel=0,Name="right",Parent={4},Position=UDim2.new(0,14,0,0),Size=UDim2.new(0,0,0,16),}},
  8392. {9,"Frame",{AnchorPoint=Vector2.new(0.5,0.5),BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,ClipsDescendants=true,Name="checkmark",Parent={4},Position=UDim2.new(0.5,0,0.5,0),Size=UDim2.new(0,0,0,20),}},
  8393. {10,"ImageLabel",{AnchorPoint=Vector2.new(0.5,0.5),BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Image="rbxassetid://6234266378",Parent={9},Position=UDim2.new(0.5,0,0.5,0),ScaleType=3,Size=UDim2.new(0,15,0,11),}},
  8394. {11,"ImageLabel",{AnchorPoint=Vector2.new(0.5,0.5),BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://6401617475",ImageColor3=Color3.new(0.20784313976765,0.69803923368454,0.98431372642517),Name="checkmark2",Parent={4},Position=UDim2.new(0.5,0,0.5,0),Size=UDim2.new(0,12,0,12),Visible=false,}},
  8395. {12,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://6425281788",ImageTransparency=0.20000000298023,Name="middle",Parent={4},ScaleType=2,Size=UDim2.new(1,0,1,0),TileSize=UDim2.new(0,2,0,2),Visible=false,}},
  8396. {13,"UICorner",{CornerRadius=UDim.new(0,2),Parent={3},}},
  8397. })
  8398. local outline = checkbox.outline
  8399. local filler = outline.filler
  8400. local checkmark = filler.checkmark
  8401. local ripples_container = checkbox.ripples
  8402.  
  8403. -- walls
  8404. local top, bottom, left, right = filler.top, filler.bottom, filler.left, filler.right
  8405.  
  8406. self.Gui = checkbox
  8407. self.GuiElems = {
  8408. Top = top,
  8409. Bottom = bottom,
  8410. Left = left,
  8411. Right = right,
  8412. Outline = outline,
  8413. Filler = filler,
  8414. Checkmark = checkmark,
  8415. Checkmark2 = filler.checkmark2,
  8416. Middle = filler.middle
  8417. }
  8418.  
  8419. checkbox.Activated:Connect(function()
  8420. if Lib.CheckMouseInGui(checkbox) then
  8421. if self.Style == 0 then
  8422. ripple(ripples_container, self.Disabled and self.Colors.Disabled or self.Colors.Primary)
  8423. end
  8424.  
  8425. if not self.Disabled then
  8426. self:SetState(not self.Toggled,true)
  8427. else
  8428. self:Paint()
  8429. end
  8430.  
  8431. self.OnInput:Fire()
  8432. end
  8433. end)
  8434.  
  8435. -- Old:
  8436. --[[checkbox.InputBegan:Connect(function(i)
  8437. if i.UserInputType == Enum.UserInputType.MouseButton1 then
  8438. local release
  8439. release = service.UserInputService.InputEnded:Connect(function(input)
  8440. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  8441. release:Disconnect()
  8442.  
  8443. if Lib.CheckMouseInGui(checkbox) then
  8444. if self.Style == 0 then
  8445. ripple(ripples_container, self.Disabled and self.Colors.Disabled or self.Colors.Primary)
  8446. end
  8447.  
  8448. if not self.Disabled then
  8449. self:SetState(not self.Toggled,true)
  8450. else
  8451. self:Paint()
  8452. end
  8453.  
  8454. self.OnInput:Fire()
  8455. end
  8456. end
  8457. end)
  8458. end
  8459. end)]]
  8460.  
  8461. self:Paint()
  8462. end
  8463.  
  8464. funcs.Collapse = function(self,anim)
  8465. local guiElems = self.GuiElems
  8466. if anim then
  8467. TweenSize(guiElems.Top, ud2o(14, 14), "In", "Quart", 4/15, true)
  8468. TweenSize(guiElems.Bottom, ud2o(14, 14), "In", "Quart", 4/15, true)
  8469. TweenSize(guiElems.Left, ud2o(14, 14), "In", "Quart", 4/15, true)
  8470. TweenSize(guiElems.Right, ud2o(14, 14), "In", "Quart", 4/15, true)
  8471. else
  8472. guiElems.Top.Size = ud2o(14, 14)
  8473. guiElems.Bottom.Size = ud2o(14, 14)
  8474. guiElems.Left.Size = ud2o(14, 14)
  8475. guiElems.Right.Size = ud2o(14, 14)
  8476. end
  8477. end
  8478.  
  8479. funcs.Expand = function(self,anim)
  8480. local guiElems = self.GuiElems
  8481. if anim then
  8482. TweenSize(guiElems.Top, ud2o(14, 0), "InOut", "Quart", 4/15, true)
  8483. TweenSize(guiElems.Bottom, ud2o(14, 0), "InOut", "Quart", 4/15, true)
  8484. TweenSize(guiElems.Left, ud2o(0, 14), "InOut", "Quart", 4/15, true)
  8485. TweenSize(guiElems.Right, ud2o(0, 14), "InOut", "Quart", 4/15, true)
  8486. else
  8487. guiElems.Top.Size = ud2o(14, 0)
  8488. guiElems.Bottom.Size = ud2o(14, 0)
  8489. guiElems.Left.Size = ud2o(0, 14)
  8490. guiElems.Right.Size = ud2o(0, 14)
  8491. end
  8492. end
  8493.  
  8494. funcs.Paint = function(self)
  8495. local guiElems = self.GuiElems
  8496.  
  8497. if self.Style == 0 then
  8498. local color_base = self.Disabled and self.Colors.Disabled
  8499. guiElems.Outline.BackgroundColor3 = color_base or (self.Toggled and self.Colors.Primary) or self.Colors.Secondary
  8500. local walls_color = color_base or self.Colors.Primary
  8501. guiElems.Top.BackgroundColor3 = walls_color
  8502. guiElems.Bottom.BackgroundColor3 = walls_color
  8503. guiElems.Left.BackgroundColor3 = walls_color
  8504. guiElems.Right.BackgroundColor3 = walls_color
  8505. else
  8506. guiElems.Outline.BackgroundColor3 = self.Disabled and self.Colors.Disabled or self.Colors.Secondary
  8507. guiElems.Filler.BackgroundColor3 = self.Disabled and self.Colors.DisabledBackground or self.Colors.Background
  8508. guiElems.Checkmark2.ImageColor3 = self.Disabled and self.Colors.DisabledCheck or self.Colors.Primary
  8509. end
  8510. end
  8511.  
  8512. funcs.SetState = function(self,val,anim)
  8513. self.Toggled = val
  8514.  
  8515. if self.OutlineColorTween then self.OutlineColorTween:Cancel() end
  8516. local setStateTime = tick()
  8517. self.LastSetStateTime = setStateTime
  8518.  
  8519. if self.Toggled then
  8520. if self.Style == 0 then
  8521. if anim then
  8522. self.OutlineColorTween = service.TweenService:Create(self.GuiElems.Outline, ti(4/15, Enum.EasingStyle.Circular, Enum.EasingDirection.Out), {BackgroundColor3 = self.Colors.Primary})
  8523. self.OutlineColorTween:Play()
  8524. delay(0.15, function()
  8525. if setStateTime ~= self.LastSetStateTime then return end
  8526. self:Paint()
  8527. TweenSize(self.GuiElems.Checkmark, ud2o(14, 20), "Out", "Bounce", 2/15, true)
  8528. end)
  8529. else
  8530. self.GuiElems.Outline.BackgroundColor3 = self.Colors.Primary
  8531. self:Paint()
  8532. self.GuiElems.Checkmark.Size = ud2o(14, 20)
  8533. end
  8534. self:Collapse(anim)
  8535. else
  8536. self:Paint()
  8537. self.GuiElems.Checkmark2.Visible = true
  8538. self.GuiElems.Middle.Visible = false
  8539. end
  8540. else
  8541. if self.Style == 0 then
  8542. if anim then
  8543. self.OutlineColorTween = service.TweenService:Create(self.GuiElems.Outline, ti(4/15, Enum.EasingStyle.Circular, Enum.EasingDirection.In), {BackgroundColor3 = self.Colors.Secondary})
  8544. self.OutlineColorTween:Play()
  8545. delay(0.15, function()
  8546. if setStateTime ~= self.LastSetStateTime then return end
  8547. self:Paint()
  8548. TweenSize(self.GuiElems.Checkmark, ud2o(0, 20), "Out", "Quad", 1/15, true)
  8549. end)
  8550. else
  8551. self.GuiElems.Outline.BackgroundColor3 = self.Colors.Secondary
  8552. self:Paint()
  8553. self.GuiElems.Checkmark.Size = ud2o(0, 20)
  8554. end
  8555. self:Expand(anim)
  8556. else
  8557. self:Paint()
  8558. self.GuiElems.Checkmark2.Visible = false
  8559. self.GuiElems.Middle.Visible = self.Toggled == nil
  8560. end
  8561. end
  8562. end
  8563.  
  8564. local mt = {__index = funcs}
  8565.  
  8566. local function new(style)
  8567. local obj = setmetatable({
  8568. Toggled = false,
  8569. Disabled = false,
  8570. OnInput = Lib.Signal.new(),
  8571. Style = style or 0,
  8572. Colors = {
  8573. Background = c3(36,36,36),
  8574. Primary = c3(49,176,230),
  8575. Secondary = c3(25,25,25),
  8576. Disabled = c3(64,64,64),
  8577. DisabledBackground = c3(52,52,52),
  8578. DisabledCheck = c3(80,80,80)
  8579. }
  8580. },mt)
  8581. initGui(obj)
  8582. return obj
  8583. end
  8584.  
  8585. local function fromFrame(frame)
  8586. local obj = setmetatable({
  8587. Toggled = false,
  8588. Disabled = false,
  8589. Colors = {
  8590. Background = c3(36,36,36),
  8591. Primary = c3(49,176,230),
  8592. Secondary = c3(25,25,25),
  8593. Disabled = c3(64,64,64),
  8594. DisabledBackground = c3(52,52,52)
  8595. }
  8596. },mt)
  8597. initGui(obj,frame)
  8598. return obj
  8599. end
  8600.  
  8601. return {new = new, fromFrame}
  8602. end)()
  8603.  
  8604. Lib.BrickColorPicker = (function()
  8605. local funcs = {}
  8606. local paletteCount = 0
  8607. local mouse = service.Players.LocalPlayer:GetMouse()
  8608. local hexStartX = 4
  8609. local hexSizeX = 27
  8610. local hexTriangleStart = 1
  8611. local hexTriangleSize = 8
  8612.  
  8613. local bottomColors = {
  8614. Color3.fromRGB(17,17,17),
  8615. Color3.fromRGB(99,95,98),
  8616. Color3.fromRGB(163,162,165),
  8617. Color3.fromRGB(205,205,205),
  8618. Color3.fromRGB(223,223,222),
  8619. Color3.fromRGB(237,234,234),
  8620. Color3.fromRGB(27,42,53),
  8621. Color3.fromRGB(91,93,105),
  8622. Color3.fromRGB(159,161,172),
  8623. Color3.fromRGB(202,203,209),
  8624. Color3.fromRGB(231,231,236),
  8625. Color3.fromRGB(248,248,248)
  8626. }
  8627.  
  8628. local function isMouseInHexagon(hex, touchPos)
  8629. local relativeX = touchPos.X - hex.AbsolutePosition.X
  8630. local relativeY = touchPos.Y - hex.AbsolutePosition.Y
  8631. if relativeX >= hexStartX and relativeX < hexStartX + hexSizeX then
  8632. relativeX = relativeX - 4
  8633. local relativeWidth = (13 - math.min(relativeX, 26 - relativeX)) / 13
  8634. if relativeY >= hexTriangleStart + hexTriangleSize * relativeWidth and relativeY < hex.AbsoluteSize.Y - hexTriangleStart - hexTriangleSize * relativeWidth then
  8635. return true
  8636. end
  8637. end
  8638. return false
  8639. end
  8640.  
  8641. local function hexInput(self, hex, color)
  8642. hex.InputBegan:Connect(function(input)
  8643. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  8644. if isMouseInHexagon(hex, input.Position) then
  8645. self.OnSelect:Fire(color)
  8646. self:Close()
  8647. end
  8648. end
  8649. end)
  8650.  
  8651. hex.InputChanged:Connect(function(input)
  8652. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  8653. if isMouseInHexagon(hex, input.Position) then
  8654. self.OnPreview:Fire(color)
  8655. end
  8656. end
  8657. end)
  8658. end
  8659.  
  8660. local function createGui(self)
  8661. local gui = create({
  8662. {1,"ScreenGui",{Name="BrickColor",}},
  8663. {2,"Frame",{Active=true,BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderColor3=Color3.new(0.1294117718935,0.1294117718935,0.1294117718935),Parent={1},Position=UDim2.new(0.40000000596046,0,0.40000000596046,0),Size=UDim2.new(0,337,0,380),}},
  8664. {3,"TextButton",{BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),BorderSizePixel=0,Font=3,Name="MoreColors",Parent={2},Position=UDim2.new(0,5,1,-30),Size=UDim2.new(1,-10,0,25),Text="More Colors",TextColor3=Color3.new(1,1,1),TextSize=14,}},
  8665. {4,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Image="rbxassetid://1281023007",ImageColor3=Color3.new(0.33333334326744,0.33333334326744,0.49803924560547),Name="Hex",Parent={2},Size=UDim2.new(0,35,0,35),Visible=false,}},
  8666. })
  8667. local colorFrame = gui.Frame
  8668. local hex = colorFrame.Hex
  8669.  
  8670. for row = 1,13 do
  8671. local columns = math.min(row,14-row)+6
  8672. for column = 1,columns do
  8673. local nextColor = BrickColor.palette(paletteCount).Color
  8674. local newHex = hex:Clone()
  8675. newHex.Position = UDim2.new(0, (column-1)*25-(columns-7)*13+3*26 + 1, 0, (row-1)*23 + 4)
  8676. newHex.ImageColor3 = nextColor
  8677. newHex.Visible = true
  8678. hexInput(self,newHex,nextColor)
  8679. newHex.Parent = colorFrame
  8680. paletteCount = paletteCount + 1
  8681. end
  8682. end
  8683.  
  8684. for column = 1,12 do
  8685. local nextColor = bottomColors[column]
  8686. local newHex = hex:Clone()
  8687. newHex.Position = UDim2.new(0, (column-1)*25-(12-7)*13+3*26 + 3, 0, 308)
  8688. newHex.ImageColor3 = nextColor
  8689. newHex.Visible = true
  8690. hexInput(self,newHex,nextColor)
  8691. newHex.Parent = colorFrame
  8692. paletteCount = paletteCount + 1
  8693. end
  8694.  
  8695. colorFrame.MoreColors.MouseButton1Click:Connect(function()
  8696. self.OnMoreColors:Fire()
  8697. self:Close()
  8698. end)
  8699.  
  8700. self.Gui = gui
  8701. end
  8702.  
  8703. funcs.SetMoreColorsVisible = function(self,vis)
  8704. local colorFrame = self.Gui.Frame
  8705. colorFrame.Size = UDim2.new(0,337,0,380 - (not vis and 33 or 0))
  8706. colorFrame.MoreColors.Visible = vis
  8707. end
  8708.  
  8709. funcs.Show = function(self,x,y,prevColor)
  8710. self.PrevColor = prevColor or self.PrevColor
  8711.  
  8712. local reverseY = false
  8713.  
  8714. local x,y = x or mouse.X, y or mouse.Y
  8715. local maxX,maxY = mouse.ViewSizeX,mouse.ViewSizeY
  8716. Lib.ShowGui(self.Gui)
  8717. local sizeX,sizeY = self.Gui.Frame.AbsoluteSize.X,self.Gui.Frame.AbsoluteSize.Y
  8718.  
  8719. if x + sizeX > maxX then x = self.ReverseX and x - sizeX or maxX - sizeX end
  8720. if y + sizeY > maxY then reverseY = true end
  8721.  
  8722. local closable = false
  8723. if self.CloseEvent then self.CloseEvent:Disconnect() end
  8724.  
  8725. self.CloseEvent = service.UserInputService.InputBegan:Connect(function(input)
  8726. if not closable or (input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch) then
  8727. return
  8728. end
  8729.  
  8730. if not Lib.CheckMouseInGui(self.Gui.Frame) then
  8731. self.CloseEvent:Disconnect()
  8732. self:Close()
  8733. end
  8734. end)
  8735.  
  8736.  
  8737. if reverseY then
  8738. local newY = y - sizeY - (self.ReverseYOffset or 0)
  8739. y = newY >= 0 and newY or 0
  8740. end
  8741.  
  8742. self.Gui.Frame.Position = UDim2.new(0,x,0,y)
  8743.  
  8744. Lib.FastWait()
  8745. closable = true
  8746. end
  8747.  
  8748. funcs.Close = function(self)
  8749. self.Gui.Parent = nil
  8750. self.OnCancel:Fire()
  8751. end
  8752.  
  8753. local mt = {__index = funcs}
  8754.  
  8755. local function new()
  8756. local obj = setmetatable({
  8757. OnPreview = Lib.Signal.new(),
  8758. OnSelect = Lib.Signal.new(),
  8759. OnCancel = Lib.Signal.new(),
  8760. OnMoreColors = Lib.Signal.new(),
  8761. PrevColor = Color3.new(0,0,0)
  8762. }, mt)
  8763. createGui(obj)
  8764. return obj
  8765. end
  8766.  
  8767. return {new = new}
  8768. end)()
  8769.  
  8770. Lib.ColorPicker = (function() -- TODO: Convert to newer class model
  8771. local funcs = {}
  8772.  
  8773. local function new()
  8774. local newMt = setmetatable({},{})
  8775.  
  8776. newMt.OnSelect = Lib.Signal.new()
  8777. newMt.OnCancel = Lib.Signal.new()
  8778. newMt.OnPreview = Lib.Signal.new()
  8779.  
  8780. local guiContents = create({
  8781. {1,"Frame",{BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderSizePixel=0,ClipsDescendants=true,Name="Content",Position=UDim2.new(0,0,0,20),Size=UDim2.new(1,0,1,-20),}},
  8782. {2,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Name="BasicColors",Parent={1},Position=UDim2.new(0,5,0,5),Size=UDim2.new(0,180,0,200),}},
  8783. {3,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={2},Position=UDim2.new(0,0,0,-5),Size=UDim2.new(1,0,0,26),Text="Basic Colors",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  8784. {4,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),Name="Blue",Parent={1},Position=UDim2.new(1,-63,0,255),Size=UDim2.new(0,52,0,16),}},
  8785. {5,"TextBox",{BackgroundColor3=Color3.new(0.25098040699959,0.25098040699959,0.25098040699959),BackgroundTransparency=1,BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),Font=3,Name="Input",Parent={4},Position=UDim2.new(0,2,0,0),Size=UDim2.new(0,50,0,16),Text="0",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  8786. {6,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Name="ArrowFrame",Parent={5},Position=UDim2.new(1,-16,0,0),Size=UDim2.new(0,16,1,0),}},
  8787. {7,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Up",Parent={6},Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8788. {8,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={7},Size=UDim2.new(0,16,0,8),}},
  8789. {9,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={8},Position=UDim2.new(0,8,0,3),Size=UDim2.new(0,1,0,1),}},
  8790. {10,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={8},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8791. {11,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={8},Position=UDim2.new(0,6,0,5),Size=UDim2.new(0,5,0,1),}},
  8792. {12,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Down",Parent={6},Position=UDim2.new(0,0,0,8),Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8793. {13,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={12},Size=UDim2.new(0,16,0,8),}},
  8794. {14,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={13},Position=UDim2.new(0,8,0,5),Size=UDim2.new(0,1,0,1),}},
  8795. {15,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={13},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8796. {16,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={13},Position=UDim2.new(0,6,0,3),Size=UDim2.new(0,5,0,1),}},
  8797. {17,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={4},Position=UDim2.new(0,-40,0,0),Size=UDim2.new(0,34,1,0),Text="Blue:",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  8798. {18,"Frame",{BackgroundColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),BorderSizePixel=0,ClipsDescendants=true,Name="ColorSpaceFrame",Parent={1},Position=UDim2.new(1,-261,0,4),Size=UDim2.new(0,222,0,202),}},
  8799. {19,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),BorderSizePixel=0,Image="rbxassetid://1072518406",Name="ColorSpace",Parent={18},Position=UDim2.new(0,1,0,1),Size=UDim2.new(0,220,0,200),}},
  8800. {20,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Name="Scope",Parent={19},Position=UDim2.new(0,210,0,190),Size=UDim2.new(0,20,0,20),}},
  8801. {21,"Frame",{BackgroundColor3=Color3.new(0,0,0),BorderSizePixel=0,Name="Line",Parent={20},Position=UDim2.new(0,9,0,0),Size=UDim2.new(0,2,0,20),}},
  8802. {22,"Frame",{BackgroundColor3=Color3.new(0,0,0),BorderSizePixel=0,Name="Line",Parent={20},Position=UDim2.new(0,0,0,9),Size=UDim2.new(0,20,0,2),}},
  8803. {23,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Name="CustomColors",Parent={1},Position=UDim2.new(0,5,0,210),Size=UDim2.new(0,180,0,90),}},
  8804. {24,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={23},Size=UDim2.new(1,0,0,20),Text="Custom Colors (RC = Set)",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  8805. {25,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),Name="Green",Parent={1},Position=UDim2.new(1,-63,0,233),Size=UDim2.new(0,52,0,16),}},
  8806. {26,"TextBox",{BackgroundColor3=Color3.new(0.25098040699959,0.25098040699959,0.25098040699959),BackgroundTransparency=1,BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),Font=3,Name="Input",Parent={25},Position=UDim2.new(0,2,0,0),Size=UDim2.new(0,50,0,16),Text="0",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  8807. {27,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Name="ArrowFrame",Parent={26},Position=UDim2.new(1,-16,0,0),Size=UDim2.new(0,16,1,0),}},
  8808. {28,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Up",Parent={27},Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8809. {29,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={28},Size=UDim2.new(0,16,0,8),}},
  8810. {30,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={29},Position=UDim2.new(0,8,0,3),Size=UDim2.new(0,1,0,1),}},
  8811. {31,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={29},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8812. {32,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={29},Position=UDim2.new(0,6,0,5),Size=UDim2.new(0,5,0,1),}},
  8813. {33,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Down",Parent={27},Position=UDim2.new(0,0,0,8),Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8814. {34,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={33},Size=UDim2.new(0,16,0,8),}},
  8815. {35,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={34},Position=UDim2.new(0,8,0,5),Size=UDim2.new(0,1,0,1),}},
  8816. {36,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={34},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8817. {37,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={34},Position=UDim2.new(0,6,0,3),Size=UDim2.new(0,5,0,1),}},
  8818. {38,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={25},Position=UDim2.new(0,-40,0,0),Size=UDim2.new(0,34,1,0),Text="Green:",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  8819. {39,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),Name="Hue",Parent={1},Position=UDim2.new(1,-180,0,211),Size=UDim2.new(0,52,0,16),}},
  8820. {40,"TextBox",{BackgroundColor3=Color3.new(0.25098040699959,0.25098040699959,0.25098040699959),BackgroundTransparency=1,BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),Font=3,Name="Input",Parent={39},Position=UDim2.new(0,2,0,0),Size=UDim2.new(0,50,0,16),Text="0",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  8821. {41,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Name="ArrowFrame",Parent={40},Position=UDim2.new(1,-16,0,0),Size=UDim2.new(0,16,1,0),}},
  8822. {42,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Up",Parent={41},Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8823. {43,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={42},Size=UDim2.new(0,16,0,8),}},
  8824. {44,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={43},Position=UDim2.new(0,8,0,3),Size=UDim2.new(0,1,0,1),}},
  8825. {45,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={43},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8826. {46,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={43},Position=UDim2.new(0,6,0,5),Size=UDim2.new(0,5,0,1),}},
  8827. {47,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Down",Parent={41},Position=UDim2.new(0,0,0,8),Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8828. {48,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={47},Size=UDim2.new(0,16,0,8),}},
  8829. {49,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={48},Position=UDim2.new(0,8,0,5),Size=UDim2.new(0,1,0,1),}},
  8830. {50,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={48},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8831. {51,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={48},Position=UDim2.new(0,6,0,3),Size=UDim2.new(0,5,0,1),}},
  8832. {52,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={39},Position=UDim2.new(0,-40,0,0),Size=UDim2.new(0,34,1,0),Text="Hue:",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  8833. {53,"Frame",{BackgroundColor3=Color3.new(1,1,1),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),Name="Preview",Parent={1},Position=UDim2.new(1,-260,0,211),Size=UDim2.new(0,35,1,-245),}},
  8834. {54,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),Name="Red",Parent={1},Position=UDim2.new(1,-63,0,211),Size=UDim2.new(0,52,0,16),}},
  8835. {55,"TextBox",{BackgroundColor3=Color3.new(0.25098040699959,0.25098040699959,0.25098040699959),BackgroundTransparency=1,BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),Font=3,Name="Input",Parent={54},Position=UDim2.new(0,2,0,0),Size=UDim2.new(0,50,0,16),Text="0",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  8836. {56,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Name="ArrowFrame",Parent={55},Position=UDim2.new(1,-16,0,0),Size=UDim2.new(0,16,1,0),}},
  8837. {57,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Up",Parent={56},Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8838. {58,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={57},Size=UDim2.new(0,16,0,8),}},
  8839. {59,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={58},Position=UDim2.new(0,8,0,3),Size=UDim2.new(0,1,0,1),}},
  8840. {60,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={58},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8841. {61,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={58},Position=UDim2.new(0,6,0,5),Size=UDim2.new(0,5,0,1),}},
  8842. {62,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Down",Parent={56},Position=UDim2.new(0,0,0,8),Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8843. {63,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={62},Size=UDim2.new(0,16,0,8),}},
  8844. {64,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={63},Position=UDim2.new(0,8,0,5),Size=UDim2.new(0,1,0,1),}},
  8845. {65,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={63},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8846. {66,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={63},Position=UDim2.new(0,6,0,3),Size=UDim2.new(0,5,0,1),}},
  8847. {67,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={54},Position=UDim2.new(0,-40,0,0),Size=UDim2.new(0,34,1,0),Text="Red:",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  8848. {68,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),Name="Sat",Parent={1},Position=UDim2.new(1,-180,0,233),Size=UDim2.new(0,52,0,16),}},
  8849. {69,"TextBox",{BackgroundColor3=Color3.new(0.25098040699959,0.25098040699959,0.25098040699959),BackgroundTransparency=1,BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),Font=3,Name="Input",Parent={68},Position=UDim2.new(0,2,0,0),Size=UDim2.new(0,50,0,16),Text="0",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  8850. {70,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Name="ArrowFrame",Parent={69},Position=UDim2.new(1,-16,0,0),Size=UDim2.new(0,16,1,0),}},
  8851. {71,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Up",Parent={70},Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8852. {72,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={71},Size=UDim2.new(0,16,0,8),}},
  8853. {73,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={72},Position=UDim2.new(0,8,0,3),Size=UDim2.new(0,1,0,1),}},
  8854. {74,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={72},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8855. {75,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={72},Position=UDim2.new(0,6,0,5),Size=UDim2.new(0,5,0,1),}},
  8856. {76,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Down",Parent={70},Position=UDim2.new(0,0,0,8),Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8857. {77,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={76},Size=UDim2.new(0,16,0,8),}},
  8858. {78,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={77},Position=UDim2.new(0,8,0,5),Size=UDim2.new(0,1,0,1),}},
  8859. {79,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={77},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8860. {80,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={77},Position=UDim2.new(0,6,0,3),Size=UDim2.new(0,5,0,1),}},
  8861. {81,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={68},Position=UDim2.new(0,-40,0,0),Size=UDim2.new(0,34,1,0),Text="Sat:",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  8862. {82,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),Name="Val",Parent={1},Position=UDim2.new(1,-180,0,255),Size=UDim2.new(0,52,0,16),}},
  8863. {83,"TextBox",{BackgroundColor3=Color3.new(0.25098040699959,0.25098040699959,0.25098040699959),BackgroundTransparency=1,BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),Font=3,Name="Input",Parent={82},Position=UDim2.new(0,2,0,0),Size=UDim2.new(0,50,0,16),Text="255",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  8864. {84,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Name="ArrowFrame",Parent={83},Position=UDim2.new(1,-16,0,0),Size=UDim2.new(0,16,1,0),}},
  8865. {85,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Up",Parent={84},Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8866. {86,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={85},Size=UDim2.new(0,16,0,8),}},
  8867. {87,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={86},Position=UDim2.new(0,8,0,3),Size=UDim2.new(0,1,0,1),}},
  8868. {88,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={86},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8869. {89,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={86},Position=UDim2.new(0,6,0,5),Size=UDim2.new(0,5,0,1),}},
  8870. {90,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="Down",Parent={84},Position=UDim2.new(0,0,0,8),Size=UDim2.new(1,0,0,8),Text="",TextSize=14,}},
  8871. {91,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={90},Size=UDim2.new(0,16,0,8),}},
  8872. {92,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={91},Position=UDim2.new(0,8,0,5),Size=UDim2.new(0,1,0,1),}},
  8873. {93,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={91},Position=UDim2.new(0,7,0,4),Size=UDim2.new(0,3,0,1),}},
  8874. {94,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={91},Position=UDim2.new(0,6,0,3),Size=UDim2.new(0,5,0,1),}},
  8875. {95,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={82},Position=UDim2.new(0,-40,0,0),Size=UDim2.new(0,34,1,0),Text="Val:",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  8876. {96,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),Font=3,Name="Cancel",Parent={1},Position=UDim2.new(1,-105,1,-28),Size=UDim2.new(0,100,0,25),Text="Cancel",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,}},
  8877. {97,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),Font=3,Name="Ok",Parent={1},Position=UDim2.new(1,-210,1,-28),Size=UDim2.new(0,100,0,25),Text="OK",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,}},
  8878. {98,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),Image="rbxassetid://1072518502",Name="ColorStrip",Parent={1},Position=UDim2.new(1,-30,0,5),Size=UDim2.new(0,13,0,200),}},
  8879. {99,"Frame",{BackgroundColor3=Color3.new(0.3137255012989,0.3137255012989,0.3137255012989),BackgroundTransparency=1,BorderSizePixel=0,Name="ArrowFrame",Parent={1},Position=UDim2.new(1,-16,0,1),Size=UDim2.new(0,5,0,208),}},
  8880. {100,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={99},Position=UDim2.new(0,-2,0,-4),Size=UDim2.new(0,8,0,16),}},
  8881. {101,"Frame",{BackgroundColor3=Color3.new(0,0,0),BorderSizePixel=0,Parent={100},Position=UDim2.new(0,2,0,8),Size=UDim2.new(0,1,0,1),}},
  8882. {102,"Frame",{BackgroundColor3=Color3.new(0,0,0),BorderSizePixel=0,Parent={100},Position=UDim2.new(0,3,0,7),Size=UDim2.new(0,1,0,3),}},
  8883. {103,"Frame",{BackgroundColor3=Color3.new(0,0,0),BorderSizePixel=0,Parent={100},Position=UDim2.new(0,4,0,6),Size=UDim2.new(0,1,0,5),}},
  8884. {104,"Frame",{BackgroundColor3=Color3.new(0,0,0),BorderSizePixel=0,Parent={100},Position=UDim2.new(0,5,0,5),Size=UDim2.new(0,1,0,7),}},
  8885. {105,"Frame",{BackgroundColor3=Color3.new(0,0,0),BorderSizePixel=0,Parent={100},Position=UDim2.new(0,6,0,4),Size=UDim2.new(0,1,0,9),}},
  8886. })
  8887. local window = Lib.Window.new()
  8888. window.Resizable = false
  8889. window.Alignable = false
  8890. window:SetTitle("Color Picker")
  8891. window:Resize(450,330)
  8892. for i,v in pairs(guiContents:GetChildren()) do
  8893. v.Parent = window.GuiElems.Content
  8894. end
  8895. newMt.Window = window
  8896. newMt.Gui = window.Gui
  8897. local pickerGui = window.Gui.Main
  8898. local pickerTopBar = pickerGui.TopBar
  8899. local pickerFrame = pickerGui.Content
  8900. local colorSpace = pickerFrame.ColorSpaceFrame.ColorSpace
  8901. local colorStrip = pickerFrame.ColorStrip
  8902. local previewFrame = pickerFrame.Preview
  8903. local basicColorsFrame = pickerFrame.BasicColors
  8904. local customColorsFrame = pickerFrame.CustomColors
  8905. local okButton = pickerFrame.Ok
  8906. local cancelButton = pickerFrame.Cancel
  8907. local closeButton = pickerTopBar.Close
  8908.  
  8909. local colorScope = colorSpace.Scope
  8910. local colorArrow = pickerFrame.ArrowFrame.Arrow
  8911.  
  8912. local hueInput = pickerFrame.Hue.Input
  8913. local satInput = pickerFrame.Sat.Input
  8914. local valInput = pickerFrame.Val.Input
  8915.  
  8916. local redInput = pickerFrame.Red.Input
  8917. local greenInput = pickerFrame.Green.Input
  8918. local blueInput = pickerFrame.Blue.Input
  8919.  
  8920. local user = service.UserInputService
  8921. local mouse = service.Players.LocalPlayer:GetMouse()
  8922.  
  8923. local hue,sat,val = 0,0,1
  8924. local red,green,blue = 1,1,1
  8925. local chosenColor = Color3.new(0,0,0)
  8926.  
  8927. local basicColors = {Color3.new(0,0,0),Color3.new(0.66666668653488,0,0),Color3.new(0,0.33333334326744,0),Color3.new(0.66666668653488,0.33333334326744,0),Color3.new(0,0.66666668653488,0),Color3.new(0.66666668653488,0.66666668653488,0),Color3.new(0,1,0),Color3.new(0.66666668653488,1,0),Color3.new(0,0,0.49803924560547),Color3.new(0.66666668653488,0,0.49803924560547),Color3.new(0,0.33333334326744,0.49803924560547),Color3.new(0.66666668653488,0.33333334326744,0.49803924560547),Color3.new(0,0.66666668653488,0.49803924560547),Color3.new(0.66666668653488,0.66666668653488,0.49803924560547),Color3.new(0,1,0.49803924560547),Color3.new(0.66666668653488,1,0.49803924560547),Color3.new(0,0,1),Color3.new(0.66666668653488,0,1),Color3.new(0,0.33333334326744,1),Color3.new(0.66666668653488,0.33333334326744,1),Color3.new(0,0.66666668653488,1),Color3.new(0.66666668653488,0.66666668653488,1),Color3.new(0,1,1),Color3.new(0.66666668653488,1,1),Color3.new(0.33333334326744,0,0),Color3.new(1,0,0),Color3.new(0.33333334326744,0.33333334326744,0),Color3.new(1,0.33333334326744,0),Color3.new(0.33333334326744,0.66666668653488,0),Color3.new(1,0.66666668653488,0),Color3.new(0.33333334326744,1,0),Color3.new(1,1,0),Color3.new(0.33333334326744,0,0.49803924560547),Color3.new(1,0,0.49803924560547),Color3.new(0.33333334326744,0.33333334326744,0.49803924560547),Color3.new(1,0.33333334326744,0.49803924560547),Color3.new(0.33333334326744,0.66666668653488,0.49803924560547),Color3.new(1,0.66666668653488,0.49803924560547),Color3.new(0.33333334326744,1,0.49803924560547),Color3.new(1,1,0.49803924560547),Color3.new(0.33333334326744,0,1),Color3.new(1,0,1),Color3.new(0.33333334326744,0.33333334326744,1),Color3.new(1,0.33333334326744,1),Color3.new(0.33333334326744,0.66666668653488,1),Color3.new(1,0.66666668653488,1),Color3.new(0.33333334326744,1,1),Color3.new(1,1,1)}
  8928. local customColors = {}
  8929.  
  8930. local function updateColor(noupdate)
  8931. local relativeX, relativeY, relativeStripY = 219 - hue * 219, 199 - sat * 199, 199 - val * 199
  8932. local hsvColor = Color3.fromHSV(hue, sat, val)
  8933.  
  8934. if noupdate == 2 or not noupdate then
  8935. hueInput.Text = tostring(math.ceil(359 * hue))
  8936. satInput.Text = tostring(math.ceil(255 * sat))
  8937. valInput.Text = tostring(math.floor(255 * val))
  8938. end
  8939. if noupdate == 1 or not noupdate then
  8940. redInput.Text = tostring(math.floor(255 * red))
  8941. greenInput.Text = tostring(math.floor(255 * green))
  8942. blueInput.Text = tostring(math.floor(255 * blue))
  8943. end
  8944.  
  8945. chosenColor = Color3.new(red, green, blue)
  8946. colorScope.Position = UDim2.new(0, (relativeX - 9), 0, (relativeY - 9))
  8947. colorStrip.ImageColor3 = Color3.fromHSV(hue, sat, 1)
  8948. colorArrow.Position = UDim2.new(0, -2, 0, (relativeStripY - 4))
  8949. previewFrame.BackgroundColor3 = chosenColor
  8950.  
  8951. newMt.Color = chosenColor
  8952. newMt.OnPreview:Fire(chosenColor)
  8953. end
  8954.  
  8955. local function handleInputBegan(input, updateFunc)
  8956. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  8957. while user:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  8958. updateFunc()task.wait()
  8959. end
  8960. end
  8961. end
  8962.  
  8963. local function colorSpaceInput()
  8964. local relativeX = mouse.X - colorSpace.AbsolutePosition.X
  8965. local relativeY = mouse.Y - colorSpace.AbsolutePosition.Y
  8966.  
  8967. if relativeX < 0 then relativeX = 0 elseif relativeX > 219 then relativeX = 219 end
  8968. if relativeY < 0 then relativeY = 0 elseif relativeY > 199 then relativeY = 199 end
  8969.  
  8970. hue = (219 - relativeX) / 219
  8971. sat = (199 - relativeY) / 199
  8972.  
  8973. local hsvColor = Color3.fromHSV(hue, sat, val)
  8974. red, green, blue = hsvColor.R, hsvColor.G, hsvColor.B
  8975. updateColor()
  8976. end
  8977.  
  8978. local function colorStripInput()
  8979. local relativeY = mouse.Y - colorStrip.AbsolutePosition.Y
  8980.  
  8981. if relativeY < 0 then relativeY = 0 elseif relativeY > 199 then relativeY = 199 end
  8982.  
  8983. val = (199 - relativeY) / 199
  8984.  
  8985. local hsvColor = Color3.fromHSV(hue, sat, val)
  8986. red, green, blue = hsvColor.R, hsvColor.G, hsvColor.B
  8987. updateColor()
  8988. end
  8989.  
  8990. colorSpace.InputBegan:Connect(function(input) handleInputBegan(input, colorSpaceInput) end)
  8991. colorStrip.InputBegan:Connect(function(input) handleInputBegan(input, colorStripInput) end)
  8992.  
  8993. local function hookButtons(frame, func)
  8994. frame.ArrowFrame.Up.InputBegan:Connect(function(input)
  8995. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  8996. local releaseEvent, runEvent
  8997. local startTime = tick()
  8998. local pressing = true
  8999. local startNum = tonumber(frame.Text)
  9000.  
  9001. if not startNum then return end
  9002.  
  9003. releaseEvent = user.InputEnded:Connect(function(endInput)
  9004. if endInput.UserInputType == Enum.UserInputType.MouseButton1 or endInput.UserInputType == Enum.UserInputType.Touch then
  9005. releaseEvent:Disconnect()
  9006. pressing = false
  9007. end
  9008. end)
  9009.  
  9010. startNum = startNum + 1
  9011. func(startNum)
  9012. while pressing do
  9013. if tick() - startTime > 0.3 then
  9014. startNum = startNum + 1
  9015. func(startNum)
  9016. startTime = tick()
  9017. end
  9018. task.wait(0.1)
  9019. end
  9020. end
  9021. end)
  9022.  
  9023. frame.ArrowFrame.Down.InputBegan:Connect(function(input)
  9024. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  9025. local releaseEvent, runEvent
  9026. local startTime = tick()
  9027. local pressing = true
  9028. local startNum = tonumber(frame.Text)
  9029.  
  9030. if not startNum then return end
  9031.  
  9032. releaseEvent = user.InputEnded:Connect(function(endInput)
  9033. if endInput.UserInputType == Enum.UserInputType.MouseButton1 or endInput.UserInputType == Enum.UserInputType.Touch then
  9034. releaseEvent:Disconnect()
  9035. pressing = false
  9036. end
  9037. end)
  9038.  
  9039. startNum = startNum - 1
  9040. func(startNum)
  9041. while pressing do
  9042. if tick() - startTime > 0.3 then
  9043. startNum = startNum - 1
  9044. func(startNum)
  9045. startTime = tick()
  9046. end
  9047. task.wait(0.1)
  9048. end
  9049. end
  9050. end)
  9051. end
  9052.  
  9053. --[[local function UpdateBox(TextBox, Value, IsHSV, ...)
  9054. local number = tonumber(TextBox.Text)
  9055. if number then
  9056. number = math.clamp(math.floor(number), 0, Value) / Value
  9057. local HSV = Color3.fromHSV(func(number))
  9058. red, green, blue = HSV.R, HSV.G, HSV.B
  9059.  
  9060. TextBox.Text = tostring(number):sub(4)
  9061. updateColor(IsHSV)
  9062. end
  9063. end]]
  9064.  
  9065. local function updateHue(str)
  9066. local num = tonumber(str)
  9067. if num then
  9068. hue = math.clamp(math.floor(num),0,359)/359
  9069. local hsvColor = Color3.fromHSV(hue,sat,val)
  9070. red,green,blue = hsvColor.r,hsvColor.g,hsvColor.b
  9071.  
  9072. hueInput.Text = tostring(hue*359)
  9073. updateColor(1)
  9074. end
  9075. end
  9076. hueInput.FocusLost:Connect(function() updateHue(hueInput.Text) end) hookButtons(hueInput, hueInput)
  9077.  
  9078. local function updateSat(str)
  9079. local num = tonumber(str)
  9080. if num then
  9081. sat = math.clamp(math.floor(num),0,255)/255
  9082. local hsvColor = Color3.fromHSV(hue,sat,val)
  9083. red,green,blue = hsvColor.r,hsvColor.g,hsvColor.b
  9084. satInput.Text = tostring(sat*255)
  9085. updateColor(1)
  9086. end
  9087. end
  9088. satInput.FocusLost:Connect(function() updateSat(satInput.Text) end) hookButtons(satInput,updateSat)
  9089.  
  9090. local function updateVal(str)
  9091. local num = tonumber(str)
  9092. if num then
  9093. val = math.clamp(math.floor(num),0,255)/255
  9094. local hsvColor = Color3.fromHSV(hue,sat,val)
  9095. red,green,blue = hsvColor.r,hsvColor.g,hsvColor.b
  9096. valInput.Text = tostring(val*255)
  9097. updateColor(1)
  9098. end
  9099. end
  9100. valInput.FocusLost:Connect(function() updateVal(valInput.Text) end) hookButtons(valInput,updateVal)
  9101.  
  9102. local function updateRed(str)
  9103. local num = tonumber(str)
  9104. if num then
  9105. red = math.clamp(math.floor(num),0,255)/255
  9106. local newColor = Color3.new(red,green,blue)
  9107. hue,sat,val = Color3.toHSV(newColor)
  9108. redInput.Text = tostring(red*255)
  9109. updateColor(2)
  9110. end
  9111. end
  9112. redInput.FocusLost:Connect(function() updateRed(redInput.Text) end) hookButtons(redInput,updateRed)
  9113.  
  9114. local function updateGreen(str)
  9115. local num = tonumber(str)
  9116. if num then
  9117. green = math.clamp(math.floor(num),0,255)/255
  9118. local newColor = Color3.new(red,green,blue)
  9119. hue,sat,val = Color3.toHSV(newColor)
  9120. greenInput.Text = tostring(green*255)
  9121. updateColor(2)
  9122. end
  9123. end
  9124. greenInput.FocusLost:Connect(function() updateGreen(greenInput.Text) end) hookButtons(greenInput,updateGreen)
  9125.  
  9126. local function updateBlue(str)
  9127. local num = tonumber(str)
  9128. if num then
  9129. blue = math.clamp(math.floor(num),0,255)/255
  9130. local newColor = Color3.new(red,green,blue)
  9131. hue,sat,val = Color3.toHSV(newColor)
  9132. blueInput.Text = tostring(blue*255)
  9133. updateColor(2)
  9134. end
  9135. end
  9136. blueInput.FocusLost:Connect(function() updateBlue(blueInput.Text) end) hookButtons(blueInput,updateBlue)
  9137.  
  9138. local colorChoice = Instance.new("TextButton")
  9139. colorChoice.Name = "Choice"
  9140. colorChoice.Size = UDim2.new(0,25,0,18)
  9141. colorChoice.BorderColor3 = Color3.fromRGB(55,55,55)
  9142. colorChoice.Text = ""
  9143. colorChoice.AutoButtonColor = false
  9144.  
  9145. local row = 0
  9146. local column = 0
  9147. for i,v in pairs(basicColors) do
  9148. local newColor = colorChoice:Clone()
  9149. newColor.BackgroundColor3 = v
  9150. newColor.Position = UDim2.new(0,1 + 30*column,0,21 + 23*row)
  9151.  
  9152. newColor.MouseButton1Click:Connect(function()
  9153. red,green,blue = v.r,v.g,v.b
  9154. local newColor = Color3.new(red,green,blue)
  9155. hue,sat,val = Color3.toHSV(newColor)
  9156. updateColor()
  9157. end)
  9158.  
  9159. newColor.Parent = basicColorsFrame
  9160. column = column + 1
  9161. if column == 6 then row = row + 1 column = 0 end
  9162. end
  9163.  
  9164. row = 0
  9165. column = 0
  9166. for i = 1,12 do
  9167. local color = customColors[i] or Color3.new(0,0,0)
  9168. local newColor = colorChoice:Clone()
  9169. newColor.BackgroundColor3 = color
  9170. newColor.Position = UDim2.new(0,1 + 30*column,0,20 + 23*row)
  9171.  
  9172. newColor.MouseButton1Click:Connect(function()
  9173. local curColor = customColors[i] or Color3.new(0,0,0)
  9174. red,green,blue = curColor.r,curColor.g,curColor.b
  9175. hue,sat,val = Color3.toHSV(curColor)
  9176. updateColor()
  9177. end)
  9178.  
  9179. newColor.MouseButton2Click:Connect(function()
  9180. customColors[i] = chosenColor
  9181. newColor.BackgroundColor3 = chosenColor
  9182. end)
  9183.  
  9184. newColor.Parent = customColorsFrame
  9185. column = column + 1
  9186. if column == 6 then row = row + 1 column = 0 end
  9187. end
  9188.  
  9189. okButton.MouseButton1Click:Connect(function() newMt.OnSelect:Fire(chosenColor) window:Close() end)
  9190. okButton.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then okButton.BackgroundTransparency = 0.4 end end)
  9191. okButton.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then okButton.BackgroundTransparency = 0 end end)
  9192.  
  9193.  
  9194. cancelButton.MouseButton1Click:Connect(function() newMt.OnCancel:Fire() window:Close() end)
  9195. cancelButton.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then cancelButton.BackgroundTransparency = 0.4 end end)
  9196. cancelButton.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then cancelButton.BackgroundTransparency = 0 end end)
  9197.  
  9198. updateColor()
  9199.  
  9200. newMt.SetColor = function(self,color)
  9201. red,green,blue = color.r,color.g,color.b
  9202. hue,sat,val = Color3.toHSV(color)
  9203. updateColor()
  9204. end
  9205.  
  9206. newMt.Show = function(self)
  9207. self.Window:Show()
  9208. end
  9209.  
  9210. return newMt
  9211. end
  9212.  
  9213. return {new = new}
  9214. end)()
  9215.  
  9216. Lib.NumberSequenceEditor = (function()
  9217. local function new() -- TODO: Convert to newer class model
  9218. local newMt = setmetatable({},{})
  9219. newMt.OnSelect = Lib.Signal.new()
  9220. newMt.OnCancel = Lib.Signal.new()
  9221. newMt.OnPreview = Lib.Signal.new()
  9222.  
  9223. local guiContents = create({
  9224. {1,"Frame",{BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderSizePixel=0,ClipsDescendants=true,Name="Content",Position=UDim2.new(0,0,0,20),Size=UDim2.new(1,0,1,-20),}},
  9225. {2,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),Name="Time",Parent={1},Position=UDim2.new(0,40,0,210),Size=UDim2.new(0,60,0,20),}},
  9226. {3,"TextBox",{BackgroundColor3=Color3.new(0.25098040699959,0.25098040699959,0.25098040699959),BackgroundTransparency=1,BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),ClipsDescendants=true,Font=3,Name="Input",Parent={2},Position=UDim2.new(0,2,0,0),Size=UDim2.new(0,58,0,20),Text="0",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  9227. {4,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={2},Position=UDim2.new(0,-40,0,0),Size=UDim2.new(0,34,1,0),Text="Time",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  9228. {5,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),Font=3,Name="Close",Parent={1},Position=UDim2.new(1,-90,0,210),Size=UDim2.new(0,80,0,20),Text="Close",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,}},
  9229. {6,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),Font=3,Name="Reset",Parent={1},Position=UDim2.new(1,-180,0,210),Size=UDim2.new(0,80,0,20),Text="Reset",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,}},
  9230. {7,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),Font=3,Name="Delete",Parent={1},Position=UDim2.new(0,380,0,210),Size=UDim2.new(0,80,0,20),Text="Delete",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,}},
  9231. {8,"Frame",{BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),Name="NumberLineOutlines",Parent={1},Position=UDim2.new(0,10,0,20),Size=UDim2.new(1,-20,0,170),}},
  9232. {9,"Frame",{BackgroundColor3=Color3.new(0.25098040699959,0.25098040699959,0.25098040699959),BackgroundTransparency=1,BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),Name="NumberLine",Parent={1},Position=UDim2.new(0,10,0,20),Size=UDim2.new(1,-20,0,170),}},
  9233. {10,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),Name="Value",Parent={1},Position=UDim2.new(0,170,0,210),Size=UDim2.new(0,60,0,20),}},
  9234. {11,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={10},Position=UDim2.new(0,-40,0,0),Size=UDim2.new(0,34,1,0),Text="Value",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  9235. {12,"TextBox",{BackgroundColor3=Color3.new(0.25098040699959,0.25098040699959,0.25098040699959),BackgroundTransparency=1,BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),ClipsDescendants=true,Font=3,Name="Input",Parent={10},Position=UDim2.new(0,2,0,0),Size=UDim2.new(0,58,0,20),Text="0",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  9236. {13,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),Name="Envelope",Parent={1},Position=UDim2.new(0,300,0,210),Size=UDim2.new(0,60,0,20),}},
  9237. {14,"TextBox",{BackgroundColor3=Color3.new(0.25098040699959,0.25098040699959,0.25098040699959),BackgroundTransparency=1,BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),ClipsDescendants=true,Font=3,Name="Input",Parent={13},Position=UDim2.new(0,2,0,0),Size=UDim2.new(0,58,0,20),Text="0",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  9238. {15,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={13},Position=UDim2.new(0,-40,0,0),Size=UDim2.new(0,34,1,0),Text="Envelope",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  9239. })
  9240. local window = Lib.Window.new()
  9241. window.Resizable = false
  9242. window:Resize(680,265)
  9243. window:SetTitle("NumberSequence Editor")
  9244. newMt.Window = window
  9245. newMt.Gui = window.Gui
  9246. for i,v in pairs(guiContents:GetChildren()) do
  9247. v.Parent = window.GuiElems.Content
  9248. end
  9249. local gui = window.Gui
  9250. local pickerGui = gui.Main
  9251. local pickerTopBar = pickerGui.TopBar
  9252. local pickerFrame = pickerGui.Content
  9253. local numberLine = pickerFrame.NumberLine
  9254. local numberLineOutlines = pickerFrame.NumberLineOutlines
  9255. local timeBox = pickerFrame.Time.Input
  9256. local valueBox = pickerFrame.Value.Input
  9257. local envelopeBox = pickerFrame.Envelope.Input
  9258. local deleteButton = pickerFrame.Delete
  9259. local resetButton = pickerFrame.Reset
  9260. local closeButton = pickerFrame.Close
  9261. local topClose = pickerTopBar.Close
  9262.  
  9263. local points = {{1,0,3},{8,0.05,1},{5,0.6,2},{4,0.7,4},{6,1,4}}
  9264. local lines = {}
  9265. local eLines = {}
  9266. local beginPoint = points[1]
  9267. local endPoint = points[#points]
  9268. local currentlySelected = nil
  9269. local currentPoint = nil
  9270. local resetSequence = nil
  9271.  
  9272. local user = service.UserInputService
  9273. local mouse = service.Players.LocalPlayer:GetMouse()
  9274.  
  9275. for i = 2,10 do
  9276. local newLine = Instance.new("Frame")
  9277. newLine.BackgroundTransparency = 0.5
  9278. newLine.BackgroundColor3 = Color3.new(96/255,96/255,96/255)
  9279. newLine.BorderSizePixel = 0
  9280. newLine.Size = UDim2.new(0,1,1,0)
  9281. newLine.Position = UDim2.new((i-1)/(11-1),0,0,0)
  9282. newLine.Parent = numberLineOutlines
  9283. end
  9284.  
  9285. for i = 2,4 do
  9286. local newLine = Instance.new("Frame")
  9287. newLine.BackgroundTransparency = 0.5
  9288. newLine.BackgroundColor3 = Color3.new(96/255,96/255,96/255)
  9289. newLine.BorderSizePixel = 0
  9290. newLine.Size = UDim2.new(1,0,0,1)
  9291. newLine.Position = UDim2.new(0,0,(i-1)/(5-1),0)
  9292. newLine.Parent = numberLineOutlines
  9293. end
  9294.  
  9295. local lineTemp = Instance.new("Frame")
  9296. lineTemp.BackgroundColor3 = Color3.new(0,0,0)
  9297. lineTemp.BorderSizePixel = 0
  9298. lineTemp.Size = UDim2.new(0,1,0,1)
  9299.  
  9300. local sequenceLine = Instance.new("Frame")
  9301. sequenceLine.BackgroundColor3 = Color3.new(0,0,0)
  9302. sequenceLine.BorderSizePixel = 0
  9303. sequenceLine.Size = UDim2.new(0,1,0,0)
  9304.  
  9305. for i = 1,numberLine.AbsoluteSize.X do
  9306. local line = sequenceLine:Clone()
  9307. eLines[i] = line
  9308. line.Name = "E"..tostring(i)
  9309. line.BackgroundTransparency = 0.5
  9310. line.BackgroundColor3 = Color3.new(199/255,44/255,28/255)
  9311. line.Position = UDim2.new(0,i-1,0,0)
  9312. line.Parent = numberLine
  9313. end
  9314.  
  9315. for i = 1,numberLine.AbsoluteSize.X do
  9316. local line = sequenceLine:Clone()
  9317. lines[i] = line
  9318. line.Name = tostring(i)
  9319. line.Position = UDim2.new(0,i-1,0,0)
  9320. line.Parent = numberLine
  9321. end
  9322.  
  9323. local envelopeDrag = Instance.new("Frame")
  9324. envelopeDrag.BackgroundTransparency = 1
  9325. envelopeDrag.BackgroundColor3 = Color3.new(0,0,0)
  9326. envelopeDrag.BorderSizePixel = 0
  9327. envelopeDrag.Size = UDim2.new(0,7,0,20)
  9328. envelopeDrag.Visible = false
  9329. envelopeDrag.ZIndex = 2
  9330. local envelopeDragLine = Instance.new("Frame",envelopeDrag)
  9331. envelopeDragLine.Name = "Line"
  9332. envelopeDragLine.BackgroundColor3 = Color3.new(0,0,0)
  9333. envelopeDragLine.BorderSizePixel = 0
  9334. envelopeDragLine.Position = UDim2.new(0,3,0,0)
  9335. envelopeDragLine.Size = UDim2.new(0,1,0,20)
  9336. envelopeDragLine.ZIndex = 2
  9337.  
  9338. local envelopeDragTop,envelopeDragBottom = envelopeDrag:Clone(),envelopeDrag:Clone()
  9339. envelopeDragTop.Parent = numberLine
  9340. envelopeDragBottom.Parent = numberLine
  9341.  
  9342. local function buildSequence()
  9343. local newPoints = {}
  9344. for i,v in pairs(points) do
  9345. table.insert(newPoints,NumberSequenceKeypoint.new(v[2],v[1],v[3]))
  9346. end
  9347. newMt.Sequence = NumberSequence.new(newPoints)
  9348. newMt.OnSelect:Fire(newMt.Sequence)
  9349. end
  9350.  
  9351. local function round(num,places)
  9352. local multi = 10^places
  9353. return math.floor(num*multi + 0.5)/multi
  9354. end
  9355.  
  9356. local function updateInputs(point)
  9357. if point then
  9358. currentPoint = point
  9359. local rawT,rawV,rawE = point[2],point[1],point[3]
  9360. timeBox.Text = round(rawT,(rawT < 0.01 and 5) or (rawT < 0.1 and 4) or 3)
  9361. valueBox.Text = round(rawV,(rawV < 0.01 and 5) or (rawV < 0.1 and 4) or (rawV < 1 and 3) or 2)
  9362. envelopeBox.Text = round(rawE,(rawE < 0.01 and 5) or (rawE < 0.1 and 4) or (rawV < 1 and 3) or 2)
  9363.  
  9364. local envelopeDistance = numberLine.AbsoluteSize.Y*(point[3]/10)
  9365. envelopeDragTop.Position = UDim2.new(0,point[4].Position.X.Offset-1,0,point[4].Position.Y.Offset-envelopeDistance-17)
  9366. envelopeDragTop.Visible = true
  9367. envelopeDragBottom.Position = UDim2.new(0,point[4].Position.X.Offset-1,0,point[4].Position.Y.Offset+envelopeDistance+2)
  9368. envelopeDragBottom.Visible = true
  9369. end
  9370. end
  9371.  
  9372. envelopeDragTop.InputBegan:Connect(function(input)
  9373. if (input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch) or not currentPoint or Lib.CheckMouseInGui(currentPoint[4].Select) then return end
  9374.  
  9375. local mouseEvent, releaseEvent
  9376. local maxSize = numberLine.AbsoluteSize.Y
  9377. local mouseDelta = math.abs(envelopeDragTop.AbsolutePosition.Y - mouse.Y)
  9378.  
  9379. envelopeDragTop.Line.Position = UDim2.new(0, 2, 0, 0)
  9380. envelopeDragTop.Line.Size = UDim2.new(0, 3, 0, 20)
  9381.  
  9382. releaseEvent = user.InputEnded:Connect(function(input)
  9383. if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then return end
  9384. mouseEvent:Disconnect()
  9385. releaseEvent:Disconnect()
  9386. envelopeDragTop.Line.Position = UDim2.new(0, 3, 0, 0)
  9387. envelopeDragTop.Line.Size = UDim2.new(0, 1, 0, 20)
  9388. end)
  9389.  
  9390. mouseEvent = user.InputChanged:Connect(function(input)
  9391. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  9392. local topDiff = (currentPoint[4].AbsolutePosition.Y + 2) - (mouse.Y - mouseDelta) - 19
  9393. local newEnvelope = 10 * (math.max(topDiff, 0) / maxSize)
  9394. local maxEnvelope = math.min(currentPoint[1], 10 - currentPoint[1])
  9395. currentPoint[3] = math.min(newEnvelope, maxEnvelope)
  9396. newMt:Redraw()
  9397. buildSequence()
  9398. updateInputs(currentPoint)
  9399. end
  9400. end)
  9401. end)
  9402.  
  9403. envelopeDragBottom.InputBegan:Connect(function(input)
  9404. if (input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch) or not currentPoint or Lib.CheckMouseInGui(currentPoint[4].Select) then return end
  9405.  
  9406. local mouseEvent, releaseEvent
  9407. local maxSize = numberLine.AbsoluteSize.Y
  9408. local mouseDelta = math.abs(envelopeDragBottom.AbsolutePosition.Y - mouse.Y)
  9409.  
  9410. envelopeDragBottom.Line.Position = UDim2.new(0, 2, 0, 0)
  9411. envelopeDragBottom.Line.Size = UDim2.new(0, 3, 0, 20)
  9412.  
  9413. releaseEvent = user.InputEnded:Connect(function(input)
  9414. if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then return end
  9415. mouseEvent:Disconnect()
  9416. releaseEvent:Disconnect()
  9417. envelopeDragBottom.Line.Position = UDim2.new(0, 3, 0, 0)
  9418. envelopeDragBottom.Line.Size = UDim2.new(0, 1, 0, 20)
  9419. end)
  9420.  
  9421. mouseEvent = user.InputChanged:Connect(function(input)
  9422. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  9423. local bottomDiff = (mouse.Y + (20 - mouseDelta)) - (currentPoint[4].AbsolutePosition.Y + 2) - 19
  9424. local newEnvelope = 10 * (math.max(bottomDiff, 0) / maxSize)
  9425. local maxEnvelope = math.min(currentPoint[1], 10 - currentPoint[1])
  9426. currentPoint[3] = math.min(newEnvelope, maxEnvelope)
  9427. newMt:Redraw()
  9428. buildSequence()
  9429. updateInputs(currentPoint)
  9430. end
  9431. end)
  9432. end)
  9433.  
  9434. local function placePoint(point)
  9435. local newPoint = Instance.new("Frame")
  9436. newPoint.Name = "Point"
  9437. newPoint.BorderSizePixel = 0
  9438. newPoint.Size = UDim2.new(0,5,0,5)
  9439. newPoint.Position = UDim2.new(0,math.floor((numberLine.AbsoluteSize.X-1) * point[2])-2,0,numberLine.AbsoluteSize.Y*(10-point[1])/10-2)
  9440. newPoint.BackgroundColor3 = Color3.new(0,0,0)
  9441.  
  9442. local newSelect = Instance.new("Frame")
  9443. newSelect.Name = "Select"
  9444. newSelect.BackgroundTransparency = 1
  9445. newSelect.BackgroundColor3 = Color3.new(199/255,44/255,28/255)
  9446. newSelect.Position = UDim2.new(0,-2,0,-2)
  9447. newSelect.Size = UDim2.new(0,9,0,9)
  9448. newSelect.Parent = newPoint
  9449.  
  9450. newPoint.Parent = numberLine
  9451.  
  9452.  
  9453. newSelect.InputBegan:Connect(function(input)
  9454. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  9455. for i, v in pairs(points) do
  9456. v[4].Select.BackgroundTransparency = 1
  9457. end
  9458.  
  9459. newSelect.BackgroundTransparency = 0
  9460. updateInputs(point)
  9461. end
  9462.  
  9463. if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and not currentlySelected then
  9464. currentPoint = point
  9465. local mouseEvent, releaseEvent
  9466. currentlySelected = true
  9467. newSelect.BackgroundColor3 = Color3.new(249/255, 191/255, 59/255)
  9468.  
  9469. local oldEnvelope = point[3]
  9470.  
  9471. releaseEvent = user.InputEnded:Connect(function(input)
  9472. if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then return end
  9473.  
  9474. mouseEvent:Disconnect()
  9475. releaseEvent:Disconnect()
  9476. currentlySelected = nil
  9477. newSelect.BackgroundColor3 = Color3.new(199/255, 44/255, 28/255)
  9478. end)
  9479.  
  9480. mouseEvent = user.InputChanged:Connect(function(input)
  9481. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  9482. local maxX = numberLine.AbsoluteSize.X - 1
  9483. local relativeX = (input.Position.X - numberLine.AbsolutePosition.X)
  9484. if relativeX < 0 then relativeX = 0 end
  9485. if relativeX > maxX then relativeX = maxX end
  9486.  
  9487. local maxY = numberLine.AbsoluteSize.Y - 1
  9488. local relativeY = (input.Position.Y - numberLine.AbsolutePosition.Y)
  9489. if relativeY < 0 then relativeY = 0 end
  9490. if relativeY > maxY then relativeY = maxY end
  9491.  
  9492. if point ~= beginPoint and point ~= endPoint then
  9493. point[2] = relativeX / maxX
  9494. end
  9495.  
  9496. point[1] = 10 - (relativeY / maxY) * 10
  9497. local maxEnvelope = math.min(point[1], 10 - point[1])
  9498. point[3] = math.min(oldEnvelope, maxEnvelope)
  9499. newMt:Redraw()
  9500. updateInputs(point)
  9501.  
  9502. for i, v in pairs(points) do
  9503. v[4].Select.BackgroundTransparency = 1
  9504. end
  9505.  
  9506. newSelect.BackgroundTransparency = 0
  9507. buildSequence()
  9508. end
  9509. end)
  9510. end
  9511. end)
  9512.  
  9513. return newPoint
  9514. end
  9515.  
  9516. local function placePoints()
  9517. for i,v in pairs(points) do
  9518. v[4] = placePoint(v)
  9519. end
  9520. end
  9521.  
  9522. local function redraw(self)
  9523. local numberLineSize = numberLine.AbsoluteSize
  9524. table.sort(points,function(a,b) return a[2] < b[2] end)
  9525. for i,v in pairs(points) do
  9526. v[4].Position = UDim2.new(0,math.floor((numberLineSize.X-1) * v[2])-2,0,(numberLineSize.Y-1)*(10-v[1])/10-2)
  9527. end
  9528. lines[1].Size = UDim2.new(0,1,0,0)
  9529. for i = 1,#points-1 do
  9530. local fromPoint = points[i]
  9531. local toPoint = points[i+1]
  9532. local deltaY = toPoint[4].Position.Y.Offset-fromPoint[4].Position.Y.Offset
  9533. local deltaX = toPoint[4].Position.X.Offset-fromPoint[4].Position.X.Offset
  9534. local slope = deltaY/deltaX
  9535.  
  9536. local fromEnvelope = fromPoint[3]
  9537. local nextEnvelope = toPoint[3]
  9538.  
  9539. local currentRise = math.abs(slope)
  9540. local totalRise = 0
  9541. local maxRise = math.abs(toPoint[4].Position.Y.Offset-fromPoint[4].Position.Y.Offset)
  9542.  
  9543. for lineCount = math.min(fromPoint[4].Position.X.Offset+1,toPoint[4].Position.X.Offset),toPoint[4].Position.X.Offset do
  9544. if deltaX == 0 and deltaY == 0 then return end
  9545. local riseNow = math.floor(currentRise)
  9546. local line = lines[lineCount+3]
  9547. if line then
  9548. if totalRise+riseNow > maxRise then riseNow = maxRise-totalRise end
  9549. if math.sign(slope) == -1 then
  9550. line.Position = UDim2.new(0,lineCount+2,0,fromPoint[4].Position.Y.Offset + -(totalRise+riseNow)+2)
  9551. else
  9552. line.Position = UDim2.new(0,lineCount+2,0,fromPoint[4].Position.Y.Offset + totalRise+2)
  9553. end
  9554. line.Size = UDim2.new(0,1,0,math.max(riseNow,1))
  9555. end
  9556. totalRise = totalRise + riseNow
  9557. currentRise = currentRise - riseNow + math.abs(slope)
  9558.  
  9559. local envPercent = (lineCount-fromPoint[4].Position.X.Offset)/(toPoint[4].Position.X.Offset-fromPoint[4].Position.X.Offset)
  9560. local envLerp = fromEnvelope+(nextEnvelope-fromEnvelope)*envPercent
  9561. local relativeSize = (envLerp/10)*numberLineSize.Y
  9562.  
  9563. local line = eLines[lineCount + 3]
  9564. if line then
  9565. line.Position = UDim2.new(0,lineCount+2,0,lines[lineCount+3].Position.Y.Offset-math.floor(relativeSize))
  9566. line.Size = UDim2.new(0,1,0,math.floor(relativeSize*2))
  9567. end
  9568. end
  9569. end
  9570. end
  9571. newMt.Redraw = redraw
  9572.  
  9573.  
  9574.  
  9575. local function loadSequence(self,seq)
  9576. resetSequence = seq
  9577. for i,v in pairs(points) do if v[4] then v[4]:Destroy() end end
  9578. points = {}
  9579. for i,v in pairs(seq.Keypoints) do
  9580. local maxEnvelope = math.min(v.Value,10-v.Value)
  9581. local newPoint = {v.Value,v.Time,math.min(v.Envelope,maxEnvelope)}
  9582. newPoint[4] = placePoint(newPoint)
  9583. table.insert(points,newPoint)
  9584. end
  9585. beginPoint = points[1]
  9586. endPoint = points[#points]
  9587. currentlySelected = nil
  9588. redraw()
  9589. envelopeDragTop.Visible = false
  9590. envelopeDragBottom.Visible = false
  9591. end
  9592. newMt.SetSequence = loadSequence
  9593.  
  9594. timeBox.FocusLost:Connect(function()
  9595. local point = currentPoint
  9596. local num = tonumber(timeBox.Text)
  9597. if point and num and point ~= beginPoint and point ~= endPoint then
  9598. num = math.clamp(num,0,1)
  9599. point[2] = num
  9600. redraw()
  9601. buildSequence()
  9602. updateInputs(point)
  9603. end
  9604. end)
  9605.  
  9606. valueBox.FocusLost:Connect(function()
  9607. local point = currentPoint
  9608. local num = tonumber(valueBox.Text)
  9609. if point and num then
  9610. local oldEnvelope = point[3]
  9611. num = math.clamp(num,0,10)
  9612. point[1] = num
  9613. local maxEnvelope = math.min(point[1],10-point[1])
  9614. point[3] = math.min(oldEnvelope,maxEnvelope)
  9615. redraw()
  9616. buildSequence()
  9617. updateInputs(point)
  9618. end
  9619. end)
  9620.  
  9621. envelopeBox.FocusLost:Connect(function()
  9622. local point = currentPoint
  9623. local num = tonumber(envelopeBox.Text)
  9624. if point and num then
  9625. num = math.clamp(num,0,5)
  9626. local maxEnvelope = math.min(point[1],10-point[1])
  9627. point[3] = math.min(num,maxEnvelope)
  9628. redraw()
  9629. buildSequence()
  9630. updateInputs(point)
  9631. end
  9632. end)
  9633.  
  9634. local function buttonAnimations(button,inverse)
  9635. button.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then button.BackgroundTransparency = (inverse and 0.5 or 0.4) end end)
  9636. button.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then button.BackgroundTransparency = (inverse and 1 or 0) end end)
  9637. end
  9638.  
  9639. numberLine.InputBegan:Connect(function(input)
  9640. if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and #points < 20 then
  9641.  
  9642. if Lib.CheckMouseInGui(envelopeDragTop) or Lib.CheckMouseInGui(envelopeDragBottom) then return end
  9643.  
  9644. for i, v in pairs(points) do
  9645. if Lib.CheckMouseInGui(v[4].Select) then
  9646. return
  9647. end
  9648. end
  9649.  
  9650. local maxX = numberLine.AbsoluteSize.X - 1
  9651. local relativeX = (input.Position.X - numberLine.AbsolutePosition.X)
  9652. if relativeX < 0 then relativeX = 0 end
  9653. if relativeX > maxX then relativeX = maxX end
  9654.  
  9655. local maxY = numberLine.AbsoluteSize.Y - 1
  9656. local relativeY = (input.Position.Y - numberLine.AbsolutePosition.Y)
  9657. if relativeY < 0 then relativeY = 0 end
  9658. if relativeY > maxY then relativeY = maxY end
  9659.  
  9660. local raw = relativeX / maxX
  9661. local newPoint = {10 - (relativeY / maxY) * 10, raw, 0}
  9662. newPoint[4] = placePoint(newPoint)
  9663. table.insert(points, newPoint)
  9664. redraw()
  9665. buildSequence()
  9666. end
  9667. end)
  9668.  
  9669. deleteButton.MouseButton1Click:Connect(function()
  9670. if currentPoint and currentPoint ~= beginPoint and currentPoint ~= endPoint then
  9671. for i,v in pairs(points) do
  9672. if v == currentPoint then
  9673. v[4]:Destroy()
  9674. table.remove(points,i)
  9675. break
  9676. end
  9677. end
  9678. currentlySelected = nil
  9679. redraw()
  9680. buildSequence()
  9681. updateInputs(points[1])
  9682. end
  9683. end)
  9684.  
  9685. resetButton.MouseButton1Click:Connect(function()
  9686. if resetSequence then
  9687. newMt:SetSequence(resetSequence)
  9688. buildSequence()
  9689. end
  9690. end)
  9691.  
  9692. closeButton.MouseButton1Click:Connect(function()
  9693. window:Close()
  9694. end)
  9695.  
  9696. buttonAnimations(deleteButton)
  9697. buttonAnimations(resetButton)
  9698. buttonAnimations(closeButton)
  9699.  
  9700. placePoints()
  9701. redraw()
  9702.  
  9703. newMt.Show = function(self)
  9704. window:Show()
  9705. end
  9706.  
  9707. return newMt
  9708. end
  9709.  
  9710. return {new = new}
  9711. end)()
  9712.  
  9713. Lib.ColorSequenceEditor = (function() -- TODO: Convert to newer class model
  9714. local function new()
  9715. local newMt = setmetatable({},{})
  9716. newMt.OnSelect = Lib.Signal.new()
  9717. newMt.OnCancel = Lib.Signal.new()
  9718. newMt.OnPreview = Lib.Signal.new()
  9719. newMt.OnPickColor = Lib.Signal.new()
  9720.  
  9721. local guiContents = create({
  9722. {1,"Frame",{BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderSizePixel=0,ClipsDescendants=true,Name="Content",Position=UDim2.new(0,0,0,20),Size=UDim2.new(1,0,1,-20),}},
  9723. {2,"Frame",{BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),Name="ColorLine",Parent={1},Position=UDim2.new(0,10,0,5),Size=UDim2.new(1,-20,0,70),}},
  9724. {3,"Frame",{BackgroundColor3=Color3.new(1,1,1),BorderSizePixel=0,Name="Gradient",Parent={2},Size=UDim2.new(1,0,1,0),}},
  9725. {4,"UIGradient",{Parent={3},}},
  9726. {5,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Name="Arrows",Parent={1},Position=UDim2.new(0,1,0,73),Size=UDim2.new(1,-2,0,16),}},
  9727. {6,"Frame",{BackgroundColor3=Color3.new(0,0,0),BackgroundTransparency=0.5,BorderSizePixel=0,Name="Cursor",Parent={1},Position=UDim2.new(0,10,0,0),Size=UDim2.new(0,1,0,80),}},
  9728. {7,"Frame",{BackgroundColor3=Color3.new(0.14901961386204,0.14901961386204,0.14901961386204),BorderColor3=Color3.new(0.12549020349979,0.12549020349979,0.12549020349979),Name="Time",Parent={1},Position=UDim2.new(0,40,0,95),Size=UDim2.new(0,100,0,20),}},
  9729. {8,"TextBox",{BackgroundColor3=Color3.new(0.25098040699959,0.25098040699959,0.25098040699959),BackgroundTransparency=1,BorderColor3=Color3.new(0.37647062540054,0.37647062540054,0.37647062540054),ClipsDescendants=true,Font=3,Name="Input",Parent={7},Position=UDim2.new(0,2,0,0),Size=UDim2.new(0,98,0,20),Text="0",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=0,}},
  9730. {9,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={7},Position=UDim2.new(0,-40,0,0),Size=UDim2.new(0,34,1,0),Text="Time",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  9731. {10,"Frame",{BackgroundColor3=Color3.new(1,1,1),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),Name="ColorBox",Parent={1},Position=UDim2.new(0,220,0,95),Size=UDim2.new(0,20,0,20),}},
  9732. {11,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Title",Parent={10},Position=UDim2.new(0,-40,0,0),Size=UDim2.new(0,34,1,0),Text="Color",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,TextXAlignment=1,}},
  9733. {12,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),BorderSizePixel=0,Font=3,Name="Close",Parent={1},Position=UDim2.new(1,-90,0,95),Size=UDim2.new(0,80,0,20),Text="Close",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,}},
  9734. {13,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),BorderSizePixel=0,Font=3,Name="Reset",Parent={1},Position=UDim2.new(1,-180,0,95),Size=UDim2.new(0,80,0,20),Text="Reset",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,}},
  9735. {14,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderColor3=Color3.new(0.21568627655506,0.21568627655506,0.21568627655506),BorderSizePixel=0,Font=3,Name="Delete",Parent={1},Position=UDim2.new(0,280,0,95),Size=UDim2.new(0,80,0,20),Text="Delete",TextColor3=Color3.new(0.86274516582489,0.86274516582489,0.86274516582489),TextSize=14,}},
  9736. {15,"Frame",{BackgroundTransparency=1,Name="Arrow",Parent={1},Size=UDim2.new(0,16,0,16),Visible=false,}},
  9737. {16,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={15},Position=UDim2.new(0,8,0,3),Size=UDim2.new(0,1,0,2),}},
  9738. {17,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={15},Position=UDim2.new(0,7,0,5),Size=UDim2.new(0,3,0,2),}},
  9739. {18,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={15},Position=UDim2.new(0,6,0,7),Size=UDim2.new(0,5,0,2),}},
  9740. {19,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={15},Position=UDim2.new(0,5,0,9),Size=UDim2.new(0,7,0,2),}},
  9741. {20,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={15},Position=UDim2.new(0,4,0,11),Size=UDim2.new(0,9,0,2),}},
  9742. })
  9743. local window = Lib.Window.new()
  9744. window.Resizable = false
  9745. window:Resize(650,150)
  9746. window:SetTitle("ColorSequence Editor")
  9747. newMt.Window = window
  9748. newMt.Gui = window.Gui
  9749. for i,v in pairs(guiContents:GetChildren()) do
  9750. v.Parent = window.GuiElems.Content
  9751. end
  9752. local gui = window.Gui
  9753. local pickerGui = gui.Main
  9754. local pickerTopBar = pickerGui.TopBar
  9755. local pickerFrame = pickerGui.Content
  9756. local colorLine = pickerFrame.ColorLine
  9757. local gradient = colorLine.Gradient.UIGradient
  9758. local arrowFrame = pickerFrame.Arrows
  9759. local arrow = pickerFrame.Arrow
  9760. local cursor = pickerFrame.Cursor
  9761. local timeBox = pickerFrame.Time.Input
  9762. local colorBox = pickerFrame.ColorBox
  9763. local deleteButton = pickerFrame.Delete
  9764. local resetButton = pickerFrame.Reset
  9765. local closeButton = pickerFrame.Close
  9766. local topClose = pickerTopBar.Close
  9767.  
  9768. local user = service.UserInputService
  9769. local mouse = service.Players.LocalPlayer:GetMouse()
  9770.  
  9771. local colors = {{Color3.new(1,0,1),0},{Color3.new(0.2,0.9,0.2),0.2},{Color3.new(0.4,0.5,0.9),0.7},{Color3.new(0.6,1,1),1}}
  9772. local resetSequence = nil
  9773.  
  9774. local beginPoint = colors[1]
  9775. local endPoint = colors[#colors]
  9776.  
  9777. local currentlySelected = nil
  9778. local currentPoint = nil
  9779.  
  9780. local sequenceLine = Instance.new("Frame")
  9781. sequenceLine.BorderSizePixel = 0
  9782. sequenceLine.Size = UDim2.new(0,1,1,0)
  9783.  
  9784. newMt.Sequence = ColorSequence.new(Color3.new(1,1,1))
  9785. local function buildSequence(noupdate)
  9786. local newPoints = {}
  9787. table.sort(colors,function(a,b) return a[2] < b[2] end)
  9788. for i,v in pairs(colors) do
  9789. table.insert(newPoints,ColorSequenceKeypoint.new(v[2],v[1]))
  9790. end
  9791. newMt.Sequence = ColorSequence.new(newPoints)
  9792. if not noupdate then newMt.OnSelect:Fire(newMt.Sequence) end
  9793. end
  9794.  
  9795. local function round(num,places)
  9796. local multi = 10^places
  9797. return math.floor(num*multi + 0.5)/multi
  9798. end
  9799.  
  9800. local function updateInputs(point)
  9801. if point then
  9802. currentPoint = point
  9803. local raw = point[2]
  9804. timeBox.Text = round(raw,(raw < 0.01 and 5) or (raw < 0.1 and 4) or 3)
  9805. colorBox.BackgroundColor3 = point[1]
  9806. end
  9807. end
  9808.  
  9809. local function placeArrow(ind,point)
  9810. local newArrow = arrow:Clone()
  9811. newArrow.Position = UDim2.new(0,ind-1,0,0)
  9812. newArrow.Visible = true
  9813. newArrow.Parent = arrowFrame
  9814.  
  9815. newArrow.InputBegan:Connect(function(input)
  9816. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  9817. cursor.Visible = true
  9818. cursor.Position = UDim2.new(0, 9 + newArrow.Position.X.Offset, 0, 0)
  9819. end
  9820.  
  9821. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  9822. updateInputs(point)
  9823. if point == beginPoint or point == endPoint or currentlySelected then return end
  9824.  
  9825. local mouseEvent, releaseEvent
  9826. currentlySelected = true
  9827.  
  9828. releaseEvent = user.InputEnded:Connect(function(input)
  9829. if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then return end
  9830. mouseEvent:Disconnect()
  9831. releaseEvent:Disconnect()
  9832. currentlySelected = nil
  9833. cursor.Visible = false
  9834. end)
  9835.  
  9836. mouseEvent = user.InputChanged:Connect(function(input)
  9837. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  9838. local maxSize = colorLine.AbsoluteSize.X - 1
  9839. local relativeX = (input.Position.X - colorLine.AbsolutePosition.X)
  9840. if relativeX < 0 then relativeX = 0 end
  9841. if relativeX > maxSize then relativeX = maxSize end
  9842. local raw = relativeX / maxSize
  9843. point[2] = relativeX / maxSize
  9844. updateInputs(point)
  9845. cursor.Visible = true
  9846. cursor.Position = UDim2.new(0, 9 + newArrow.Position.X.Offset, 0, 0)
  9847. buildSequence()
  9848. newMt:Redraw()
  9849. end
  9850. end)
  9851. end
  9852. end)
  9853.  
  9854. newArrow.InputEnded:Connect(function(input)
  9855. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  9856. cursor.Visible = false
  9857. end
  9858. end)
  9859.  
  9860.  
  9861.  
  9862. return newArrow
  9863. end
  9864.  
  9865. local function placeArrows()
  9866. for i,v in pairs(colors) do
  9867. v[3] = placeArrow(math.floor((colorLine.AbsoluteSize.X-1) * v[2]) + 1,v)
  9868. end
  9869. end
  9870.  
  9871. local function redraw(self)
  9872. gradient.Color = newMt.Sequence or ColorSequence.new(Color3.new(1,1,1))
  9873.  
  9874. for i = 2,#colors do
  9875. local nextColor = colors[i]
  9876. local endPos = math.floor((colorLine.AbsoluteSize.X-1) * nextColor[2]) + 1
  9877. nextColor[3].Position = UDim2.new(0,endPos,0,0)
  9878. end
  9879. end
  9880. newMt.Redraw = redraw
  9881.  
  9882. local function loadSequence(self,seq)
  9883. resetSequence = seq
  9884. for i,v in pairs(colors) do if v[3] then v[3]:Destroy() end end
  9885. colors = {}
  9886. currentlySelected = nil
  9887. for i,v in pairs(seq.Keypoints) do
  9888. local newPoint = {v.Value,v.Time}
  9889. newPoint[3] = placeArrow(v.Time,newPoint)
  9890. table.insert(colors,newPoint)
  9891. end
  9892. beginPoint = colors[1]
  9893. endPoint = colors[#colors]
  9894. currentlySelected = nil
  9895. updateInputs(colors[1])
  9896. buildSequence(true)
  9897. redraw()
  9898. end
  9899. newMt.SetSequence = loadSequence
  9900.  
  9901. local function buttonAnimations(button,inverse)
  9902. button.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then button.BackgroundTransparency = (inverse and 0.5 or 0.4) end end)
  9903. button.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then button.BackgroundTransparency = (inverse and 1 or 0) end end)
  9904. end
  9905.  
  9906. colorLine.InputBegan:Connect(function(input)
  9907. if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and #colors < 20 then
  9908. local maxSize = colorLine.AbsoluteSize.X - 1
  9909. local relativeX = (input.Position.X - colorLine.AbsolutePosition.X)
  9910. if relativeX < 0 then relativeX = 0 end
  9911. if relativeX > maxSize then relativeX = maxSize end
  9912.  
  9913. local raw = relativeX / maxSize
  9914. local fromColor = nil
  9915. local toColor = nil
  9916. for i, col in pairs(colors) do
  9917. if col[2] >= raw then
  9918. fromColor = colors[math.max(i - 1, 1)]
  9919. toColor = colors[i]
  9920. break
  9921. end
  9922. end
  9923. local lerpColor = fromColor[1]:lerp(toColor[1], (raw - fromColor[2]) / (toColor[2] - fromColor[2]))
  9924. local newPoint = {lerpColor, raw}
  9925. newPoint[3] = placeArrow(newPoint[2], newPoint)
  9926. table.insert(colors, newPoint)
  9927. updateInputs(newPoint)
  9928. buildSequence()
  9929. redraw()
  9930. end
  9931. end)
  9932.  
  9933. colorLine.InputChanged:Connect(function(input)
  9934. if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
  9935. local maxSize = colorLine.AbsoluteSize.X - 1
  9936. local relativeX = (input.Position.X - colorLine.AbsolutePosition.X)
  9937. if relativeX < 0 then relativeX = 0 end
  9938. if relativeX > maxSize then relativeX = maxSize end
  9939. cursor.Visible = true
  9940. cursor.Position = UDim2.new(0, 10 + relativeX, 0, 0)
  9941. end
  9942. end)
  9943.  
  9944. colorLine.InputEnded:Connect(function(input)
  9945. if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
  9946. local inArrow = false
  9947. for i, v in pairs(colors) do
  9948. if Lib.CheckMouseInGui(v[3]) then
  9949. inArrow = v[3]
  9950. end
  9951. end
  9952. cursor.Visible = inArrow and true or false
  9953. if inArrow then cursor.Position = UDim2.new(0, 9 + inArrow.Position.X.Offset, 0, 0) end
  9954. end
  9955. end)
  9956.  
  9957. timeBox:GetPropertyChangedSignal("Text"):Connect(function()
  9958. local point = currentPoint
  9959. local num = tonumber(timeBox.Text)
  9960. if point and num and point ~= beginPoint and point ~= endPoint then
  9961. num = math.clamp(num,0,1)
  9962. point[2] = num
  9963. buildSequence()
  9964. redraw()
  9965. end
  9966. end)
  9967.  
  9968. colorBox.InputBegan:Connect(function(input)
  9969. if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
  9970. local editor = newMt.ColorPicker
  9971. if not editor then
  9972. editor = Lib.ColorPicker.new()
  9973. editor.Window:SetTitle("ColorSequence Color Picker")
  9974.  
  9975. editor.OnSelect:Connect(function(col)
  9976. if currentPoint then
  9977. currentPoint[1] = col
  9978. end
  9979. buildSequence()
  9980. redraw()
  9981. end)
  9982.  
  9983. newMt.ColorPicker = editor
  9984. end
  9985.  
  9986. editor.Window:ShowAndFocus()
  9987. end
  9988. end)
  9989.  
  9990. deleteButton.MouseButton1Click:Connect(function()
  9991. if currentPoint and currentPoint ~= beginPoint and currentPoint ~= endPoint then
  9992. for i,v in pairs(colors) do
  9993. if v == currentPoint then
  9994. v[3]:Destroy()
  9995. table.remove(colors,i)
  9996. break
  9997. end
  9998. end
  9999. currentlySelected = nil
  10000. updateInputs(colors[1])
  10001. buildSequence()
  10002. redraw()
  10003. end
  10004. end)
  10005.  
  10006. resetButton.MouseButton1Click:Connect(function()
  10007. if resetSequence then
  10008. newMt:SetSequence(resetSequence)
  10009. end
  10010. end)
  10011.  
  10012. closeButton.MouseButton1Click:Connect(function()
  10013. window:Close()
  10014. end)
  10015.  
  10016. topClose.MouseButton1Click:Connect(function()
  10017. window:Close()
  10018. end)
  10019.  
  10020. buttonAnimations(deleteButton)
  10021. buttonAnimations(resetButton)
  10022. buttonAnimations(closeButton)
  10023.  
  10024. placeArrows()
  10025. redraw()
  10026.  
  10027. newMt.Show = function(self)
  10028. window:Show()
  10029. end
  10030.  
  10031. return newMt
  10032. end
  10033.  
  10034. return {new = new}
  10035. end)()
  10036.  
  10037. Lib.ViewportTextBox = (function()
  10038. local textService = service.TextService
  10039.  
  10040. local props = {
  10041. OffsetX = 0,
  10042. TextBox = PH,
  10043. CursorPos = -1,
  10044. Gui = PH,
  10045. View = PH
  10046. }
  10047. local funcs = {}
  10048. funcs.Update = function(self)
  10049. local cursorPos = self.CursorPos or -1
  10050. local text = self.TextBox.Text
  10051. if text == "" then self.TextBox.Position = UDim2.new(0,0,0,0) return end
  10052. if cursorPos == -1 then return end
  10053.  
  10054. local cursorText = text:sub(1,cursorPos-1)
  10055. local pos = nil
  10056. local leftEnd = -self.TextBox.Position.X.Offset
  10057. local rightEnd = leftEnd + self.View.AbsoluteSize.X
  10058.  
  10059. local totalTextSize = textService:GetTextSize(text,self.TextBox.TextSize,self.TextBox.Font,Vector2.new(999999999,100)).X
  10060. local cursorTextSize = textService:GetTextSize(cursorText,self.TextBox.TextSize,self.TextBox.Font,Vector2.new(999999999,100)).X
  10061.  
  10062. if cursorTextSize > rightEnd then
  10063. pos = math.max(-1,cursorTextSize - self.View.AbsoluteSize.X + 2)
  10064. elseif cursorTextSize < leftEnd then
  10065. pos = math.max(-1,cursorTextSize-2)
  10066. elseif totalTextSize < rightEnd then
  10067. pos = math.max(-1,totalTextSize - self.View.AbsoluteSize.X + 2)
  10068. end
  10069.  
  10070. if pos then
  10071. self.TextBox.Position = UDim2.new(0,-pos,0,0)
  10072. self.TextBox.Size = UDim2.new(1,pos,1,0)
  10073. end
  10074. end
  10075.  
  10076. funcs.GetText = function(self)
  10077. return self.TextBox.Text
  10078. end
  10079.  
  10080. funcs.SetText = function(self,text)
  10081. self.TextBox.Text = text
  10082. end
  10083.  
  10084. local mt = getGuiMT(props,funcs)
  10085.  
  10086. local function convert(textbox)
  10087. local obj = initObj(props,mt)
  10088.  
  10089. local view = Instance.new("Frame")
  10090. view.BackgroundTransparency = textbox.BackgroundTransparency
  10091. view.BackgroundColor3 = textbox.BackgroundColor3
  10092. view.BorderSizePixel = textbox.BorderSizePixel
  10093. view.BorderColor3 = textbox.BorderColor3
  10094. view.Position = textbox.Position
  10095. view.Size = textbox.Size
  10096. view.ClipsDescendants = true
  10097. view.Name = textbox.Name
  10098. textbox.BackgroundTransparency = 1
  10099. textbox.Position = UDim2.new(0,0,0,0)
  10100. textbox.Size = UDim2.new(1,0,1,0)
  10101. textbox.TextXAlignment = Enum.TextXAlignment.Left
  10102. textbox.Name = "Input"
  10103.  
  10104. obj.TextBox = textbox
  10105. obj.View = view
  10106. obj.Gui = view
  10107.  
  10108. textbox.Changed:Connect(function(prop)
  10109. if prop == "Text" or prop == "CursorPosition" or prop == "AbsoluteSize" then
  10110. local cursorPos = obj.TextBox.CursorPosition
  10111. if cursorPos ~= -1 then obj.CursorPos = cursorPos end
  10112. obj:Update()
  10113. end
  10114. end)
  10115.  
  10116. obj:Update()
  10117.  
  10118. view.Parent = textbox.Parent
  10119. textbox.Parent = view
  10120.  
  10121. return obj
  10122. end
  10123.  
  10124. local function new()
  10125. local textBox = Instance.new("TextBox")
  10126. textBox.Size = UDim2.new(0,100,0,20)
  10127. textBox.BackgroundColor3 = Settings.Theme.TextBox
  10128. textBox.BorderColor3 = Settings.Theme.Outline3
  10129. textBox.ClearTextOnFocus = false
  10130. textBox.TextColor3 = Settings.Theme.Text
  10131. textBox.Font = Enum.Font.SourceSans
  10132. textBox.TextSize = 14
  10133. textBox.Text = ""
  10134. return convert(textBox)
  10135. end
  10136.  
  10137. return {new = new, convert = convert}
  10138. end)()
  10139.  
  10140. Lib.Label = (function()
  10141. local props,funcs = {},{}
  10142.  
  10143. local mt = getGuiMT(props,funcs)
  10144.  
  10145. local function new()
  10146. local label = Instance.new("TextLabel")
  10147. label.BackgroundTransparency = 1
  10148. label.TextXAlignment = Enum.TextXAlignment.Left
  10149. label.TextColor3 = Settings.Theme.Text
  10150. label.TextTransparency = 0.1
  10151. label.Size = UDim2.new(0,100,0,20)
  10152. label.Font = Enum.Font.SourceSans
  10153. label.TextSize = 14
  10154.  
  10155. local obj = setmetatable({
  10156. Gui = label
  10157. },mt)
  10158. return obj
  10159. end
  10160.  
  10161. return {new = new}
  10162. end)()
  10163.  
  10164. Lib.Frame = (function()
  10165. local props,funcs = {},{}
  10166.  
  10167. local mt = getGuiMT(props,funcs)
  10168.  
  10169. local function new()
  10170. local fr = Instance.new("Frame")
  10171. fr.BackgroundColor3 = Settings.Theme.Main1
  10172. fr.BorderColor3 = Settings.Theme.Outline1
  10173. fr.Size = UDim2.new(0,50,0,50)
  10174.  
  10175. local obj = setmetatable({
  10176. Gui = fr
  10177. },mt)
  10178. return obj
  10179. end
  10180.  
  10181. return {new = new}
  10182. end)()
  10183.  
  10184. Lib.Button = (function()
  10185. local props = {
  10186. Gui = PH,
  10187. Anim = PH,
  10188. Disabled = false,
  10189. OnClick = SIGNAL,
  10190. OnDown = SIGNAL,
  10191. OnUp = SIGNAL,
  10192. AllowedButtons = {1}
  10193. }
  10194. local funcs = {}
  10195. local tableFind = table.find
  10196.  
  10197. funcs.Trigger = function(self,event,button)
  10198. if not self.Disabled and tableFind(self.AllowedButtons,button) then
  10199. self["On"..event]:Fire(button)
  10200. end
  10201. end
  10202.  
  10203. funcs.SetDisabled = function(self,dis)
  10204. self.Disabled = dis
  10205.  
  10206. if dis then
  10207. self.Anim:Disable()
  10208. self.Gui.TextTransparency = 0.5
  10209. else
  10210. self.Anim.Enable()
  10211. self.Gui.TextTransparency = 0
  10212. end
  10213. end
  10214.  
  10215. local mt = getGuiMT(props,funcs)
  10216.  
  10217. local function new()
  10218. local b = Instance.new("TextButton")
  10219. b.AutoButtonColor = false
  10220. b.TextColor3 = Settings.Theme.Text
  10221. b.TextTransparency = 0.1
  10222. b.Size = UDim2.new(0,100,0,20)
  10223. b.Font = Enum.Font.SourceSans
  10224. b.TextSize = 14
  10225. b.BackgroundColor3 = Settings.Theme.Button
  10226. b.BorderColor3 = Settings.Theme.Outline2
  10227.  
  10228. local obj = initObj(props,mt)
  10229. obj.Gui = b
  10230. obj.Anim = Lib.ButtonAnim(b,{Mode = 2, StartColor = Settings.Theme.Button, HoverColor = Settings.Theme.ButtonHover, PressColor = Settings.Theme.ButtonPress, OutlineColor = Settings.Theme.Outline2})
  10231.  
  10232. b.MouseButton1Click:Connect(function() obj:Trigger("Click",1) end)
  10233. b.MouseButton1Down:Connect(function() obj:Trigger("Down",1) end)
  10234. b.MouseButton1Up:Connect(function() obj:Trigger("Up",1) end)
  10235.  
  10236. b.MouseButton2Click:Connect(function() obj:Trigger("Click",2) end)
  10237. b.MouseButton2Down:Connect(function() obj:Trigger("Down",2) end)
  10238. b.MouseButton2Up:Connect(function() obj:Trigger("Up",2) end)
  10239.  
  10240. return obj
  10241. end
  10242.  
  10243. return {new = new}
  10244. end)()
  10245.  
  10246. Lib.DropDown = (function()
  10247. local props = {
  10248. Gui = PH,
  10249. Anim = PH,
  10250. Context = PH,
  10251. Selected = PH,
  10252. Disabled = false,
  10253. CanBeEmpty = true,
  10254. Options = {},
  10255. GuiElems = {},
  10256. OnSelect = SIGNAL
  10257. }
  10258. local funcs = {}
  10259.  
  10260. funcs.Update = function(self)
  10261. local options = self.Options
  10262.  
  10263. if #options > 0 then
  10264. if not self.Selected then
  10265. if not self.CanBeEmpty then
  10266. self.Selected = options[1]
  10267. self.GuiElems.Label.Text = options[1]
  10268. else
  10269. self.GuiElems.Label.Text = "- Select -"
  10270. end
  10271. else
  10272. self.GuiElems.Label.Text = self.Selected
  10273. end
  10274. else
  10275. self.GuiElems.Label.Text = "- Select -"
  10276. end
  10277. end
  10278.  
  10279. funcs.ShowOptions = function(self)
  10280. local context = self.Context
  10281.  
  10282. context.Width = self.Gui.AbsoluteSize.X
  10283. context.ReverseYOffset = self.Gui.AbsoluteSize.Y
  10284. context:Show(self.Gui.AbsolutePosition.X, self.Gui.AbsolutePosition.Y + context.ReverseYOffset)
  10285. end
  10286.  
  10287. funcs.SetOptions = function(self,opts)
  10288. self.Options = opts
  10289.  
  10290. local context = self.Context
  10291. local options = self.Options
  10292. context:Clear()
  10293.  
  10294. local onClick = function(option) self.Selected = option self.OnSelect:Fire(option) self:Update() end
  10295.  
  10296. if self.CanBeEmpty then
  10297. context:Add({Name = "- Select -", function() self.Selected = nil self.OnSelect:Fire(nil) self:Update() end})
  10298. end
  10299.  
  10300. for i = 1,#options do
  10301. context:Add({Name = options[i], OnClick = onClick})
  10302. end
  10303.  
  10304. self:Update()
  10305. end
  10306.  
  10307. funcs.SetSelected = function(self,opt)
  10308. self.Selected = type(opt) == "number" and self.Options[opt] or opt
  10309. self:Update()
  10310. end
  10311.  
  10312. local mt = getGuiMT(props,funcs)
  10313.  
  10314. local function new()
  10315. local f = Instance.new("TextButton")
  10316. f.AutoButtonColor = false
  10317. f.Text = ""
  10318. f.Size = UDim2.new(0,100,0,20)
  10319. f.BackgroundColor3 = Settings.Theme.TextBox
  10320. f.BorderColor3 = Settings.Theme.Outline3
  10321.  
  10322. local label = Lib.Label.new()
  10323. label.Position = UDim2.new(0,2,0,0)
  10324. label.Size = UDim2.new(1,-22,1,0)
  10325. label.TextTruncate = Enum.TextTruncate.AtEnd
  10326. label.Parent = f
  10327. local arrow = create({
  10328. {1,"Frame",{BackgroundTransparency=1,Name="EnumArrow",Position=UDim2.new(1,-16,0,2),Size=UDim2.new(0,16,0,16),}},
  10329. {2,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={1},Position=UDim2.new(0,8,0,9),Size=UDim2.new(0,1,0,1),}},
  10330. {3,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={1},Position=UDim2.new(0,7,0,8),Size=UDim2.new(0,3,0,1),}},
  10331. {4,"Frame",{BackgroundColor3=Color3.new(0.86274510622025,0.86274510622025,0.86274510622025),BorderSizePixel=0,Parent={1},Position=UDim2.new(0,6,0,7),Size=UDim2.new(0,5,0,1),}},
  10332. })
  10333. arrow.Parent = f
  10334.  
  10335. local obj = initObj(props,mt)
  10336. obj.Gui = f
  10337. obj.Anim = Lib.ButtonAnim(f,{Mode = 2, StartColor = Settings.Theme.TextBox, LerpTo = Settings.Theme.Button, LerpDelta = 0.15})
  10338. obj.Context = Lib.ContextMenu.new()
  10339. obj.Context.Iconless = true
  10340. obj.Context.MaxHeight = 200
  10341. obj.Selected = nil
  10342. obj.GuiElems = {Label = label}
  10343. f.MouseButton1Down:Connect(function() obj:ShowOptions() end)
  10344. obj:Update()
  10345. return obj
  10346. end
  10347.  
  10348. return {new = new}
  10349. end)()
  10350.  
  10351. Lib.ClickSystem = (function()
  10352. local props = {
  10353. LastItem = PH,
  10354. OnDown = SIGNAL,
  10355. OnRelease = SIGNAL,
  10356. AllowedButtons = {1},
  10357. Combo = 0,
  10358. MaxCombo = 2,
  10359. ComboTime = 0.5,
  10360. Items = {},
  10361. ItemCons = {},
  10362. ClickId = -1,
  10363. LastButton = ""
  10364. }
  10365. local funcs = {}
  10366. local tostring = tostring
  10367.  
  10368. local disconnect = function(con)
  10369. local pos = table.find(con.Signal.Connections,con)
  10370. if pos then table.remove(con.Signal.Connections,pos) end
  10371. end
  10372.  
  10373. funcs.Trigger = function(self, item, button, X, Y)
  10374. if table.find(self.AllowedButtons, button) then
  10375. if self.LastButton ~= button or self.LastItem ~= item or self.Combo == self.MaxCombo or tick() - self.ClickId > self.ComboTime then
  10376. self.Combo = 0
  10377. self.LastButton = button
  10378. self.LastItem = item
  10379. end
  10380.  
  10381. self.Combo = self.Combo + 1
  10382. self.ClickId = tick()
  10383.  
  10384. task.spawn(function()
  10385. if self.InputDown then
  10386. self.InputDown = false
  10387. else
  10388. self.InputDown = tick()
  10389.  
  10390. local Connection = item.MouseButton1Up:Once(function()
  10391. self.InputDown = false
  10392. end)
  10393.  
  10394. while self.InputDown and not Explorer.Dragging do
  10395. if (tick() - self.InputDown) >= 0.4 then
  10396. self.InputDown = false
  10397. self["OnRelease"]:Fire(item, self.Combo, 2, Vector2.new(X, Y))
  10398. break
  10399. end;task.wait()
  10400. end
  10401. end
  10402. end)
  10403.  
  10404. local release
  10405. release = service.UserInputService.InputEnded:Connect(function(input)
  10406. if input.UserInputType == Enum.UserInputType["MouseButton" .. button] then
  10407. release:Disconnect()
  10408. if Lib.CheckMouseInGui(item) and self.LastButton == button and self.LastItem == item then
  10409. self["OnRelease"]:Fire(item,self.Combo,button)
  10410. end
  10411. end
  10412. end)
  10413.  
  10414. self["OnDown"]:Fire(item,self.Combo,button)
  10415. end
  10416. end
  10417.  
  10418. funcs.Add = function(self,item)
  10419. if table.find(self.Items,item) then return end
  10420.  
  10421. local cons = {}
  10422. cons[1] = item.MouseButton1Down:Connect(function(X, Y) self:Trigger(item, 1, X, Y) end)
  10423. cons[2] = item.MouseButton2Down:Connect(function(X, Y) self:Trigger(item, 2, X, Y) end)
  10424.  
  10425. self.ItemCons[item] = cons
  10426. self.Items[#self.Items+1] = item
  10427. end
  10428.  
  10429. funcs.Remove = function(self,item)
  10430. local ind = table.find(self.Items,item)
  10431. if not ind then return end
  10432.  
  10433. for i,v in pairs(self.ItemCons[item]) do
  10434. v:Disconnect()
  10435. end
  10436. self.ItemCons[item] = nil
  10437. table.remove(self.Items,ind)
  10438. end
  10439.  
  10440. local mt = {__index = funcs}
  10441.  
  10442. local function new()
  10443. local obj = initObj(props,mt)
  10444.  
  10445. return obj
  10446. end
  10447.  
  10448. return {new = new}
  10449. end)()
  10450.  
  10451. return Lib
  10452. end
  10453.  
  10454. return {InitDeps = initDeps, InitAfterMain = initAfterMain, Main = main}
  10455. end,
  10456. Console = function()
  10457. --[[
  10458. Console Module
  10459. ]]
  10460. -- Common Locals
  10461. local Main,Lib,Apps,Settings -- Main Containers
  10462. local Explorer, Properties, ScriptViewer, Notebook -- Major Apps
  10463. local API,RMD,env,service,plr,create,createSimple -- Main Locals
  10464.  
  10465. local function initDeps(data)
  10466. Main = data.Main
  10467. Lib = data.Lib
  10468. Apps = data.Apps
  10469. Settings = data.Settings
  10470.  
  10471. API = data.API
  10472. RMD = data.RMD
  10473. env = data.env
  10474. service = data.service
  10475. plr = data.plr
  10476. create = data.create
  10477. createSimple = data.createSimple
  10478. end
  10479.  
  10480. local function initAfterMain()
  10481. Explorer = Apps.Explorer
  10482. Properties = Apps.Properties
  10483. ScriptViewer = Apps.ScriptViewer
  10484. Notebook = Apps.Notebook
  10485. end
  10486.  
  10487. local function main()
  10488. local Console = {}
  10489.  
  10490. local window,ConsoleFrame
  10491.  
  10492. local OutputLimit = 500 -- Same as Roblox Console.
  10493.  
  10494.  
  10495. -- Instances: 29 | Scripts: 1 | Modules: 1 | Tags: 0
  10496. local G2L = {};
  10497.  
  10498. -- StarterGui.ScreenGui
  10499. window = Lib.Window.new()
  10500. window:SetTitle("Console")
  10501. window:Resize(500,400)
  10502. Console.Window = window
  10503.  
  10504. -- StarterGui.ScreenGui.Console
  10505. ConsoleFrame = Instance.new("ImageButton", window.GuiElems.Content);
  10506. ConsoleFrame["BorderSizePixel"] = 0;
  10507. ConsoleFrame["AutoButtonColor"] = false;
  10508. ConsoleFrame["BackgroundTransparency"] = 1;
  10509. ConsoleFrame["BackgroundColor3"] = Color3.fromRGB(47, 47, 47);
  10510. ConsoleFrame["Selectable"] = false;
  10511. ConsoleFrame["Size"] = UDim2.new(1,0,1,0);
  10512. ConsoleFrame["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10513. ConsoleFrame["Name"] = [[Console]];
  10514. ConsoleFrame["Position"] = UDim2.new(0,0,0,0);
  10515.  
  10516.  
  10517. -- StarterGui.ScreenGui.Console.CommandLine
  10518. G2L["3"] = Lib.Frame.new().Gui--Instance.new("Frame", ConsoleFrame);
  10519. G2L["3"].Parent = ConsoleFrame
  10520. G2L["3"]["BorderSizePixel"] = 0;
  10521. G2L["3"]["BackgroundColor3"] = Color3.fromRGB(37, 37, 37);
  10522. G2L["3"]["AnchorPoint"] = Vector2.new(0.5, 1);
  10523. G2L["3"]["ClipsDescendants"] = true;
  10524. G2L["3"]["Size"] = UDim2.new(1, -8, 0, 22);
  10525. G2L["3"]["Position"] = UDim2.new(0.5, 0, 1, -5);
  10526. G2L["3"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10527. G2L["3"]["Name"] = [[CommandLine]];
  10528.  
  10529.  
  10530. -- StarterGui.ScreenGui.Console.CommandLine.UIStroke
  10531. G2L["4"] = Instance.new("UIStroke", G2L["3"]);
  10532. G2L["4"]["Transparency"] = 0.65;
  10533. G2L["4"]["Thickness"] = 1.25;
  10534.  
  10535.  
  10536. -- StarterGui.ScreenGui.Console.CommandLine.ScrollingFrame
  10537. G2L["5"] = Instance.new("ScrollingFrame", G2L["3"]);
  10538. G2L["5"]["Active"] = true;
  10539. G2L["5"]["ScrollingDirection"] = Enum.ScrollingDirection.X;
  10540. G2L["5"]["BorderSizePixel"] = 0;
  10541. G2L["5"]["CanvasSize"] = UDim2.new(0, 0, 0, 0);
  10542. G2L["5"]["ElasticBehavior"] = Enum.ElasticBehavior.Never;
  10543. G2L["5"]["TopImage"] = [[rbxasset://textures/ui/Scroll/scroll-middle.png]];
  10544. G2L["5"]["BackgroundColor3"] = Color3.fromRGB(255, 255, 255);
  10545. G2L["5"]["HorizontalScrollBarInset"] = Enum.ScrollBarInset.Always;
  10546. G2L["5"]["BottomImage"] = [[rbxasset://textures/ui/Scroll/scroll-middle.png]];
  10547. G2L["5"]["AutomaticCanvasSize"] = Enum.AutomaticSize.X;
  10548. G2L["5"]["Size"] = UDim2.new(1, 0, 1, 0);
  10549. G2L["5"]["ScrollBarImageColor3"] = Color3.fromRGB(57, 57, 57);
  10550. G2L["5"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10551. G2L["5"]["ScrollBarThickness"] = 2;
  10552. G2L["5"]["BackgroundTransparency"] = 1;
  10553.  
  10554. -- StarterGui.ScreenGui.Console.CommandLine.ScrollingFrame.TextBox
  10555. G2L["6"] = Instance.new("TextBox", G2L["5"]);
  10556. G2L["6"]["CursorPosition"] = -1;
  10557. G2L["6"]["TextXAlignment"] = Enum.TextXAlignment.Left;
  10558. G2L["6"]["PlaceholderColor3"] = Color3.fromRGB(211, 211, 211);
  10559. G2L["6"]["BorderSizePixel"] = 0;
  10560. G2L["6"]["TextSize"] = 13;
  10561. G2L["6"]["TextColor3"] = Color3.fromRGB(211, 211, 211);
  10562. G2L["6"]["BackgroundColor3"] = Color3.fromRGB(255, 255, 255);
  10563. G2L["6"]["FontFace"] = Font.new([[rbxasset://fonts/families/Inconsolata.json]], Enum.FontWeight.Regular, Enum.FontStyle.Normal);
  10564. G2L["6"]["AutomaticSize"] = Enum.AutomaticSize.X;
  10565. G2L["6"]["ClearTextOnFocus"] = false;
  10566. G2L["6"]["PlaceholderText"] = [[Run a command]];
  10567. G2L["6"]["Size"] = UDim2.new(0, 246, 0, 22);
  10568. G2L["6"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10569. G2L["6"]["Text"] = [[]];
  10570. G2L["6"]["BackgroundTransparency"] = 1;
  10571.  
  10572.  
  10573. -- StarterGui.ScreenGui.Console.CommandLine.ScrollingFrame.TextBox.UIPadding
  10574. G2L["7"] = Instance.new("UIPadding", G2L["6"]);
  10575. G2L["7"]["PaddingLeft"] = UDim.new(0, 7);
  10576.  
  10577.  
  10578. -- StarterGui.ScreenGui.Console.CommandLine.ScrollingFrame.Highlight
  10579. G2L["8"] = Instance.new("TextLabel", G2L["5"]);
  10580. G2L["8"]["Interactable"] = false;
  10581. G2L["8"]["ZIndex"] = 2;
  10582. G2L["8"]["BorderSizePixel"] = 0;
  10583. G2L["8"]["TextSize"] = 13;
  10584. G2L["8"]["TextXAlignment"] = Enum.TextXAlignment.Left;
  10585. G2L["8"]["BackgroundColor3"] = Color3.fromRGB(255, 255, 255);
  10586. G2L["8"]["FontFace"] = Font.new([[rbxasset://fonts/families/Inconsolata.json]], Enum.FontWeight.Regular, Enum.FontStyle.Normal);
  10587. G2L["8"]["TextColor3"] = Color3.fromRGB(255, 255, 255);
  10588. G2L["8"]["BackgroundTransparency"] = 1;
  10589. G2L["8"]["RichText"] = true;
  10590. G2L["8"]["Size"] = UDim2.new(0, 246, 0, 22);
  10591. G2L["8"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10592. G2L["8"]["Text"] = [[]];
  10593. G2L["8"]["Selectable"] = true;
  10594. G2L["8"]["AutomaticSize"] = Enum.AutomaticSize.X;
  10595. G2L["8"]["Name"] = [[Highlight]];
  10596.  
  10597.  
  10598. -- StarterGui.ScreenGui.Console.CommandLine.ScrollingFrame.Highlight.UIPadding
  10599. G2L["9"] = Instance.new("UIPadding", G2L["8"]);
  10600. G2L["9"]["PaddingLeft"] = UDim.new(0, 7);
  10601.  
  10602. G2L["backgroundOutput"] = Instance.new("Frame", ConsoleFrame);
  10603. G2L["backgroundOutput"]["BorderSizePixel"] = 0;
  10604. G2L["backgroundOutput"]["BackgroundColor3"] = Color3.fromRGB(36, 36, 36);
  10605. G2L["backgroundOutput"]["Name"] = [[BackgroundOutput]];
  10606. G2L["backgroundOutput"]["AnchorPoint"] = Vector2.new(0, 0);
  10607. G2L["backgroundOutput"]["Size"] = UDim2.new(1, -8, 1, -55);
  10608. G2L["backgroundOutput"]["Position"] = UDim2.new(0, 4, 0, 23);
  10609. G2L["backgroundOutput"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10610. G2L["backgroundOutput"]["ZIndex"] = 1;
  10611.  
  10612. local scrollbar = Lib.ScrollBar.new()
  10613. scrollbar.Gui.Parent = ConsoleFrame
  10614. scrollbar.Gui.Size = UDim2.new(0, 16, 1, -55);
  10615. scrollbar.Gui.Position = UDim2.new(1, -20,0, 23);
  10616. scrollbar.Gui.Up.ZIndex = 3
  10617. scrollbar.Gui.Down.ZIndex = 3
  10618.  
  10619. -- StarterGui.ScreenGui.Console.Output
  10620. G2L["a"] = Instance.new("ScrollingFrame", ConsoleFrame);
  10621. G2L["a"]["Active"] = true;
  10622. G2L["a"]["BorderSizePixel"] = 0;
  10623. G2L["a"]["CanvasSize"] = UDim2.new(0, 0, 0, 0);
  10624. G2L["a"]["TopImage"] = '';
  10625. G2L["a"]["BackgroundColor3"] = Color3.fromRGB(36, 36, 36);
  10626. G2L["a"].BackgroundTransparency = 1
  10627. G2L["a"]["Name"] = [[Output]];
  10628. G2L["a"]["ScrollBarImageTransparency"] = 0;
  10629. G2L["a"]["BottomImage"] = '';
  10630. G2L["a"]["AnchorPoint"] = Vector2.new(0, 0);
  10631. G2L["a"]["AutomaticCanvasSize"] = Enum.AutomaticSize.Y;
  10632. G2L["a"]["Size"] = UDim2.new(1, -8, 1, -55);
  10633. G2L["a"]["Position"] = UDim2.new(0, 4, 0, 23);
  10634. G2L["a"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10635. G2L["a"].ScrollBarImageColor3 = Color3.fromRGB(70, 70, 70)
  10636. G2L["a"]["ScrollBarThickness"] = 16;
  10637. G2L["a"]["ZIndex"] = 1;
  10638.  
  10639. G2L["a"]:GetPropertyChangedSignal("AbsoluteWindowSize"):Connect(function()
  10640. if G2L["a"].AbsoluteCanvasSize ~= G2L["a"].AbsoluteWindowSize then
  10641. scrollbar.Gui.Visible = true
  10642. else
  10643. scrollbar.Gui.Visible = false
  10644. end
  10645. end)
  10646.  
  10647. -- StarterGui.ScreenGui.Console.Output.UIListLayout
  10648. G2L["b"] = Instance.new("UIListLayout", G2L["a"]);
  10649. G2L["b"]["SortOrder"] = Enum.SortOrder.LayoutOrder;
  10650.  
  10651.  
  10652. -- StarterGui.ScreenGui.Console.Output.UIStroke
  10653. G2L["c"] = Instance.new("UIStroke", G2L["a"]);
  10654. G2L["c"]["Transparency"] = 0.7;
  10655. G2L["c"]["Thickness"] = 1.25;
  10656. G2L["c"]["Color"] = Color3.fromRGB(12, 12, 12);
  10657.  
  10658.  
  10659. -- StarterGui.ScreenGui.Console.Output.OutputTextSize
  10660. G2L["d"] = Instance.new("NumberValue", G2L["a"]);
  10661. G2L["d"]["Name"] = [[OutputTextSize]];
  10662. G2L["d"]["Value"] = 15;
  10663.  
  10664.  
  10665. -- StarterGui.ScreenGui.Console.Output.OutputLimit
  10666. G2L["e"] = Instance.new("NumberValue", G2L["a"]);
  10667. G2L["e"]["Name"] = [[OutputLimit]];
  10668. G2L["e"]["Value"] = OutputLimit;
  10669.  
  10670.  
  10671. -- StarterGui.ScreenGui.Console.Output.UIPadding
  10672. G2L["f"] = Instance.new("UIPadding", G2L["a"]);
  10673. G2L["f"]["PaddingTop"] = UDim.new(0, 2);
  10674.  
  10675.  
  10676. -- StarterGui.ScreenGui.Console.TextSizeBox
  10677. G2L["10"] = Instance.new("Frame", ConsoleFrame);
  10678. G2L["10"]["BorderSizePixel"] = 0;
  10679. G2L["10"]["BackgroundColor3"] = Color3.fromRGB(37, 37, 37);
  10680. G2L["10"]["ClipsDescendants"] = true;
  10681. G2L["10"]["Size"] = UDim2.new(0, 37, 0, 15);
  10682. G2L["10"]["Position"] = UDim2.new(0, 4, 0, 4);
  10683. G2L["10"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10684. G2L["10"]["Name"] = [[TextSizeBox]];
  10685.  
  10686.  
  10687. -- StarterGui.ScreenGui.Console.TextSizeBox.TextBox
  10688. G2L["11"] = Instance.new("TextBox", G2L["10"]);
  10689. G2L["11"]["PlaceholderColor3"] = Color3.fromRGB(108, 108, 108);
  10690. G2L["11"]["BorderSizePixel"] = 0;
  10691. G2L["11"]["TextWrapped"] = true;
  10692. G2L["11"]["TextSize"] = 15;
  10693. G2L["11"]["TextColor3"] = Color3.fromRGB(211, 211, 211);
  10694. G2L["11"]["TextScaled"] = true;
  10695. G2L["11"]["BackgroundColor3"] = Color3.fromRGB(255, 255, 255);
  10696. G2L["11"]["FontFace"] = Font.new([[rbxasset://fonts/families/Inconsolata.json]], Enum.FontWeight.Regular, Enum.FontStyle.Normal);
  10697. G2L["11"]["PlaceholderText"] = [[Size]];
  10698. G2L["11"]["Size"] = UDim2.new(1, 0, 1, 0);
  10699. G2L["11"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10700. G2L["11"]["Text"] = [[]];
  10701. G2L["11"]["BackgroundTransparency"] = 1;
  10702.  
  10703.  
  10704. -- StarterGui.ScreenGui.Console.TextSizeBox.TextBox.UIPadding
  10705. G2L["12"] = Instance.new("UIPadding", G2L["11"]);
  10706. G2L["12"]["PaddingTop"] = UDim.new(0, 2);
  10707. G2L["12"]["PaddingRight"] = UDim.new(0, 5);
  10708. G2L["12"]["PaddingLeft"] = UDim.new(0, 5);
  10709. G2L["12"]["PaddingBottom"] = UDim.new(0, 2);
  10710.  
  10711.  
  10712. -- StarterGui.ScreenGui.Console.TextSizeBox.UIStroke
  10713. G2L["13"] = Instance.new("UIStroke", G2L["10"]);
  10714. G2L["13"]["Transparency"] = 0.65;
  10715. G2L["13"]["Thickness"] = 1.25;
  10716.  
  10717.  
  10718. -- StarterGui.ScreenGui.Console.Clear
  10719. G2L["14"] = Instance.new("ImageButton", ConsoleFrame);
  10720. G2L["14"]["BorderSizePixel"] = 0;
  10721. G2L["14"]["BackgroundColor3"] = Color3.fromRGB(57, 57, 57);
  10722. G2L["14"]["Size"] = UDim2.new(0, 37, 0, 15);
  10723. G2L["14"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10724. G2L["14"]["Name"] = [[Clear]];
  10725. G2L["14"]["Position"] = UDim2.new(1, -42, 0, 4);
  10726.  
  10727.  
  10728. -- StarterGui.ScreenGui.Console.Clear.TextLabel
  10729. G2L["15"] = Instance.new("TextLabel", G2L["14"]);
  10730. G2L["15"]["TextWrapped"] = true;
  10731. G2L["15"]["Interactable"] = false;
  10732. G2L["15"]["BorderSizePixel"] = 0;
  10733. G2L["15"]["TextSize"] = 20;
  10734. G2L["15"]["TextScaled"] = true;
  10735. G2L["15"]["BackgroundColor3"] = Color3.fromRGB(255, 255, 255);
  10736. G2L["15"]["FontFace"] = Font.new([[rbxasset://fonts/families/SourceSansPro.json]], Enum.FontWeight.Regular, Enum.FontStyle.Normal);
  10737. G2L["15"]["TextColor3"] = Color3.fromRGB(255, 255, 255);
  10738. G2L["15"]["BackgroundTransparency"] = 1;
  10739. G2L["15"]["Size"] = UDim2.new(1, 0, 1, 0);
  10740. G2L["15"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10741. G2L["15"]["Text"] = [[Clear]];
  10742.  
  10743.  
  10744. -- StarterGui.ScreenGui.Console.Clear.UIPadding
  10745. G2L["16"] = Instance.new("UIPadding", G2L["14"]);
  10746. G2L["16"]["PaddingTop"] = UDim.new(0, 1);
  10747. G2L["16"]["PaddingBottom"] = UDim.new(0, 1);
  10748.  
  10749.  
  10750. -- StarterGui.ScreenGui.Console.OutputTemplate
  10751. G2L["17"] = Instance.new("TextBox", ConsoleFrame);
  10752. G2L["17"]["Visible"] = false;
  10753. G2L["17"]["Active"] = false;
  10754. G2L["17"]["Name"] = [[OutputTemplate]];
  10755. G2L["17"]["TextXAlignment"] = Enum.TextXAlignment.Left;
  10756. G2L["17"]["BorderSizePixel"] = 0;
  10757. G2L["17"]["TextEditable"] = false;
  10758. G2L["17"]["TextWrapped"] = true;
  10759. G2L["17"]["TextSize"] = 15;
  10760. G2L["17"]["TextColor3"] = Color3.fromRGB(171, 171, 171);
  10761. G2L["17"]["BackgroundColor3"] = Color3.fromRGB(255, 255, 255);
  10762. G2L["17"]["RichText"] = true;
  10763. G2L["17"]["FontFace"] = Font.new([[rbxasset://fonts/families/SourceSansPro.json]], Enum.FontWeight.Regular, Enum.FontStyle.Normal);
  10764. G2L["17"]["AutomaticSize"] = Enum.AutomaticSize.Y;
  10765. G2L["17"]["Selectable"] = false;
  10766. G2L["17"]["ClearTextOnFocus"] = false;
  10767. G2L["17"]["Size"] = UDim2.new(1, 0, 0, 1);
  10768. G2L["17"]["Position"] = UDim2.new(0, 20, 0, 0);
  10769. G2L["17"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10770. G2L["17"]["Text"] = [[(timestamp) <font color="rgb(255, 255, 255)">Output</font>]];
  10771. G2L["17"]["BackgroundTransparency"] = 1;
  10772.  
  10773.  
  10774. -- StarterGui.ScreenGui.Console.OutputTemplate.UIPadding
  10775. G2L["18"] = Instance.new("UIPadding", G2L["17"]);
  10776. G2L["18"]["PaddingRight"] = UDim.new(0, 6);
  10777. G2L["18"]["PaddingLeft"] = UDim.new(0, 6);
  10778.  
  10779.  
  10780. -- StarterGui.ScreenGui.Console.CtrlScroll
  10781. G2L["19"] = Instance.new("ImageButton", ConsoleFrame);
  10782. G2L["19"]["BorderSizePixel"] = 0;
  10783. G2L["19"]["BackgroundColor3"] = Color3.fromRGB(57, 57, 57);
  10784. G2L["19"]["Size"] = UDim2.new(0, 60, 0, 15);
  10785. G2L["19"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10786. G2L["19"]["Name"] = [[CtrlScroll]];
  10787. G2L["19"]["Position"] = UDim2.new(0, 46, 0, 4);
  10788.  
  10789.  
  10790. -- StarterGui.ScreenGui.Console.CtrlScroll.TextLabel
  10791. G2L["1a"] = Instance.new("TextLabel", G2L["19"]);
  10792. G2L["1a"]["TextWrapped"] = true;
  10793. G2L["1a"]["Interactable"] = false;
  10794. G2L["1a"]["BorderSizePixel"] = 0;
  10795. G2L["1a"]["TextSize"] = 20;
  10796. G2L["1a"]["TextScaled"] = true;
  10797. G2L["1a"]["BackgroundColor3"] = Color3.fromRGB(255, 255, 255);
  10798. G2L["1a"]["FontFace"] = Font.new([[rbxasset://fonts/families/SourceSansPro.json]], Enum.FontWeight.Regular, Enum.FontStyle.Normal);
  10799. G2L["1a"]["TextColor3"] = Color3.fromRGB(255, 255, 255);
  10800. G2L["1a"]["BackgroundTransparency"] = 1;
  10801. G2L["1a"]["Size"] = UDim2.new(1, 0, 1, 0);
  10802. G2L["1a"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10803. G2L["1a"]["Text"] = [[Ctrl Scroll]];
  10804.  
  10805.  
  10806. -- StarterGui.ScreenGui.Console.CtrlScroll.UIPadding
  10807. G2L["1b"] = Instance.new("UIPadding", G2L["19"]);
  10808. G2L["1b"]["PaddingTop"] = UDim.new(0, 1);
  10809. G2L["1b"]["PaddingBottom"] = UDim.new(0, 1);
  10810.  
  10811. -- StarterGui.ScreenGui.Console.AutoScroll
  10812. G2L["20"] = Instance.new("ImageButton", ConsoleFrame);
  10813. G2L["20"]["BorderSizePixel"] = 0;
  10814. G2L["20"]["BackgroundColor3"] = Color3.fromRGB(57, 57, 57);
  10815. G2L["20"]["Size"] = UDim2.new(0, 60, 0, 15);
  10816. G2L["20"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10817. G2L["20"]["Name"] = [[AutoScroll]];
  10818. G2L["20"]["Position"] = UDim2.new(0, 110, 0, 4);
  10819.  
  10820.  
  10821. -- StarterGui.ScreenGui.Console.AutoScroll.TextLabel
  10822. G2L["1e"] = Instance.new("TextLabel", G2L["20"]);
  10823. G2L["1e"]["TextWrapped"] = true;
  10824. G2L["1e"]["Interactable"] = false;
  10825. G2L["1e"]["BorderSizePixel"] = 0;
  10826. G2L["1e"]["TextSize"] = 20;
  10827. G2L["1e"]["TextScaled"] = true;
  10828. G2L["1e"]["BackgroundColor3"] = Color3.fromRGB(255, 255, 255);
  10829. G2L["1e"]["FontFace"] = Font.new([[rbxasset://fonts/families/SourceSansPro.json]], Enum.FontWeight.Regular, Enum.FontStyle.Normal);
  10830. G2L["1e"]["TextColor3"] = Color3.fromRGB(255, 255, 255);
  10831. G2L["1e"]["BackgroundTransparency"] = 1;
  10832. G2L["1e"]["Size"] = UDim2.new(1, 0, 1, 0);
  10833. G2L["1e"]["BorderColor3"] = Color3.fromRGB(0, 0, 0);
  10834. G2L["1e"]["Text"] = [[Auto Scroll]];
  10835.  
  10836.  
  10837. -- StarterGui.ScreenGui.Console.AutoScroll.UIPadding
  10838. G2L["1f"] = Instance.new("UIPadding", G2L["20"]);
  10839. G2L["1f"]["PaddingTop"] = UDim.new(0, 1);
  10840. G2L["1f"]["PaddingBottom"] = UDim.new(0, 1);
  10841.  
  10842.  
  10843. -- StarterGui.ScreenGui.ConsoleHandler
  10844. G2L["1c"] = Instance.new("LocalScript", G2L["1"]);
  10845. G2L["1c"]["Name"] = [[ConsoleHandler]];
  10846.  
  10847.  
  10848. -- StarterGui.ScreenGui.ConsoleHandler.SyntaxHighlighter
  10849. G2L["1d"] = Instance.new("ModuleScript", G2L["1c"]);
  10850. G2L["1d"]["Name"] = [[SyntaxHighlighter]];
  10851.  
  10852.  
  10853. -- Require G2L wrapper
  10854. local G2L_REQUIRE = require;
  10855. local G2L_MODULES = {};
  10856. local function require(Module)
  10857. local ModuleState = G2L_MODULES[Module];
  10858. if ModuleState then
  10859. if not ModuleState.Required then
  10860. ModuleState.Required = true;
  10861. ModuleState.Value = ModuleState.Closure();
  10862. end
  10863. return ModuleState.Value;
  10864. end;
  10865. return G2L_REQUIRE(Module);
  10866. end
  10867.  
  10868. G2L_MODULES[G2L["1d"]] = {
  10869. Closure = function()
  10870. local script = G2L["1d"];local highlighter = {}
  10871. local keywords = {
  10872. lua = {
  10873. "and", "break", "or", "else", "elseif", "if", "then", "until", "repeat", "while", "do", "for", "in", "end",
  10874. "local", "return", "function", "export"
  10875. },
  10876. rbx = {
  10877. "game", "workspace", "script", "math", "string", "table", "task", "wait", "select", "next", "Enum",
  10878. "error", "warn", "tick", "assert", "shared", "loadstring", "tonumber", "tostring", "type",
  10879. "typeof", "unpack", "print", "Instance", "CFrame", "Vector3", "Vector2", "Color3", "UDim", "UDim2", "Ray", "BrickColor",
  10880. "OverlapParams", "RaycastParams", "Axes", "Random", "Region3", "Rect", "TweenInfo",
  10881. "collectgarbage", "not", "utf8", "pcall", "xpcall", "_G", "setmetatable", "getmetatable", "os", "pairs", "ipairs"
  10882. },
  10883. exploit = {
  10884. "hookmetamethod", "hookfunction", "getgc", "filtergc", "Drawing", "getgenv", "getsenv", "getrenv", "getfenv", "setfenv",
  10885. "decompile", "saveinstance", "getrawmetatable", "setrawmetatable", "checkcaller", "cloneref", "clonefunction",
  10886. "iscclosure", "islclosure", "isexecutorclosure", "newcclosure", "getfunctionhash", "crypt", "writefile", "appendfile", "loadfile", "readfile", "listfiles",
  10887. "makefolder", "isfolder", "isfile", "delfile", "delfolder", "getcustomasset", "fireclickdetector", "firetouchinterest", "fireproximityprompt"
  10888. },
  10889. operators = {
  10890. "#", "+", "-", "*", "%", "/", "^", "=", "~", "=", "<", ">", ",", ".", "(", ")", "{", "}", "[", "]", ";", ":"
  10891. }
  10892. }
  10893.  
  10894. local colors = {
  10895. numbers = Color3.fromRGB(255, 198, 0),
  10896. boolean = Color3.fromRGB(255, 198, 0),
  10897. operator = Color3.fromRGB(204, 204, 204),
  10898. lua = Color3.fromRGB(132, 214, 247),
  10899. exploit = Color3.fromRGB(171, 84, 247),
  10900. rbx = Color3.fromRGB(248, 109, 124),
  10901. str = Color3.fromRGB(173, 241, 132),
  10902. comment = Color3.fromRGB(102, 102, 102),
  10903. null = Color3.fromRGB(255, 198, 0),
  10904. call = Color3.fromRGB(253, 251, 172),
  10905. self_call = Color3.fromRGB(253, 251, 172),
  10906. local_color = Color3.fromRGB(248, 109, 115),
  10907. function_color = Color3.fromRGB(248, 109, 115),
  10908. self_color = Color3.fromRGB(248, 109, 115),
  10909. local_property = Color3.fromRGB(97, 161, 241),
  10910. }
  10911.  
  10912. local function createKeywordSet(keywords)
  10913. local keywordSet = {}
  10914. for _, keyword in ipairs(keywords) do
  10915. keywordSet[keyword] = true
  10916. end
  10917. return keywordSet
  10918. end
  10919.  
  10920. local luaSet = createKeywordSet(keywords.lua)
  10921. local exploitSet = createKeywordSet(keywords.exploit)
  10922. local rbxSet = createKeywordSet(keywords.rbx)
  10923. local operatorsSet = createKeywordSet(keywords.operators)
  10924.  
  10925. local function getHighlight(tokens, index)
  10926. local token = tokens[index]
  10927.  
  10928. if colors[token .. "_color"] then
  10929. return colors[token .. "_color"]
  10930. end
  10931.  
  10932. if tonumber(token) then
  10933. return colors.numbers
  10934. elseif token == "nil" then
  10935. return colors.null
  10936. elseif token:sub(1, 2) == "--" then
  10937. return colors.comment
  10938. elseif operatorsSet[token] then
  10939. return colors.operator
  10940. elseif luaSet[token] then
  10941. return colors.rbx
  10942. elseif rbxSet[token] then
  10943. return colors.lua
  10944. elseif exploitSet[token] then
  10945. return colors.exploit
  10946. elseif token:sub(1, 1) == "\"" or token:sub(1, 1) == "\'" then
  10947. return colors.str
  10948. elseif token == "true" or token == "false" then
  10949. return colors.boolean
  10950. end
  10951.  
  10952. if tokens[index + 1] == "(" then
  10953. if tokens[index - 1] == ":" then
  10954. return colors.self_call
  10955. end
  10956.  
  10957. return colors.call
  10958. end
  10959.  
  10960. if tokens[index - 1] == "." then
  10961. if tokens[index - 2] == "Enum" then
  10962. return colors.rbx
  10963. end
  10964.  
  10965. return colors.local_property
  10966. end
  10967. end
  10968.  
  10969. function highlighter.run(source)
  10970. local tokens = {}
  10971. local currentToken = ""
  10972.  
  10973. local inString = false
  10974. local inComment = false
  10975. local commentPersist = false
  10976.  
  10977. for i = 1, #source do
  10978. local character = source:sub(i, i)
  10979.  
  10980. if inComment then
  10981. if character == "\n" and not commentPersist then
  10982. table.insert(tokens, currentToken)
  10983. table.insert(tokens, character)
  10984. currentToken = ""
  10985.  
  10986. inComment = false
  10987. elseif source:sub(i - 1, i) == "]]" and commentPersist then
  10988. currentToken ..= "]"
  10989.  
  10990. table.insert(tokens, currentToken)
  10991. currentToken = ""
  10992.  
  10993. inComment = false
  10994. commentPersist = false
  10995. else
  10996. currentToken = currentToken .. character
  10997. end
  10998. elseif inString then
  10999. if character == inString and source:sub(i-1, i-1) ~= "\\" or character == "\n" then
  11000. currentToken = currentToken .. character
  11001. inString = false
  11002. else
  11003. currentToken = currentToken .. character
  11004. end
  11005. else
  11006. if source:sub(i, i + 1) == "--" then
  11007. table.insert(tokens, currentToken)
  11008. currentToken = "-"
  11009. inComment = true
  11010. commentPersist = source:sub(i + 2, i + 3) == "[["
  11011. elseif character == "\"" or character == "\'" then
  11012. table.insert(tokens, currentToken)
  11013. currentToken = character
  11014. inString = character
  11015. elseif operatorsSet[character] then
  11016. table.insert(tokens, currentToken)
  11017. table.insert(tokens, character)
  11018. currentToken = ""
  11019. elseif character:match("[%w_]") then
  11020. currentToken = currentToken .. character
  11021. else
  11022. table.insert(tokens, currentToken)
  11023. table.insert(tokens, character)
  11024. currentToken = ""
  11025. end
  11026. end
  11027. end
  11028.  
  11029. table.insert(tokens, currentToken)
  11030.  
  11031. local highlighted = {}
  11032.  
  11033. for i, token in ipairs(tokens) do
  11034. local highlight = getHighlight(tokens, i)
  11035.  
  11036. if highlight then
  11037. local syntax = string.format("<font color = \"#%s\">%s</font>", highlight:ToHex(), token:gsub("<", "&lt;"):gsub(">", "&gt;"))
  11038.  
  11039. table.insert(highlighted, syntax)
  11040. else
  11041. table.insert(highlighted, token)
  11042. end
  11043. end
  11044.  
  11045. return table.concat(highlighted)
  11046. end
  11047.  
  11048. return highlighter
  11049. end;
  11050. };
  11051.  
  11052. Console.Init = function()
  11053. -- StarterGui.ScreenGui.ConsoleHandler
  11054.  
  11055. local CtrlScroll = false
  11056. local AutoScroll = false
  11057.  
  11058. local LogService = game:GetService("LogService")
  11059. local Players = game:GetService("Players")
  11060. local LocalPlayer = Players.LocalPlayer
  11061. local Mouse = LocalPlayer:GetMouse()
  11062. local UserInputService = game:GetService("UserInputService")
  11063. local RunService = game:GetService("RunService")
  11064.  
  11065. local Console = ConsoleFrame
  11066. local SyntaxHighlightingModule = require(G2L["1c"].SyntaxHighlighter)
  11067. local OutputTextSize = Console.Output.OutputTextSize
  11068.  
  11069. local function Tween(obj, info, prop)
  11070. local tween = game:GetService("TweenService"):Create(obj, info, prop)
  11071. tween:Play()
  11072. return tween
  11073. end
  11074.  
  11075.  
  11076.  
  11077. -- MOUSE STUFFS
  11078.  
  11079. if CtrlScroll == true then
  11080. Console.CtrlScroll.BackgroundColor3 = Color3.fromRGB(11, 90, 175)
  11081. elseif CtrlScroll == false then
  11082. Console.CtrlScroll.BackgroundColor3 = Color3.fromRGB(56, 56, 56)
  11083. end
  11084. Console.CtrlScroll.MouseButton1Click:Connect(function()
  11085. CtrlScroll = not CtrlScroll
  11086. if CtrlScroll == true then
  11087. Console.CtrlScroll.BackgroundColor3 = Color3.fromRGB(11, 90, 175)
  11088. elseif CtrlScroll == false then
  11089. Console.CtrlScroll.BackgroundColor3 = Color3.fromRGB(56, 56, 56)
  11090. end
  11091. end)
  11092.  
  11093. local IsHoldingCTRL = false
  11094. UserInputService.InputBegan:Connect(function(input, gameproc)
  11095. if not gameproc then
  11096. if input.KeyCode == Enum.KeyCode.LeftControl or input.KeyCode == Enum.KeyCode.RightControl then
  11097. IsHoldingCTRL = true
  11098. end
  11099. end
  11100. end)
  11101. UserInputService.InputEnded:Connect(function(input, gameproc)
  11102. if not gameproc then
  11103. if input.KeyCode == Enum.KeyCode.LeftControl or input.KeyCode == Enum.KeyCode.RightControl then
  11104. IsHoldingCTRL = false
  11105. end
  11106. end
  11107. end)
  11108.  
  11109. if AutoScroll == true then
  11110. Console.AutoScroll.BackgroundColor3 = Color3.fromRGB(11, 90, 175)
  11111. elseif AutoScroll == false then
  11112. Console.AutoScroll.BackgroundColor3 = Color3.fromRGB(56, 56, 56)
  11113. end
  11114. Console.AutoScroll.MouseButton1Click:Connect(function()
  11115. AutoScroll = not AutoScroll
  11116. if AutoScroll == true then
  11117. Console.AutoScroll.BackgroundColor3 = Color3.fromRGB(11, 90, 175)
  11118. Console.Output.CanvasPosition = Vector2.new(0, 9e9)
  11119. elseif AutoScroll == false then
  11120. Console.AutoScroll.BackgroundColor3 = Color3.fromRGB(56, 56, 56)
  11121. end
  11122. end)
  11123.  
  11124. -- Console part
  11125. local displayedOutput = {}
  11126. local OutputLimit = Console.Output.OutputLimit
  11127.  
  11128. Console.TextSizeBox.TextBox.Text = tostring(OutputTextSize.Value)
  11129.  
  11130. Console.TextSizeBox.TextBox:GetPropertyChangedSignal("Text"):Connect(function()
  11131. local tonum = tonumber(Console.TextSizeBox.TextBox.Text)
  11132. if tonum then
  11133. OutputTextSize.Value = tonum
  11134. end
  11135. end)
  11136. OutputTextSize:GetPropertyChangedSignal("Value"):Connect(function()
  11137. Console.TextSizeBox.TextBox.Text = tostring(OutputTextSize.Value)
  11138. end)
  11139.  
  11140. local scrollConsoleInput
  11141. Console.Output.MouseEnter:Connect(function()
  11142. scrollConsoleInput = UserInputService.InputChanged:Connect(function(input)
  11143. if CtrlScroll and input.UserInputType == Enum.UserInputType.MouseWheel and IsHoldingCTRL == true then
  11144. Console.Output.ScrollingEnabled = false
  11145. local newTextSize = OutputTextSize.Value + input.Position.Z
  11146. if newTextSize >= 1 then
  11147. OutputTextSize.Value = newTextSize
  11148. end
  11149. else
  11150. Console.Output.ScrollingEnabled = true
  11151. end
  11152. end)
  11153. end)
  11154. Console.Output.MouseLeave:Connect(function()
  11155. if scrollConsoleInput then
  11156. scrollConsoleInput:Disconnect()
  11157. scrollConsoleInput = nil
  11158. end
  11159. end)
  11160.  
  11161.  
  11162. Console.Clear.MouseButton1Click:Connect(function()
  11163. for _, log in pairs(Console.Output:GetChildren()) do
  11164. if log:IsA("TextBox") then
  11165. log:Destroy()
  11166. end
  11167. end
  11168. end)
  11169.  
  11170. local focussedOutput
  11171.  
  11172. LogService.MessageOut:Connect(function(msg, msgtype)
  11173. local formattedText = ""
  11174. local unformattedText = ""
  11175. local newOutputText = Console.OutputTemplate:Clone()
  11176. table.insert(displayedOutput, newOutputText)
  11177.  
  11178. if #displayedOutput > OutputLimit.Value then
  11179. local oldest = table.remove(displayedOutput, 1)
  11180. if oldest and typeof(oldest) == "Instance" then
  11181. oldest:Destroy()
  11182. end
  11183. end
  11184.  
  11185. unformattedText = os.date("%H:%M:%S")..' '..msg
  11186. if msgtype == Enum.MessageType.MessageOutput then
  11187. formattedText = os.date("%H:%M:%S")..' <font color="rgb(204, 204, 204)">'..msg..'</font>'
  11188. newOutputText.Text = formattedText
  11189. elseif msgtype == Enum.MessageType.MessageWarning then
  11190. formattedText = os.date("%H:%M:%S")..' <b><font color="rgb(255, 142, 60)">'..msg..'</font></b>'
  11191. newOutputText.Text = formattedText
  11192. elseif msgtype == Enum.MessageType.MessageError then
  11193. formattedText = os.date("%H:%M:%S")..' <b><font color="rgb(255, 68, 68)">'..msg..'</font></b>'
  11194. newOutputText.Text = formattedText
  11195. elseif msgtype == Enum.MessageType.MessageInfo then
  11196. formattedText = os.date("%H:%M:%S")..' <font color="rgb(128, 215, 255)">'..msg..'</font>'
  11197. newOutputText.Text = formattedText
  11198. end
  11199.  
  11200. newOutputText.TextSize = OutputTextSize.Value
  11201. OutputTextSize:GetPropertyChangedSignal("Value"):Connect(function()
  11202. newOutputText.TextSize = OutputTextSize.Value
  11203. end)
  11204.  
  11205. newOutputText.Focused:Connect(function()
  11206. focussedOutput = newOutputText
  11207. newOutputText.Text = unformattedText
  11208. end)
  11209. newOutputText.FocusLost:Connect(function()
  11210. focussedOutput = nil
  11211. newOutputText.Text = formattedText
  11212. end)
  11213.  
  11214. newOutputText.Parent = Console.Output
  11215. newOutputText.Visible = true
  11216.  
  11217. if AutoScroll then
  11218. Console.Output.CanvasPosition = Vector2.new(0, 9e9)
  11219. end
  11220. end)
  11221.  
  11222. Console.Output.MouseLeave:Connect(function()
  11223. if focussedOutput then
  11224. focussedOutput:ReleaseFocus()
  11225. end
  11226. end)
  11227.  
  11228. Console.CommandLine.ScrollingFrame.TextBox:GetPropertyChangedSignal("Text"):Connect(function()
  11229.  
  11230. local oneliner = string.gsub(Console.CommandLine.ScrollingFrame.TextBox.Text, "\n", " ")
  11231. Console.CommandLine.ScrollingFrame.TextBox.Text = oneliner
  11232.  
  11233. Console.CommandLine.ScrollingFrame.Highlight.Text = SyntaxHighlightingModule.run(Console.CommandLine.ScrollingFrame.TextBox.Text)
  11234. end)
  11235.  
  11236.  
  11237.  
  11238. Console.CommandLine.ScrollingFrame.TextBox.FocusLost:Connect(function(enterPressed)
  11239. if enterPressed and Console.CommandLine.ScrollingFrame.TextBox.Text ~= "" then
  11240. print("> "..Console.CommandLine.ScrollingFrame.TextBox.Text)
  11241. loadstring(Console.CommandLine.ScrollingFrame.TextBox.Text)()
  11242. end
  11243. end)
  11244. end
  11245.  
  11246. return Console
  11247. end
  11248.  
  11249. return {InitDeps = initDeps, InitAfterMain = initAfterMain, Main = main}
  11250. end,
  11251. SaveInstance = function()
  11252. --[[
  11253. Save Instance Module
  11254. ]]
  11255. -- Common Locals
  11256. local Main,Lib,Apps,Settings -- Main Containers
  11257. local Explorer, Properties, ScriptViewer, Notebook -- Major Apps
  11258. local API,RMD,env,service,plr,create,createSimple -- Main Locals
  11259.  
  11260. local function initDeps(data)
  11261. Main = data.Main
  11262. Lib = data.Lib
  11263. Apps = data.Apps
  11264. Settings = data.Settings
  11265.  
  11266. API = data.API
  11267. RMD = data.RMD
  11268. env = data.env
  11269. service = data.service
  11270. plr = data.plr
  11271. create = data.create
  11272. createSimple = data.createSimple
  11273. end
  11274.  
  11275. local function initAfterMain()
  11276. Explorer = Apps.Explorer
  11277. Properties = Apps.Properties
  11278. ScriptViewer = Apps.ScriptViewer
  11279. Notebook = Apps.Notebook
  11280. end
  11281.  
  11282. local function main()
  11283. local SaveInstance = {}
  11284. local window, ListFrame
  11285. local fileName = "Place_"..game.PlaceId.."_"..service.MarketplaceService:GetProductInfo(game.PlaceId).Name.."_{TIMESTAMP}"
  11286. local Saving = false
  11287.  
  11288. local SaveInstanceArgs = {
  11289. Decompile = true,
  11290. DecompileTimeout = 10,
  11291. DecompileIgnore = {"Chat", "CoreGui", "CorePackages"},
  11292. NilInstances = false,
  11293. RemovePlayerCharacters = true,
  11294. SavePlayers = false,
  11295. MaxThreads = 3,
  11296. ShowStatus = true,
  11297. IgnoreDefaultProps = true,
  11298. IsolateStarterPlayer = true
  11299. }
  11300.  
  11301. local function AddCheckbox(title, default)
  11302. local frame = Lib.Frame.new()
  11303. frame.Gui.Parent = ListFrame
  11304. frame.Gui.Transparency = 1
  11305. frame.Gui.Size = UDim2.new(1,0,0,20)
  11306.  
  11307. local listlayout = Instance.new("UIListLayout")
  11308. listlayout.Parent = frame.Gui
  11309. listlayout.FillDirection = Enum.FillDirection.Horizontal
  11310. listlayout.HorizontalAlignment = Enum.HorizontalAlignment.Left
  11311. listlayout.VerticalAlignment = Enum.VerticalAlignment.Center
  11312. listlayout.Padding = UDim.new(0, 10)
  11313.  
  11314. -- Checkbox
  11315. local checkbox = Lib.Checkbox.new()
  11316.  
  11317. checkbox.Gui.Parent = frame.Gui
  11318. checkbox.Gui.Size = UDim2.new(0,15,0,15)
  11319.  
  11320. -- Label
  11321. local label = Lib.Label.new()
  11322.  
  11323. label.Gui.Parent = frame.Gui
  11324. label.Gui.Size = UDim2.new(1, 0,1, -15)
  11325. label.Gui.Text = title
  11326. label.TextTruncate = Enum.TextTruncate.AtEnd
  11327.  
  11328. checkbox:SetState(default)
  11329.  
  11330. return checkbox
  11331. end
  11332.  
  11333. local function AddTextbox(title, default, sizeX)
  11334. default = tostring(default)
  11335. local frame = Lib.Frame.new()
  11336. frame.Gui.Parent = ListFrame
  11337. frame.Gui.Transparency = 1
  11338. frame.Gui.Size = UDim2.new(1,0,0,20)
  11339.  
  11340. local listlayout = Instance.new("UIListLayout")
  11341. listlayout.Parent = frame.Gui
  11342. listlayout.FillDirection = Enum.FillDirection.Horizontal
  11343. listlayout.HorizontalAlignment = Enum.HorizontalAlignment.Left
  11344. listlayout.VerticalAlignment = Enum.VerticalAlignment.Center
  11345. listlayout.Padding = UDim.new(0, 10)
  11346.  
  11347. -- Textbox
  11348. local textbox = Lib.ViewportTextBox.new()
  11349.  
  11350. textbox.Gui.Parent = frame.Gui
  11351. if sizeX and type(sizeX) == "number" then
  11352. textbox.Gui.Size = UDim2.new(0,sizeX,0,15)
  11353. else
  11354. textbox.Gui.Size = UDim2.new(0,45,0,15)
  11355. end
  11356.  
  11357. textbox.Gui.AutomaticSize = Enum.AutomaticSize.X
  11358. textbox.TextBox.AutomaticSize = Enum.AutomaticSize.X
  11359.  
  11360. -- Label
  11361. local label = Lib.Label.new()
  11362.  
  11363. label.Gui.Parent = frame.Gui
  11364. label.Gui.Size = UDim2.new(1, 0,1, -15)
  11365. label.Gui.Text = title
  11366. label.TextTruncate = Enum.TextTruncate.AtEnd
  11367.  
  11368. textbox:SetText(default)
  11369.  
  11370. return textbox
  11371. end
  11372.  
  11373. local function AddDropdown(title, items, default, sizeX)
  11374. local frame = Lib.Frame.new()
  11375. frame.Gui.Parent = ListFrame
  11376. frame.Gui.Transparency = 1
  11377. frame.Gui.Size = UDim2.new(1,0,0,20)
  11378.  
  11379. local listlayout = Instance.new("UIListLayout")
  11380. listlayout.Parent = frame.Gui
  11381. listlayout.FillDirection = Enum.FillDirection.Horizontal
  11382. listlayout.HorizontalAlignment = Enum.HorizontalAlignment.Left
  11383. listlayout.VerticalAlignment = Enum.VerticalAlignment.Center
  11384. listlayout.Padding = UDim.new(0, 10)
  11385.  
  11386. -- Textbox
  11387. local dropdown = Lib.ViewportTextBox.new()
  11388.  
  11389. dropdown.Gui.Parent = frame.Gui
  11390. if sizeX and type(sizeX) == "number" then
  11391. dropdown.Gui.Size = UDim2.new(0,sizeX,0,15)
  11392. else
  11393. dropdown.Gui.Size = UDim2.new(0,65,0,15)
  11394. end
  11395.  
  11396. -- Label
  11397. local label = Lib.Label.new()
  11398.  
  11399. label.Gui.Parent = frame.Gui
  11400. label.Gui.Size = UDim2.new(1, 0,1, -15)
  11401. label.Gui.Text = title
  11402. label.TextTruncate = Enum.TextTruncate.AtEnd
  11403.  
  11404. dropdown:SetOptions(items)
  11405. dropdown:SetSelected(default)
  11406.  
  11407. return dropdown
  11408. end
  11409.  
  11410. SaveInstance.Init = function()
  11411. window = Lib.Window.new()
  11412. window:SetTitle("Save Instance")
  11413. window:Resize(350,350)
  11414. SaveInstance.Window = window
  11415.  
  11416. -- ListFrame
  11417.  
  11418. -- Fake ScrollBar dex, because its too advanced
  11419. ListFrame = Instance.new("ScrollingFrame")
  11420. ListFrame.Parent = window.GuiElems.Content
  11421. ListFrame.Size = UDim2.new(1, 0,1, -40)
  11422. ListFrame.Position = UDim2.new(0, 0, 0, 0)
  11423. ListFrame.Transparency = 1
  11424. ListFrame.CanvasSize = UDim2.new(0,0,0,0)
  11425. ListFrame.AutomaticCanvasSize = Enum.AutomaticSize.Y
  11426. ListFrame.ScrollBarThickness = 16
  11427. ListFrame.BottomImage = ""
  11428. ListFrame.TopImage = ""
  11429. ListFrame.ScrollBarImageColor3 = Color3.fromRGB(70, 70, 70)
  11430. ListFrame.ScrollBarImageTransparency = 0
  11431. ListFrame.ZIndex = 2
  11432. ListFrame.BorderSizePixel = 0
  11433.  
  11434. local scrollbar = Lib.ScrollBar.new()
  11435. scrollbar.Gui.Parent = window.GuiElems.Content
  11436. scrollbar.Gui.Size = UDim2.new(1, 0,1, -40)
  11437. scrollbar.Gui.Up.ZIndex = 3
  11438. scrollbar.Gui.Down.ZIndex = 3
  11439.  
  11440. ListFrame:GetPropertyChangedSignal("AbsoluteWindowSize"):Connect(function()
  11441. if ListFrame.AbsoluteCanvasSize ~= ListFrame.AbsoluteWindowSize then
  11442. scrollbar.Gui.Visible = true
  11443. else
  11444. scrollbar.Gui.Visible = false
  11445. end
  11446. end)
  11447.  
  11448. local ListLayout = Instance.new("UIListLayout")
  11449. ListLayout.Parent = ListFrame
  11450. ListLayout.Padding = UDim.new(0, 5)
  11451.  
  11452. local Padding = Instance.new("UIPadding")
  11453. Padding.Parent = ListFrame
  11454. Padding.PaddingBottom = UDim.new(0, 5)
  11455. Padding.PaddingLeft = UDim.new(0, 10)
  11456. Padding.PaddingRight = UDim.new(0, 10)
  11457. Padding.PaddingTop = UDim.new(0, 5)
  11458.  
  11459. -- Options
  11460.  
  11461. local Decompile = AddCheckbox("Decompile Scripts (LocalScript and ModuleScript)", SaveInstanceArgs.Decompile)
  11462. Decompile.OnInput:Connect(function()
  11463. SaveInstanceArgs.Decompile = Decompile.Toggled
  11464. end)
  11465.  
  11466. local decompileTimeout = AddTextbox("Decompile Timeout (s)", SaveInstanceArgs.DecompileTimeout, 15)
  11467. decompileTimeout.TextBox.FocusLost:Connect(function()
  11468. SaveInstanceArgs.DecompileTimeout = tonumber(decompileTimeout.TextBox.Text)
  11469. end)
  11470.  
  11471. local decompileThread = AddTextbox("Decompiler Max Threads", "3", 15)
  11472. decompileThread.TextBox.FocusLost:Connect(function()
  11473. SaveInstanceArgs.MaxThreads = tonumber(decompileThread.TextBox.Text)
  11474. end)
  11475.  
  11476. local decompileIgnore = AddTextbox("Decompile Ignore", table.concat(SaveInstanceArgs.DecompileIgnore, ","), 50)
  11477. decompileIgnore.TextBox.FocusLost:Connect(function()
  11478. local inputText = decompileIgnore.TextBox.Text
  11479. local rawList = string.split(inputText, ", ") or string.split(inputText, ",")
  11480. local finalList = {}
  11481.  
  11482. for _, text in ipairs(rawList) do
  11483. local split = string.split(text, ",") or string.split(text, ", ")
  11484. for _, textFound in ipairs(split) do
  11485. table.insert(finalList, textFound)
  11486. end
  11487. end
  11488. SaveInstanceArgs.DecompileIgnore = finalList
  11489. end)
  11490.  
  11491.  
  11492. local NilObj = AddCheckbox("Save Nil Instances", SaveInstanceArgs.NilInstances)
  11493. NilObj.OnInput:Connect(function()
  11494. SaveInstanceArgs.NilInstances = NilObj.Toggled
  11495. end)
  11496.  
  11497. local RemovePlayerChar = AddCheckbox("Remove Player Characters", SaveInstanceArgs.RemovePlayerCharacters)
  11498. RemovePlayerChar.OnInput:Connect(function()
  11499. SaveInstanceArgs.RemovePlayerCharacters = RemovePlayerChar.Toggled
  11500. end)
  11501.  
  11502. local SavePlayerObj = AddCheckbox("Save Player Instance", SaveInstanceArgs.SavePlayers)
  11503. SavePlayerObj.OnInput:Connect(function()
  11504. SaveInstanceArgs.SavePlayers = SavePlayerObj.Toggled
  11505. end)
  11506.  
  11507. local IsolateStarterPlr = AddCheckbox("Isolate StarterPlayer", SaveInstanceArgs.IsolateStarterPlayer)
  11508. IsolateStarterPlr.OnInput:Connect(function()
  11509. SaveInstanceArgs.IsolateStarterPlayer = IsolateStarterPlr.Toggled
  11510. end)
  11511.  
  11512. local IgnoreDefaultProps = AddCheckbox("Ignore Default Properties", SaveInstanceArgs.IgnoreDefaultProps)
  11513. IgnoreDefaultProps.OnInput:Connect(function()
  11514. SaveInstanceArgs.IgnoreDefaultProps = IgnoreDefaultProps.Toggled
  11515. end)
  11516.  
  11517. local ShowStat = AddCheckbox("Show Status", SaveInstanceArgs.ShowStatus)
  11518. ShowStat.OnInput:Connect(function()
  11519. SaveInstanceArgs.ShowStatus = ShowStat.Toggled
  11520. end)
  11521.  
  11522.  
  11523. -- Decompile buttons below
  11524. local FilenameTextBox = Lib.ViewportTextBox.new()
  11525. FilenameTextBox.Gui.Parent = window.GuiElems.Content
  11526. FilenameTextBox.Size = UDim2.new(1,0, 0,20)
  11527. FilenameTextBox.Position = UDim2.new(0,0, 1,-40)
  11528.  
  11529. local textpadding = Instance.new("UIPadding")
  11530. textpadding.Parent = FilenameTextBox.Gui
  11531. textpadding.PaddingLeft = UDim.new(0, 5)
  11532. textpadding.PaddingRight = UDim.new(0, 5)
  11533.  
  11534. local BackgroundButton = Lib.Frame.new()
  11535. BackgroundButton.Gui.Parent = window.GuiElems.Content
  11536. BackgroundButton.Size = UDim2.new(1,0, 0,20)
  11537. BackgroundButton.Position = UDim2.new(0,0, 1,-20)
  11538.  
  11539. local LabelButton = Lib.Label.new()
  11540. LabelButton.Gui.Parent = window.GuiElems.Content
  11541. LabelButton.Size = UDim2.new(1,0, 0,20)
  11542. LabelButton.Position = UDim2.new(0,0, 1,-20)
  11543. LabelButton.Gui.Text = "Save"
  11544. LabelButton.Gui.TextXAlignment = Enum.TextXAlignment.Center
  11545.  
  11546. local Button = Instance.new("TextButton")
  11547. Button.Parent = BackgroundButton.Gui
  11548. Button.Size = UDim2.new(1,0, 1,0)
  11549. Button.Position = UDim2.new(0,0, 0,0)
  11550. Button.Transparency = 1
  11551.  
  11552. FilenameTextBox.TextBox.Text = fileName
  11553. Button.MouseButton1Click:Connect(function()
  11554. local fileName = FilenameTextBox.TextBox.Text:gsub("{TIMESTAMP}", os.date("%d-%m-%Y_%H-%M-%S"))
  11555. window:SetTitle("Save Instance - Saving")
  11556. local s, result = pcall(env.saveinstance, game, env.parsefile(fileName), SaveInstanceArgs)
  11557. if s then
  11558. window:SetTitle("Save Instance - Saved")
  11559. else
  11560. window:SetTitle("Save Instance - Error")
  11561. task.spawn(error("Failed to save the game: "..result))
  11562. end
  11563. task.wait(5)
  11564. window:SetTitle("Save Instance")
  11565. end)
  11566. end
  11567.  
  11568. return SaveInstance
  11569. end
  11570.  
  11571. return {InitDeps = initDeps, InitAfterMain = initAfterMain, Main = main}
  11572. end
  11573. }
  11574.  
  11575. -- Main vars
  11576. local Main, Explorer, Properties, ScriptViewer, DefaultSettings, Notebook, Serializer, Lib, Console, SaveInstance
  11577. local API, RM
  11578.  
  11579. -- Default Settings
  11580. DefaultSettings = (function()
  11581. local rgb = Color3.fromRGB
  11582. return {
  11583. Explorer = {
  11584. _Recurse = true,
  11585. Sorting = true,
  11586. TeleportToOffset = Vector3.new(0,0,0),
  11587. ClickToRename = true,
  11588. AutoUpdateSearch = true,
  11589. AutoUpdateMode = 0, -- 0 Default, 1 no tree update, 2 no descendant events, 3 frozen
  11590. PartSelectionBox = true,
  11591. GuiSelectionBox = true,
  11592. CopyPathUseGetChildren = true
  11593. },
  11594. Properties = {
  11595. _Recurse = true,
  11596. MaxConflictCheck = 50,
  11597. ShowDeprecated = false,
  11598. ShowHidden = false,
  11599. ClearOnFocus = false,
  11600. LoadstringInput = true,
  11601. NumberRounding = 3,
  11602. ShowAttributes = false,
  11603. MaxAttributes = 50,
  11604. ScaleType = 1 -- 0 Full Name Shown, 1 Equal Halves
  11605. },
  11606. Theme = {
  11607. _Recurse = true,
  11608. Main1 = rgb(52,52,52),
  11609. Main2 = rgb(45,45,45),
  11610. Outline1 = rgb(33,33,33), -- Mainly frames
  11611. Outline2 = rgb(55,55,55), -- Mainly button
  11612. Outline3 = rgb(30,30,30), -- Mainly textbox
  11613. TextBox = rgb(38,38,38),
  11614. Menu = rgb(32,32,32),
  11615. ListSelection = rgb(11,90,175),
  11616. Button = rgb(60,60,60),
  11617. ButtonHover = rgb(68,68,68),
  11618. ButtonPress = rgb(40,40,40),
  11619. Highlight = rgb(75,75,75),
  11620. Text = rgb(255,255,255),
  11621. PlaceholderText = rgb(100,100,100),
  11622. Important = rgb(255,0,0),
  11623. ExplorerIconMap = "",
  11624. MiscIconMap = "",
  11625. Syntax = {
  11626. Text = rgb(204,204,204),
  11627. Background = rgb(36,36,36),
  11628. Selection = rgb(255,255,255),
  11629. SelectionBack = rgb(11,90,175),
  11630. Operator = rgb(204,204,204),
  11631. Number = rgb(255,198,0),
  11632. String = rgb(173,241,149),
  11633. Comment = rgb(102,102,102),
  11634. Keyword = rgb(248,109,124),
  11635. Error = rgb(255,0,0),
  11636. FindBackground = rgb(141,118,0),
  11637. MatchingWord = rgb(85,85,85),
  11638. BuiltIn = rgb(132,214,247),
  11639. CurrentLine = rgb(45,50,65),
  11640. LocalMethod = rgb(253,251,172),
  11641. LocalProperty = rgb(97,161,241),
  11642. Nil = rgb(255,198,0),
  11643. Bool = rgb(255,198,0),
  11644. Function = rgb(248,109,124),
  11645. Local = rgb(248,109,124),
  11646. Self = rgb(248,109,124),
  11647. FunctionName = rgb(253,251,172),
  11648. Bracket = rgb(204,204,204)
  11649. },
  11650. }
  11651. }
  11652. end)()
  11653.  
  11654. -- Vars
  11655. local Settings = {}
  11656. local Apps = {}
  11657. local env = {}
  11658.  
  11659. local plr = service.Players.LocalPlayer or service.Players.PlayerAdded:wait()
  11660.  
  11661. local create = function(data)
  11662. local insts = {}
  11663. for i,v in pairs(data) do insts[v[1]] = Instance.new(v[2]) end
  11664.  
  11665. for _,v in pairs(data) do
  11666. for prop,val in pairs(v[3]) do
  11667. if type(val) == "table" then
  11668. insts[v[1]][prop] = insts[val[1]]
  11669. else
  11670. insts[v[1]][prop] = val
  11671. end
  11672. end
  11673. end
  11674.  
  11675. return insts[1]
  11676. end
  11677.  
  11678. local createSimple = function(class,props)
  11679. local inst = Instance.new(class)
  11680. for i,v in next,props do
  11681. inst[i] = v
  11682. end
  11683. return inst
  11684. end
  11685.  
  11686. Main = (function()
  11687. local Main = {}
  11688.  
  11689. Main.ModuleList = {"Explorer", "Properties", "ScriptViewer", "Console", "SaveInstance"}
  11690. Main.Elevated = false
  11691. Main.MissingEnv = {}
  11692. Main.Version = "" -- Beta 1.0.0
  11693. Main.Mouse = plr:GetMouse()
  11694. Main.AppControls = {}
  11695. Main.Apps = Apps
  11696. Main.MenuApps = {}
  11697.  
  11698. Main.DisplayOrders = {
  11699. SideWindow = 8,
  11700. Window = 10,
  11701. Menu = 100000,
  11702. Core = 101000
  11703. }
  11704.  
  11705. Main.GetInitDeps = function()
  11706. return {
  11707. Main = Main,
  11708. Lib = Lib,
  11709. Apps = Apps,
  11710. Settings = Settings,
  11711.  
  11712. API = API,
  11713. RMD = RMD,
  11714. env = env,
  11715. service = service,
  11716. plr = plr,
  11717. create = create,
  11718. createSimple = createSimple
  11719. }
  11720. end
  11721.  
  11722. Main.Error = function(str)
  11723. if rconsoleprint then
  11724. rconsoleprint("DEX ERROR: "..tostring(str).."\n")
  11725. wait(9e9)
  11726. else
  11727. error(str)
  11728. end
  11729. end
  11730.  
  11731. Main.LoadModule = function(name)
  11732. --[[if Main.Elevated then -- If you don't have filesystem api then ur outta luck tbh
  11733. local control
  11734.  
  11735. if EmbeddedModules then -- Offline Modules
  11736. control = EmbeddedModules[name]()
  11737.  
  11738. if not control then Main.Error("Missing Embedded Module: "..name) end
  11739. end
  11740.  
  11741. Main.AppControls[name] = control
  11742. control.InitDeps(Main.GetInitDeps())
  11743.  
  11744. local moduleData = control.Main()
  11745. Apps[name] = moduleData
  11746. return moduleData
  11747. else
  11748. local module = script:WaitForChild("Modules"):WaitForChild(name, 2)
  11749. if not module then Main.Error("CANNOT FIND MODULE " .. name) end
  11750.  
  11751. local control = require(module)
  11752. Main.AppControls[name] = control
  11753. control.InitDeps(Main.GetInitDeps())
  11754.  
  11755. local moduleData = control.Main()
  11756. Apps[name] = moduleData
  11757. return moduleData
  11758. end]]
  11759. local control
  11760.  
  11761. if EmbeddedModules then -- Offline Modules
  11762. control = EmbeddedModules[name]()
  11763.  
  11764. if not control then Main.Error("Missing Embedded Module: "..name) end
  11765. end
  11766.  
  11767. Main.AppControls[name] = control
  11768. control.InitDeps(Main.GetInitDeps())
  11769.  
  11770. local moduleData = control.Main()
  11771. Apps[name] = moduleData
  11772. return moduleData
  11773. end
  11774.  
  11775. Main.LoadModules = function()
  11776. for i,v in pairs(Main.ModuleList) do
  11777. local s,e = pcall(Main.LoadModule,v)
  11778. if not s then
  11779. Main.Error(("FAILED LOADING %s CAUSE %s"):format(v, e))
  11780. end
  11781. end
  11782.  
  11783. -- Init Major Apps and define them in modules
  11784. Explorer = Apps.Explorer
  11785. Properties = Apps.Properties
  11786. ScriptViewer = Apps.ScriptViewer
  11787. Console = Apps.Console
  11788. SaveInstance = Apps.SaveInstance
  11789. Notebook = Apps.Notebook
  11790. local appTable = {
  11791. Explorer = Explorer,
  11792. Properties = Properties,
  11793. ScriptViewer = ScriptViewer,
  11794. Console = Console,
  11795. SaveInstance = SaveInstance,
  11796. Notebook = Notebook
  11797. }
  11798.  
  11799. Main.AppControls.Lib.InitAfterMain(appTable)
  11800. for i,v in pairs(Main.ModuleList) do
  11801. local control = Main.AppControls[v]
  11802. if control then
  11803. control.InitAfterMain(appTable)
  11804. end
  11805. end
  11806. end
  11807.  
  11808. Main.InitEnv = function()
  11809. setmetatable(env, {__newindex = function(self, name, func)
  11810. if not func then Main.MissingEnv[#Main.MissingEnv + 1] = name return end
  11811. rawset(self, name, func)
  11812. end})
  11813.  
  11814. -- file
  11815. env.readfile = missing("function", readfile)
  11816. env.writefile = missing("function", writefile)
  11817. env.appendfile = missing("function", appendfile)
  11818. env.makefolder = missing("function", makefolder)
  11819. env.listfiles = missing("function", listfiles)
  11820. env.loadfile = missing("function", loadfile)
  11821. env.movefileas = missing("function", movefileas)
  11822. env.saveinstance = missing("function", saveinstance) or (function()
  11823. -- https://github.com/luau/UniversalSynSaveInstance
  11824. local success, res = pcall(function()
  11825. return loadstring(oldgame:HttpGet("https://raw.githubusercontent.com/luau/SynSaveInstance/main/saveinstance.luau"))()
  11826. end)
  11827. return success and res or nil
  11828. end)()
  11829. env.parsefile = function(name)
  11830. return tostring(name):gsub("[*\\?:<>|]+", ""):sub(1, 175)
  11831. end
  11832.  
  11833. -- debug
  11834. env.getupvalues = missing("function", (debug and debug.getupvalues) or getupvalues or getupvals)
  11835. env.getconstants = missing("function", (debug and debug.getconstants) or getconstants or getconsts)
  11836. env.getinfo = missing("function", (debug and (debug.getinfo or debug.info)) or getinfo)
  11837. env.islclosure = missing("function", islclosure or is_l_closure or is_lclosure)
  11838. env.checkcaller = missing("function", checkcaller)
  11839. --env.getreg = missing("function", getreg)
  11840. env.getgc = missing("function", getgc or get_gc_objects)
  11841. --env.base64encode = missing("function", crypt and crypt.base64 and crypt.base64.encode)
  11842. env.getscriptbytecode = missing("function", getscriptbytecode)
  11843.  
  11844. -- other
  11845. --env.setfflag = missing("function", setfflag)
  11846. env.request = missing("function", request or http_request or (syn and syn.request) or (http and http.request) or (fluxus and fluxus.request))
  11847. env.decompile = missing("function", decompile) or (env.getscriptbytecode and env.request and (function()
  11848. local success, err = pcall(function()
  11849. loadstring(oldgame:HttpGet("https://raw.githubusercontent.com/infyiff/backup/refs/heads/main/konstant.lua"))()
  11850. end)
  11851.  
  11852. return (success and decompile) or nil
  11853. end)())
  11854. env.isViableDecompileScript = function(obj)
  11855. if obj:IsA("ModuleScript") then
  11856. return true
  11857. elseif obj:IsA("LocalScript") and (obj.RunContext == Enum.RunContext.Client or obj.RunContext == Enum.RunContext.Legacy) then
  11858. return true
  11859. elseif obj:IsA("Script") and obj.RunContext == Enum.RunContext.Client then
  11860. return true
  11861. end
  11862. return false
  11863. end
  11864. env.protectgui = missing("function", protect_gui or (syn and syn.protect_gui))
  11865. env.gethui = missing("function", gethui or get_hidden_gui)
  11866. env.setclipboard = missing("function", setclipboard or toclipboard or set_clipboard or (Clipboard and Clipboard.set))
  11867. env.getnilinstances = missing("function", getnilinstances or get_nil_instances)
  11868. env.getloadedmodules = missing("function", getloadedmodules)
  11869.  
  11870. env.executor = (function()
  11871. local identifyexec = identifyexecutor or getexecutorname or whatexecutor
  11872. local success, name = pcall(function()
  11873. return tostring(identifyexec())
  11874. end)
  11875. return success and name or "Your executor"
  11876. end)()
  11877.  
  11878. Main.GuiHolder = Main.Elevated and service.CoreGui or plr:FindFirstChildWhichIsA("PlayerGui")
  11879.  
  11880. setmetatable(env, nil)
  11881. end
  11882.  
  11883. Main.LoadSettings = function()
  11884. local s,data = pcall(env.readfile or error,"DexSettings.json")
  11885. if s and data and data ~= "" then
  11886. local s,decoded = service.HttpService:JSONDecode(data)
  11887. if s and decoded then
  11888. for i,v in next,decoded do
  11889.  
  11890. end
  11891. else
  11892. -- TODO: Notification
  11893. end
  11894. else
  11895. Main.ResetSettings()
  11896. end
  11897. end
  11898.  
  11899. Main.ResetSettings = function()
  11900. local function recur(t,res)
  11901. for set,val in pairs(t) do
  11902. if type(val) == "table" and val._Recurse then
  11903. if type(res[set]) ~= "table" then
  11904. res[set] = {}
  11905. end
  11906. recur(val,res[set])
  11907. else
  11908. res[set] = val
  11909. end
  11910. end
  11911. return res
  11912. end
  11913. recur(DefaultSettings,Settings)
  11914. end
  11915.  
  11916. local function jsonDecode(str)
  11917. local suc, res = pcall(service.HttpService.JSONDecode, service.HttpService, str)
  11918. return suc and res or suc
  11919. end
  11920.  
  11921. Main.FetchAPI = function()
  11922. local api,rawAPI
  11923. if Main.Elevated then
  11924. if Main.LocalDepsUpToDate() then
  11925. local localAPI = Lib.ReadFile("dex/rbx_api.dat")
  11926. if localAPI then
  11927. rawAPI = localAPI
  11928. else
  11929. Main.DepsVersionData[1] = ""
  11930. end
  11931. end
  11932. rawAPI = rawAPI or oldgame:HttpGet("http://setup.roblox.com/"..Main.RobloxVersion.."-API-Dump.json")
  11933. else
  11934. if script:FindFirstChild("API") then
  11935. rawAPI = require(script.API)
  11936. else
  11937. error("NO API EXISTS")
  11938. end
  11939. end
  11940. Main.RawAPI = rawAPI
  11941. api = jsonDecode(rawAPI)
  11942.  
  11943. -- backup for kaboom
  11944. if not api then
  11945. rawAPI = oldgame:HttpGet("https://raw.githubusercontent.com/infyiff/backup/refs/heads/main/rbx_api.dat")
  11946. Main.RawAPI = rawAPI
  11947. api = jsonDecode(rawAPI)
  11948. end
  11949.  
  11950. local classes,enums = {},{}
  11951. local categoryOrder,seenCategories = {},{}
  11952.  
  11953. local function insertAbove(t,item,aboveItem)
  11954. local findPos = table.find(t,item)
  11955. if not findPos then return end
  11956. table.remove(t,findPos)
  11957.  
  11958. local pos = table.find(t,aboveItem)
  11959. if not pos then return end
  11960. table.insert(t,pos,item)
  11961. end
  11962.  
  11963. for _,class in pairs(api.Classes) do
  11964. local newClass = {}
  11965. newClass.Name = class.Name
  11966. newClass.Superclass = class.Superclass
  11967. newClass.Properties = {}
  11968. newClass.Functions = {}
  11969. newClass.Events = {}
  11970. newClass.Callbacks = {}
  11971. newClass.Tags = {}
  11972.  
  11973. if class.Tags then for c,tag in pairs(class.Tags) do newClass.Tags[tag] = true end end
  11974. for __,member in pairs(class.Members) do
  11975. local newMember = {}
  11976. newMember.Name = member.Name
  11977. newMember.Class = class.Name
  11978. newMember.Security = member.Security
  11979. newMember.Tags ={}
  11980. if member.Tags then for c,tag in pairs(member.Tags) do newMember.Tags[tag] = true end end
  11981.  
  11982. local mType = member.MemberType
  11983. if mType == "Property" then
  11984. local propCategory = member.Category or "Other"
  11985. propCategory = propCategory:match("^%s*(.-)%s*$")
  11986. if not seenCategories[propCategory] then
  11987. categoryOrder[#categoryOrder+1] = propCategory
  11988. seenCategories[propCategory] = true
  11989. end
  11990. newMember.ValueType = member.ValueType
  11991. newMember.Category = propCategory
  11992. newMember.Serialization = member.Serialization
  11993. table.insert(newClass.Properties,newMember)
  11994. elseif mType == "Function" then
  11995. newMember.Parameters = {}
  11996. newMember.ReturnType = member.ReturnType.Name
  11997. for c,param in pairs(member.Parameters) do
  11998. table.insert(newMember.Parameters,{Name = param.Name, Type = param.Type.Name})
  11999. end
  12000. table.insert(newClass.Functions,newMember)
  12001. elseif mType == "Event" then
  12002. newMember.Parameters = {}
  12003. for c,param in pairs(member.Parameters) do
  12004. table.insert(newMember.Parameters,{Name = param.Name, Type = param.Type.Name})
  12005. end
  12006. table.insert(newClass.Events,newMember)
  12007. end
  12008. end
  12009.  
  12010. classes[class.Name] = newClass
  12011. end
  12012.  
  12013. for _,class in pairs(classes) do
  12014. class.Superclass = classes[class.Superclass]
  12015. end
  12016.  
  12017. for _,enum in pairs(api.Enums) do
  12018. local newEnum = {}
  12019. newEnum.Name = enum.Name
  12020. newEnum.Items = {}
  12021. newEnum.Tags = {}
  12022.  
  12023. if enum.Tags then for c,tag in pairs(enum.Tags) do newEnum.Tags[tag] = true end end
  12024. for __,item in pairs(enum.Items) do
  12025. local newItem = {}
  12026. newItem.Name = item.Name
  12027. newItem.Value = item.Value
  12028. table.insert(newEnum.Items,newItem)
  12029. end
  12030.  
  12031. enums[enum.Name] = newEnum
  12032. end
  12033.  
  12034. local function getMember(class,member)
  12035. if not classes[class] or not classes[class][member] then return end
  12036. local result = {}
  12037.  
  12038. local currentClass = classes[class]
  12039. while currentClass do
  12040. for _,entry in pairs(currentClass[member]) do
  12041. result[#result+1] = entry
  12042. end
  12043. currentClass = currentClass.Superclass
  12044. end
  12045.  
  12046. table.sort(result,function(a,b) return a.Name < b.Name end)
  12047. return result
  12048. end
  12049.  
  12050. insertAbove(categoryOrder,"Behavior","Tuning")
  12051. insertAbove(categoryOrder,"Appearance","Data")
  12052. insertAbove(categoryOrder,"Attachments","Axes")
  12053. insertAbove(categoryOrder,"Cylinder","Slider")
  12054. insertAbove(categoryOrder,"Localization","Jump Settings")
  12055. insertAbove(categoryOrder,"Surface","Motion")
  12056. insertAbove(categoryOrder,"Surface Inputs","Surface")
  12057. insertAbove(categoryOrder,"Part","Surface Inputs")
  12058. insertAbove(categoryOrder,"Assembly","Surface Inputs")
  12059. insertAbove(categoryOrder,"Character","Controls")
  12060. categoryOrder[#categoryOrder+1] = "Unscriptable"
  12061. categoryOrder[#categoryOrder+1] = "Attributes"
  12062.  
  12063. local categoryOrderMap = {}
  12064. for i = 1,#categoryOrder do
  12065. categoryOrderMap[categoryOrder[i]] = i
  12066. end
  12067.  
  12068. return {
  12069. Classes = classes,
  12070. Enums = enums,
  12071. CategoryOrder = categoryOrderMap,
  12072. GetMember = getMember
  12073. }
  12074. end
  12075.  
  12076. Main.FetchRMD = function()
  12077. local rawXML
  12078. if Main.Elevated then
  12079. if Main.LocalDepsUpToDate() then
  12080. local localRMD = Lib.ReadFile("dex/rbx_rmd.dat")
  12081. if localRMD then
  12082. rawXML = localRMD
  12083. else
  12084. Main.DepsVersionData[1] = ""
  12085. end
  12086. end
  12087. rawXML = rawXML or oldgame:HttpGet("https://raw.githubusercontent.com/CloneTrooper1019/Roblox-Client-Tracker/roblox/ReflectionMetadata.xml")
  12088. else
  12089. if script:FindFirstChild("RMD") then
  12090. rawXML = require(script.RMD)
  12091. else
  12092. error("NO RMD EXISTS")
  12093. end
  12094. end
  12095. Main.RawRMD = rawXML
  12096. local parsed = Lib.ParseXML(rawXML)
  12097. local classList = parsed.children[1].children[1].children
  12098. local enumList = parsed.children[1].children[2].children
  12099. local propertyOrders = {}
  12100.  
  12101. local classes,enums = {},{}
  12102. for _,class in pairs(classList) do
  12103. local className = ""
  12104. for _,child in pairs(class.children) do
  12105. if child.tag == "Properties" then
  12106. local data = {Properties = {}, Functions = {}}
  12107. local props = child.children
  12108. for _,prop in pairs(props) do
  12109. local name = prop.attrs.name
  12110. name = name:sub(1,1):upper()..name:sub(2)
  12111. data[name] = prop.children[1].text
  12112. end
  12113. className = data.Name
  12114. classes[className] = data
  12115. elseif child.attrs.class == "ReflectionMetadataProperties" then
  12116. local members = child.children
  12117. for _,member in pairs(members) do
  12118. if member.attrs.class == "ReflectionMetadataMember" then
  12119. local data = {}
  12120. if member.children[1].tag == "Properties" then
  12121. local props = member.children[1].children
  12122. for _,prop in pairs(props) do
  12123. if prop.attrs then
  12124. local name = prop.attrs.name
  12125. name = name:sub(1,1):upper()..name:sub(2)
  12126. data[name] = prop.children[1].text
  12127. end
  12128. end
  12129. if data.PropertyOrder then
  12130. local orders = propertyOrders[className]
  12131. if not orders then orders = {} propertyOrders[className] = orders end
  12132. orders[data.Name] = tonumber(data.PropertyOrder)
  12133. end
  12134. classes[className].Properties[data.Name] = data
  12135. end
  12136. end
  12137. end
  12138. elseif child.attrs.class == "ReflectionMetadataFunctions" then
  12139. local members = child.children
  12140. for _,member in pairs(members) do
  12141. if member.attrs.class == "ReflectionMetadataMember" then
  12142. local data = {}
  12143. if member.children[1].tag == "Properties" then
  12144. local props = member.children[1].children
  12145. for _,prop in pairs(props) do
  12146. if prop.attrs then
  12147. local name = prop.attrs.name
  12148. name = name:sub(1,1):upper()..name:sub(2)
  12149. data[name] = prop.children[1].text
  12150. end
  12151. end
  12152. classes[className].Functions[data.Name] = data
  12153. end
  12154. end
  12155. end
  12156. end
  12157. end
  12158. end
  12159.  
  12160. for _,enum in pairs(enumList) do
  12161. local enumName = ""
  12162. for _,child in pairs(enum.children) do
  12163. if child.tag == "Properties" then
  12164. local data = {Items = {}}
  12165. local props = child.children
  12166. for _,prop in pairs(props) do
  12167. local name = prop.attrs.name
  12168. name = name:sub(1,1):upper()..name:sub(2)
  12169. data[name] = prop.children[1].text
  12170. end
  12171. enumName = data.Name
  12172. enums[enumName] = data
  12173. elseif child.attrs.class == "ReflectionMetadataEnumItem" then
  12174. local data = {}
  12175. if child.children[1].tag == "Properties" then
  12176. local props = child.children[1].children
  12177. for _,prop in pairs(props) do
  12178. local name = prop.attrs.name
  12179. name = name:sub(1,1):upper()..name:sub(2)
  12180. data[name] = prop.children[1].text
  12181. end
  12182. enums[enumName].Items[data.Name] = data
  12183. end
  12184. end
  12185. end
  12186. end
  12187.  
  12188. return {Classes = classes, Enums = enums, PropertyOrders = propertyOrders}
  12189. end
  12190.  
  12191. Main.ShowGui = function(gui)
  12192. if env.gethui then
  12193. gui.Parent = env.gethui()
  12194. elseif env.protectgui then
  12195. env.protectgui(gui)
  12196. gui.Parent = Main.GuiHolder
  12197. else
  12198. gui.Parent = Main.GuiHolder
  12199. end
  12200. end
  12201.  
  12202. Main.CreateIntro = function(initStatus) -- TODO: Must theme and show errors
  12203. local gui = create({
  12204. {1,"ScreenGui",{Name="Intro",}},
  12205. {2,"Frame",{Active=true,BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),BorderSizePixel=0,Name="Main",Parent={1},Position=UDim2.new(0.5,-175,0.5,-100),Size=UDim2.new(0,350,0,200),}},
  12206. {3,"Frame",{BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderSizePixel=0,ClipsDescendants=true,Name="Holder",Parent={2},Size=UDim2.new(1,0,1,0),}},
  12207. {4,"UIGradient",{Parent={3},Rotation=30,Transparency=NumberSequence.new({NumberSequenceKeypoint.new(0,1,0),NumberSequenceKeypoint.new(1,1,0),}),}},
  12208. {5,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=4,Name="Title",Parent={3},Position=UDim2.new(0,-190,0,15),Size=UDim2.new(0,100,0,50),Text="Dex",TextColor3=Color3.new(1,1,1),TextSize=50,TextTransparency=1,}},
  12209. {6,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Desc",Parent={3},Position=UDim2.new(0,-230,0,60),Size=UDim2.new(0,180,0,25),Text="Ultimate Debugging Suite",TextColor3=Color3.new(1,1,1),TextSize=18,TextTransparency=1,}},
  12210. {7,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="StatusText",Parent={3},Position=UDim2.new(0,20,0,110),Size=UDim2.new(0,180,0,25),Text="Fetching API",TextColor3=Color3.new(1,1,1),TextSize=14,TextTransparency=1,}},
  12211. {8,"Frame",{BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),BorderSizePixel=0,Name="ProgressBar",Parent={3},Position=UDim2.new(0,110,0,145),Size=UDim2.new(0,0,0,4),}},
  12212. {9,"Frame",{BackgroundColor3=Color3.new(0.2392156869173,0.56078433990479,0.86274510622025),BorderSizePixel=0,Name="Bar",Parent={8},Size=UDim2.new(0,0,1,0),}},
  12213. {10,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://2764171053",ImageColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),Parent={8},ScaleType=1,Size=UDim2.new(1,0,1,0),SliceCenter=Rect.new(2,2,254,254),}},
  12214. {11,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Creator",Parent={2},Position=UDim2.new(1,-110,1,-20),Size=UDim2.new(0,105,0,20),Text="Developed by Moon",TextColor3=Color3.new(1,1,1),TextSize=14,TextXAlignment=1,}},
  12215. {12,"UIGradient",{Parent={11},Transparency=NumberSequence.new({NumberSequenceKeypoint.new(0,1,0),NumberSequenceKeypoint.new(1,1,0),}),}},
  12216. {13,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Version",Parent={2},Position=UDim2.new(1,-110,1,-35),Size=UDim2.new(0,105,0,20),Text=Main.Version,TextColor3=Color3.new(1,1,1),TextSize=14,TextXAlignment=1,}},
  12217. {14,"UIGradient",{Parent={13},Transparency=NumberSequence.new({NumberSequenceKeypoint.new(0,1,0),NumberSequenceKeypoint.new(1,1,0),}),}},
  12218. {15,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Image="rbxassetid://1427967925",Name="Outlines",Parent={2},Position=UDim2.new(0,-5,0,-5),ScaleType=1,Size=UDim2.new(1,10,1,10),SliceCenter=Rect.new(6,6,25,25),TileSize=UDim2.new(0,20,0,20),}},
  12219. {16,"UIGradient",{Parent={15},Rotation=-30,Transparency=NumberSequence.new({NumberSequenceKeypoint.new(0,1,0),NumberSequenceKeypoint.new(1,1,0),}),}},
  12220. {17,"UIGradient",{Parent={2},Rotation=-30,Transparency=NumberSequence.new({NumberSequenceKeypoint.new(0,1,0),NumberSequenceKeypoint.new(1,1,0),}),}},
  12221. })
  12222. Main.ShowGui(gui)
  12223. local backGradient = gui.Main.UIGradient
  12224. local outlinesGradient = gui.Main.Outlines.UIGradient
  12225. local holderGradient = gui.Main.Holder.UIGradient
  12226. local titleText = gui.Main.Holder.Title
  12227. local descText = gui.Main.Holder.Desc
  12228. local versionText = gui.Main.Version
  12229. local versionGradient = versionText.UIGradient
  12230. local creatorText = gui.Main.Creator
  12231. local creatorGradient = creatorText.UIGradient
  12232. local statusText = gui.Main.Holder.StatusText
  12233. local progressBar = gui.Main.Holder.ProgressBar
  12234. local tweenS = service.TweenService
  12235.  
  12236. local renderStepped = service.RunService.RenderStepped
  12237. local signalWait = renderStepped.wait
  12238. local fastwait = function(s)
  12239. if not s then return signalWait(renderStepped) end
  12240. local start = tick()
  12241. while tick() - start < s do signalWait(renderStepped) end
  12242. end
  12243.  
  12244. statusText.Text = initStatus
  12245.  
  12246. local function tweenNumber(n,ti,func)
  12247. local tweenVal = Instance.new("IntValue")
  12248. tweenVal.Value = 0
  12249. tweenVal.Changed:Connect(func)
  12250. local tween = tweenS:Create(tweenVal,ti,{Value = n})
  12251. tween:Play()
  12252. tween.Completed:Connect(function()
  12253. tweenVal:Destroy()
  12254. end)
  12255. end
  12256.  
  12257. local ti = TweenInfo.new(0.4,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
  12258. tweenNumber(100,ti,function(val)
  12259. val = val/200
  12260. local start = NumberSequenceKeypoint.new(0,0)
  12261. local a1 = NumberSequenceKeypoint.new(val,0)
  12262. local a2 = NumberSequenceKeypoint.new(math.min(0.5,val+math.min(0.05,val)),1)
  12263. if a1.Time == a2.Time then a2 = a1 end
  12264. local b1 = NumberSequenceKeypoint.new(1-val,0)
  12265. local b2 = NumberSequenceKeypoint.new(math.max(0.5,1-val-math.min(0.05,val)),1)
  12266. if b1.Time == b2.Time then b2 = b1 end
  12267. local goal = NumberSequenceKeypoint.new(1,0)
  12268. backGradient.Transparency = NumberSequence.new({start,a1,a2,b2,b1,goal})
  12269. outlinesGradient.Transparency = NumberSequence.new({start,a1,a2,b2,b1,goal})
  12270. end)
  12271.  
  12272. fastwait(0.4)
  12273.  
  12274. tweenNumber(100,ti,function(val)
  12275. val = val/166.66
  12276. local start = NumberSequenceKeypoint.new(0,0)
  12277. local a1 = NumberSequenceKeypoint.new(val,0)
  12278. local a2 = NumberSequenceKeypoint.new(val+0.01,1)
  12279. local goal = NumberSequenceKeypoint.new(1,1)
  12280. holderGradient.Transparency = NumberSequence.new({start,a1,a2,goal})
  12281. end)
  12282.  
  12283. tweenS:Create(titleText,ti,{Position = UDim2.new(0,60,0,15), TextTransparency = 0}):Play()
  12284. tweenS:Create(descText,ti,{Position = UDim2.new(0,20,0,60), TextTransparency = 0}):Play()
  12285.  
  12286. local function rightTextTransparency(obj)
  12287. tweenNumber(100,ti,function(val)
  12288. val = val/100
  12289. local a1 = NumberSequenceKeypoint.new(1-val,0)
  12290. local a2 = NumberSequenceKeypoint.new(math.max(0,1-val-0.01),1)
  12291. if a1.Time == a2.Time then a2 = a1 end
  12292. local start = NumberSequenceKeypoint.new(0,a1 == a2 and 0 or 1)
  12293. local goal = NumberSequenceKeypoint.new(1,0)
  12294. obj.Transparency = NumberSequence.new({start,a2,a1,goal})
  12295. end)
  12296. end
  12297. rightTextTransparency(versionGradient)
  12298. rightTextTransparency(creatorGradient)
  12299.  
  12300. fastwait(0.9)
  12301.  
  12302. local progressTI = TweenInfo.new(0.25,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
  12303.  
  12304. tweenS:Create(statusText,progressTI,{Position = UDim2.new(0,20,0,120), TextTransparency = 0}):Play()
  12305. tweenS:Create(progressBar,progressTI,{Position = UDim2.new(0,60,0,145), Size = UDim2.new(0,100,0,4)}):Play()
  12306.  
  12307. fastwait(0.25)
  12308.  
  12309. local function setProgress(text,n)
  12310. statusText.Text = text
  12311. tweenS:Create(progressBar.Bar,progressTI,{Size = UDim2.new(n,0,1,0)}):Play()
  12312. end
  12313.  
  12314. local function close()
  12315. tweenS:Create(titleText,progressTI,{TextTransparency = 1}):Play()
  12316. tweenS:Create(descText,progressTI,{TextTransparency = 1}):Play()
  12317. tweenS:Create(versionText,progressTI,{TextTransparency = 1}):Play()
  12318. tweenS:Create(creatorText,progressTI,{TextTransparency = 1}):Play()
  12319. tweenS:Create(statusText,progressTI,{TextTransparency = 1}):Play()
  12320. tweenS:Create(progressBar,progressTI,{BackgroundTransparency = 1}):Play()
  12321. tweenS:Create(progressBar.Bar,progressTI,{BackgroundTransparency = 1}):Play()
  12322. tweenS:Create(progressBar.ImageLabel,progressTI,{ImageTransparency = 1}):Play()
  12323.  
  12324. tweenNumber(100,TweenInfo.new(0.4,Enum.EasingStyle.Back,Enum.EasingDirection.In),function(val)
  12325. val = val/250
  12326. local start = NumberSequenceKeypoint.new(0,0)
  12327. local a1 = NumberSequenceKeypoint.new(0.6+val,0)
  12328. local a2 = NumberSequenceKeypoint.new(math.min(1,0.601+val),1)
  12329. if a1.Time == a2.Time then a2 = a1 end
  12330. local goal = NumberSequenceKeypoint.new(1,a1 == a2 and 0 or 1)
  12331. holderGradient.Transparency = NumberSequence.new({start,a1,a2,goal})
  12332. end)
  12333.  
  12334. fastwait(0.5)
  12335. gui.Main.BackgroundTransparency = 1
  12336. outlinesGradient.Rotation = 30
  12337.  
  12338. tweenNumber(100,ti,function(val)
  12339. val = val/100
  12340. local start = NumberSequenceKeypoint.new(0,1)
  12341. local a1 = NumberSequenceKeypoint.new(val,1)
  12342. local a2 = NumberSequenceKeypoint.new(math.min(1,val+math.min(0.05,val)),0)
  12343. if a1.Time == a2.Time then a2 = a1 end
  12344. local goal = NumberSequenceKeypoint.new(1,a1 == a2 and 1 or 0)
  12345. outlinesGradient.Transparency = NumberSequence.new({start,a1,a2,goal})
  12346. holderGradient.Transparency = NumberSequence.new({start,a1,a2,goal})
  12347. end)
  12348.  
  12349. fastwait(0.45)
  12350. gui:Destroy()
  12351. end
  12352.  
  12353. return {SetProgress = setProgress, Close = close}
  12354. end
  12355.  
  12356. Main.CreateApp = function(data)
  12357. if Main.MenuApps[data.Name] then return end -- TODO: Handle conflict
  12358. local control = {}
  12359.  
  12360. local app = Main.AppTemplate:Clone()
  12361.  
  12362. local iconIndex = data.Icon
  12363. if data.IconMap and iconIndex then
  12364. if type(iconIndex) == "number" then
  12365. data.IconMap:Display(app.Main.Icon,iconIndex)
  12366. elseif type(iconIndex) == "string" then
  12367. data.IconMap:DisplayByKey(app.Main.Icon,iconIndex)
  12368. end
  12369. elseif type(iconIndex) == "string" then
  12370. app.Main.Icon.Image = iconIndex
  12371. else
  12372. app.Main.Icon.Image = ""
  12373. end
  12374.  
  12375. local function updateState()
  12376. app.Main.BackgroundTransparency = data.Open and 0 or (Lib.CheckMouseInGui(app.Main) and 0 or 1)
  12377. app.Main.Highlight.Visible = data.Open
  12378. end
  12379.  
  12380. local function enable(silent)
  12381. if data.Open then return end
  12382. data.Open = true
  12383. updateState()
  12384. if not silent then
  12385. if data.Window then data.Window:Show() end
  12386. if data.OnClick then data.OnClick(data.Open) end
  12387. end
  12388. end
  12389.  
  12390. local function disable(silent)
  12391. if not data.Open then return end
  12392. data.Open = false
  12393. updateState()
  12394. if not silent then
  12395. if data.Window then data.Window:Hide() end
  12396. if data.OnClick then data.OnClick(data.Open) end
  12397. end
  12398. end
  12399.  
  12400. updateState()
  12401.  
  12402. local ySize = service.TextService:GetTextSize(data.Name,14,Enum.Font.SourceSans,Vector2.new(62,999999)).Y
  12403. app.Main.Size = UDim2.new(1,0,0,math.clamp(46+ySize,60,74))
  12404. app.Main.AppName.Text = data.Name
  12405.  
  12406. app.Main.InputBegan:Connect(function(input)
  12407. if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
  12408. app.Main.BackgroundTransparency = 0
  12409. app.Main.BackgroundColor3 = Settings.Theme.ButtonHover
  12410. end
  12411. end)
  12412.  
  12413. app.Main.InputEnded:Connect(function(input)
  12414. if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
  12415. app.Main.BackgroundTransparency = data.Open and 0 or 1
  12416. app.Main.BackgroundColor3 = Settings.Theme.Button
  12417. end
  12418. end)
  12419.  
  12420. app.Main.MouseButton1Click:Connect(function()
  12421. if data.Open then disable() else enable() end
  12422. end)
  12423.  
  12424. local window = data.Window
  12425. if window then
  12426. window.OnActivate:Connect(function() enable(true) end)
  12427. window.OnDeactivate:Connect(function() disable(true) end)
  12428. end
  12429.  
  12430. app.Visible = true
  12431. app.Parent = Main.AppsContainer
  12432. Main.AppsFrame.CanvasSize = UDim2.new(0,0,0,Main.AppsContainerGrid.AbsoluteCellCount.Y*82 + 8)
  12433.  
  12434. control.Enable = enable
  12435. control.Disable = disable
  12436. Main.MenuApps[data.Name] = control
  12437. return control
  12438. end
  12439.  
  12440. Main.SetMainGuiOpen = function(val)
  12441. Main.MainGuiOpen = val
  12442.  
  12443. Main.MainGui.OpenButton.Text = val and "X" or "Dex"
  12444. if val then Main.MainGui.OpenButton.MainFrame.Visible = true end
  12445. Main.MainGui.OpenButton.MainFrame:TweenSize(val and UDim2.new(0,224,0,200) or UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.2,true)
  12446. --Main.MainGui.OpenButton.BackgroundTransparency = val and 0 or (Lib.CheckMouseInGui(Main.MainGui.OpenButton) and 0 or 0.2)
  12447. service.TweenService:Create(Main.MainGui.OpenButton,TweenInfo.new(0.2,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{BackgroundTransparency = val and 0 or (Lib.CheckMouseInGui(Main.MainGui.OpenButton) and 0 or 0.2)}):Play()
  12448.  
  12449. if Main.MainGuiMouseEvent then Main.MainGuiMouseEvent:Disconnect() end
  12450.  
  12451. if not val then
  12452. local startTime = tick()
  12453. Main.MainGuiCloseTime = startTime
  12454. coroutine.wrap(function()
  12455. Lib.FastWait(0.2)
  12456. if not Main.MainGuiOpen and startTime == Main.MainGuiCloseTime then Main.MainGui.OpenButton.MainFrame.Visible = false end
  12457. end)()
  12458. else
  12459. Main.MainGuiMouseEvent = service.UserInputService.InputBegan:Connect(function(input)
  12460. if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and not Lib.CheckMouseInGui(Main.MainGui.OpenButton) and not Lib.CheckMouseInGui(Main.MainGui.OpenButton.MainFrame) then
  12461.  
  12462. Main.SetMainGuiOpen(false)
  12463. end
  12464. end)
  12465. end
  12466. end
  12467.  
  12468. Main.CreateMainGui = function()
  12469. local gui = create({
  12470. {1,"ScreenGui",{IgnoreGuiInset=true,Name="MainMenu",}},
  12471. {2,"TextButton",{AnchorPoint=Vector2.new(0.5,0),AutoButtonColor=false,BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),BorderSizePixel=0,Font=4,Name="OpenButton",Parent={1},Position=UDim2.new(0.5,0,0,2),Size=UDim2.new(0,32,0,32),Text="Dex",TextColor3=Color3.new(1,1,1),TextSize=16,TextTransparency=0.20000000298023,}},
  12472. {3,"UICorner",{CornerRadius=UDim.new(0,4),Parent={2},}},
  12473. {4,"Frame",{AnchorPoint=Vector2.new(0.5,0),BackgroundColor3=Color3.new(0.17647059261799,0.17647059261799,0.17647059261799),ClipsDescendants=true,Name="MainFrame",Parent={2},Position=UDim2.new(0.5,0,1,-4),Size=UDim2.new(0,224,0,200),}},
  12474. {5,"UICorner",{CornerRadius=UDim.new(0,4),Parent={4},}},
  12475. {6,"Frame",{BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),Name="BottomFrame",Parent={4},Position=UDim2.new(0,0,1,-24),Size=UDim2.new(1,0,0,24),}},
  12476. {7,"UICorner",{CornerRadius=UDim.new(0,4),Parent={6},}},
  12477. {8,"Frame",{BackgroundColor3=Color3.new(0.20392157137394,0.20392157137394,0.20392157137394),BorderSizePixel=0,Name="CoverFrame",Parent={6},Size=UDim2.new(1,0,0,4),}},
  12478. {9,"Frame",{BackgroundColor3=Color3.new(0.1294117718935,0.1294117718935,0.1294117718935),BorderSizePixel=0,Name="Line",Parent={8},Position=UDim2.new(0,0,0,-1),Size=UDim2.new(1,0,0,1),}},
  12479. {10,"TextButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Settings",Parent={6},Position=UDim2.new(1,-48,0,0),Size=UDim2.new(0,24,1,0),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,}},
  12480. {11,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://6578871732",ImageTransparency=0.20000000298023,Name="Icon",Parent={10},Position=UDim2.new(0,4,0,4),Size=UDim2.new(0,16,0,16),}},
  12481. {12,"TextButton",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Font=3,Name="Information",Parent={6},Position=UDim2.new(1,-24,0,0),Size=UDim2.new(0,24,1,0),Text="",TextColor3=Color3.new(1,1,1),TextSize=14,}},
  12482. {13,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://6578933307",ImageTransparency=0.20000000298023,Name="Icon",Parent={12},Position=UDim2.new(0,4,0,4),Size=UDim2.new(0,16,0,16),}},
  12483. {14,"ScrollingFrame",{Active=true,AnchorPoint=Vector2.new(0.5,0),BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderColor3=Color3.new(0.1294117718935,0.1294117718935,0.1294117718935),BorderSizePixel=0,Name="AppsFrame",Parent={4},Position=UDim2.new(0.5,0,0,0),ScrollBarImageColor3=Color3.new(0,0,0),ScrollBarThickness=4,Size=UDim2.new(0,222,1,-25),}},
  12484. {15,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Name="Container",Parent={14},Position=UDim2.new(0,7,0,8),Size=UDim2.new(1,-14,0,2),}},
  12485. {16,"UIGridLayout",{CellSize=UDim2.new(0,66,0,74),Parent={15},SortOrder=2,}},
  12486. {17,"Frame",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Name="App",Parent={1},Size=UDim2.new(0,100,0,100),Visible=false,}},
  12487. {18,"TextButton",{AutoButtonColor=false,BackgroundColor3=Color3.new(0.2352941185236,0.2352941185236,0.2352941185236),BorderSizePixel=0,Font=3,Name="Main",Parent={17},Size=UDim2.new(1,0,0,60),Text="",TextColor3=Color3.new(0,0,0),TextSize=14,}},
  12488. {19,"ImageLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,Image="rbxassetid://6579106223",ImageRectSize=Vector2.new(32,32),Name="Icon",Parent={18},Position=UDim2.new(0.5,-16,0,4),ScaleType=4,Size=UDim2.new(0,32,0,32),}},
  12489. {20,"TextLabel",{BackgroundColor3=Color3.new(1,1,1),BackgroundTransparency=1,BorderSizePixel=0,Font=3,Name="AppName",Parent={18},Position=UDim2.new(0,2,0,38),Size=UDim2.new(1,-4,1,-40),Text="Explorer",TextColor3=Color3.new(1,1,1),TextSize=14,TextTransparency=0.10000000149012,TextTruncate=1,TextWrapped=true,TextYAlignment=0,}},
  12490. {21,"Frame",{BackgroundColor3=Color3.new(0,0.66666668653488,1),BorderSizePixel=0,Name="Highlight",Parent={18},Position=UDim2.new(0,0,1,-2),Size=UDim2.new(1,0,0,2),}},
  12491. })
  12492. Main.MainGui = gui
  12493. Main.AppsFrame = gui.OpenButton.MainFrame.AppsFrame
  12494. Main.AppsContainer = Main.AppsFrame.Container
  12495. Main.AppsContainerGrid = Main.AppsContainer.UIGridLayout
  12496. Main.AppTemplate = gui.App
  12497. Main.MainGuiOpen = false
  12498.  
  12499. local openButton = gui.OpenButton
  12500. openButton.BackgroundTransparency = 0.2
  12501. openButton.MainFrame.Size = UDim2.new(0,0,0,0)
  12502. openButton.MainFrame.Visible = false
  12503. openButton.MouseButton1Click:Connect(function()
  12504. Main.SetMainGuiOpen(not Main.MainGuiOpen)
  12505. end)
  12506.  
  12507. openButton.InputBegan:Connect(function(input)
  12508. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  12509. service.TweenService:Create(Main.MainGui.OpenButton,TweenInfo.new(0,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{BackgroundTransparency = 0}):Play()
  12510. end
  12511. end)
  12512.  
  12513. openButton.InputEnded:Connect(function(input)
  12514. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  12515. service.TweenService:Create(Main.MainGui.OpenButton,TweenInfo.new(0,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{BackgroundTransparency = Main.MainGuiOpen and 0 or 0.2}):Play()
  12516. end
  12517. end)
  12518.  
  12519. -- Create Main Apps
  12520. Main.CreateApp({Name = "Explorer", IconMap = Main.LargeIcons, Icon = "Explorer", Open = true, Window = Explorer.Window})
  12521.  
  12522. Main.CreateApp({Name = "Properties", IconMap = Main.LargeIcons, Icon = "Properties", Open = true, Window = Properties.Window})
  12523.  
  12524. Main.CreateApp({Name = "Script Viewer", IconMap = Main.LargeIcons, Icon = "Script_Viewer", Window = ScriptViewer.Window})
  12525.  
  12526. local cptsOnMouseClick = nil
  12527. Main.CreateApp({Name = "Click part to select", IconMap = Main.LargeIcons, Icon = 6, OnClick = function(callback)
  12528. if callback then
  12529. local mouse = Main.Mouse
  12530. cptsOnMouseClick = mouse.Button1Down:Connect(function()
  12531. pcall(function()
  12532. local object = mouse.Target
  12533. if nodes[object] then
  12534. selection:Set(nodes[object])
  12535. Explorer.ViewNode(nodes[object])
  12536. end
  12537. end)
  12538. end)
  12539. else if cptsOnMouseClick ~= nil then cptsOnMouseClick:Disconnect() cptsOnMouseClick = nil end end
  12540. end})
  12541.  
  12542. Main.CreateApp({Name = "Console", IconMap = Main.LargeIcons, Icon = "Output", Window = Console.Window})
  12543.  
  12544. Main.CreateApp({Name = "Save Instance", IconMap = Main.LargeIcons, Icon = "Watcher", Window = SaveInstance.Window})
  12545.  
  12546. Lib.ShowGui(gui)
  12547. end
  12548.  
  12549. Main.SetupFilesystem = function()
  12550. if not env.writefile or not env.makefolder then return end
  12551. local writefile, makefolder = env.writefile, env.makefolder
  12552. makefolder("dex")
  12553. makefolder("dex/assets")
  12554. makefolder("dex/saved")
  12555. makefolder("dex/plugins")
  12556. makefolder("dex/ModuleCache")
  12557. end
  12558.  
  12559. Main.LocalDepsUpToDate = function()
  12560. return Main.DepsVersionData and Main.ClientVersion == Main.DepsVersionData[1]
  12561. end
  12562.  
  12563. Main.Init = function()
  12564. Main.Elevated = pcall(function() local a = service.CoreGui:GetFullName() end)
  12565. Main.InitEnv()
  12566. Main.LoadSettings()
  12567. Main.SetupFilesystem()
  12568.  
  12569. -- Load Lib
  12570. local intro = Main.CreateIntro("Initializing Library")
  12571. Lib = Main.LoadModule("Lib")
  12572. Lib.FastWait()
  12573.  
  12574. -- Init other stuff
  12575. --Main.IncompatibleTest()
  12576.  
  12577. -- Init icons
  12578. Main.MiscIcons = Lib.IconMap.new("http://www.roblox.com/asset/?id=6511490623",256,256,16,16) -- 6579106223
  12579.  
  12580. Main.MiscIcons:SetDict({
  12581. ["Reference"] = 0;
  12582. ["Cut"] = 1;
  12583. ["Cut_Disabled"] = 2;
  12584. ["Copy"] = 3;
  12585. ["Copy_Disabled"] = 4;
  12586. ["Paste"] = 5;
  12587. ["Paste_Disabled"] = 6;
  12588. ["Delete"] = 7;
  12589. ["Delete_Disabled"] = 8;
  12590. ["Group"] = 9;
  12591. ["Group_Disabled"] = 10;
  12592. ["Ungroup"] = 11;
  12593. ["Ungroup_Disabled"] = 12;
  12594. ["TeleportTo"] = 13;
  12595. ["Rename"] = 14;
  12596. ["JumpToParent"] = 15;
  12597. ["ExploreData"] = 16;
  12598. ["Save"] = 17;
  12599. ["CallFunction"] = 18;
  12600. ["CallRemote"] = 19;
  12601. ["Undo"] = 20,
  12602. ["Undo_Disabled"] = 21;
  12603. ["Redo"] = 22;
  12604. ["Redo_Disabled"] = 23;
  12605. ["Expand_Over"] = 24;
  12606. ["Expand"] = 25;
  12607. ["Collapse_Over"] = 26;
  12608. ["Collapse"] = 27;
  12609. ["SelectChildren"] = 28;
  12610. ["SelectChildren_Disabled"] = 29;
  12611. ["InsertObject"] = 30;
  12612. ["ViewScript"] = 31;
  12613. ["AddStar"] = 32;
  12614. ["RemoveStar"] = 33;
  12615. ["Script_Disabled"] = 34;
  12616. ["LocalScript_Disabled"] = 35;
  12617. ["Play"] = 36;
  12618. ["Pause"] = 37;
  12619. ["Rename_Disabled"] = 38;
  12620. })
  12621. Main.LargeIcons = Lib.IconMap.new("rbxassetid://6579106223",256,256,32,32)
  12622. Main.LargeIcons:SetDict({
  12623. Explorer = 0, Properties = 1, Script_Viewer = 2, Watcher = 3, Output = 4
  12624. })
  12625.  
  12626. -- Fetch version if needed
  12627. intro.SetProgress("Fetching Roblox Version",0.2)
  12628. if Main.Elevated then
  12629. local fileVer = Lib.ReadFile("dex/deps_version.dat")
  12630. Main.ClientVersion = Version()
  12631.  
  12632. if fileVer then
  12633. Main.DepsVersionData = string.split(fileVer,"\n")
  12634. if Main.LocalDepsUpToDate() then
  12635. Main.RobloxVersion = Main.DepsVersionData[2]
  12636. end
  12637. end
  12638. Main.RobloxVersion = Main.RobloxVersion or oldgame:HttpGet("http://setup.roblox.com/versionQTStudio")
  12639.  
  12640. -- backup for kaboom
  12641. if #Main.RobloxVersion < 1 then
  12642. Main.RobloxVersion = oldgame:HttpGet("https://raw.githubusercontent.com/infyiff/backup/refs/heads/main/deps_version.dat"):gsub("%s+", "")
  12643. end
  12644. end
  12645.  
  12646. -- Fetch external deps
  12647. intro.SetProgress("Fetching API",0.35)
  12648. API = Main.FetchAPI()
  12649. Lib.FastWait()
  12650. intro.SetProgress("Fetching RMD",0.5)
  12651. RMD = Main.FetchRMD()
  12652. Lib.FastWait()
  12653.  
  12654. -- Save external deps locally if needed
  12655. if Main.Elevated and env.writefile and not Main.LocalDepsUpToDate() then
  12656. env.writefile("dex/deps_version.dat",Main.ClientVersion.."\n"..Main.RobloxVersion)
  12657. env.writefile("dex/rbx_api.dat",Main.RawAPI)
  12658. env.writefile("dex/rbx_rmd.dat",Main.RawRMD)
  12659. end
  12660.  
  12661. -- Load other modules
  12662. intro.SetProgress("Loading Modules",0.75)
  12663. Main.AppControls.Lib.InitDeps(Main.GetInitDeps()) -- Missing deps now available
  12664. Main.LoadModules()
  12665. Lib.FastWait()
  12666.  
  12667. -- Init other modules
  12668. intro.SetProgress("Initializing Modules",0.9)
  12669. Explorer.Init()
  12670. Properties.Init()
  12671. ScriptViewer.Init()
  12672. Console.Init()
  12673. SaveInstance.Init()
  12674. Lib.FastWait()
  12675.  
  12676. -- Done
  12677. intro.SetProgress("Complete",1)
  12678. coroutine.wrap(function()
  12679. Lib.FastWait(1.25)
  12680. intro.Close()
  12681. end)()
  12682.  
  12683. -- Init window system, create main menu, show explorer and properties
  12684. Lib.Window.Init()
  12685. Main.CreateMainGui()
  12686. Explorer.Window:Show({Align = "right", Pos = 1, Size = 0.5, Silent = true})
  12687. Properties.Window:Show({Align = "right", Pos = 2, Size = 0.5, Silent = true})
  12688. Lib.DeferFunc(function() Lib.Window.ToggleSide("right") end)
  12689. end
  12690.  
  12691. return Main
  12692. end)()
  12693.  
  12694. -- Start
  12695. Main.Init()
Add Comment
Please, Sign In to add comment