MudockYatho

LocalExplore

Sep 8th, 2016
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 78.18 KB | None | 0 0
  1. local Option = {
  2.     Modifiable = false;
  3.     Selectable = true;
  4. }
  5. Option.Modifiable = true
  6. local GUI_SIZE = 16
  7. local ENTRY_PADDING = 1
  8. local ENTRY_MARGIN = 1
  9. local Input = game:GetService("UserInputService")
  10. local HoldingCtrl = false
  11. local HoldingShift = false
  12. local ENTRY_SIZE = GUI_SIZE + ENTRY_PADDING*2
  13. local ENTRY_BOUND = ENTRY_SIZE + ENTRY_MARGIN
  14. local HEADER_SIZE = ENTRY_SIZE*2
  15. local Player = game:GetService("Players")["sadman"]
  16. local mouse = Player:GetMouse()
  17. local FONT = 'SourceSans'
  18. local FONT_SIZE do
  19.     local size = {8,9,10,11,12,14,18,24,36,48}
  20.     local s
  21.     local n = math.huge
  22.     for i = 1,#size do
  23.         if size[i] <= GUI_SIZE then
  24.             FONT_SIZE = i - 1
  25.         end
  26.     end
  27. end
  28. local GuiColor = {
  29.     Background      = Color3.new(233/255, 233/255, 233/255);
  30.     Border          = Color3.new(149/255, 149/255, 149/255);
  31.     Selected        = Color3.new( 96/255, 140/255, 211/255);
  32.     BorderSelected  = Color3.new( 86/255, 125/255, 188/255);
  33.     Text            = Color3.new(  0/255,   0/255,   0/255);
  34.     TextDisabled    = Color3.new(128/255, 128/255, 128/255);
  35.     TextSelected    = Color3.new(255/255, 255/255, 255/255);
  36.     Button          = Color3.new(221/255, 221/255, 221/255);
  37.     ButtonBorder    = Color3.new(149/255, 149/255, 149/255);
  38.     ButtonSelected  = Color3.new(255/255,   0/255,   0/255);
  39.     Field           = Color3.new(255/255, 255/255, 255/255);
  40.     FieldBorder     = Color3.new(191/255, 191/255, 191/255);
  41.     TitleBackground = Color3.new(178/255, 178/255, 178/255);
  42. }
  43. local MAP_ID = 418720155
  44. local ACTION_CUT         = 160
  45. local ACTION_COPY        = 161
  46. local ACTION_PASTE       = 162
  47. local ACTION_DELETE      = 163
  48. local ACTION_SORT        = 164
  49. local ACTION_CUT_OVER    = 174
  50. local ACTION_COPY_OVER   = 175
  51. local ACTION_PASTE_OVER  = 176
  52. local ACTION_DELETE_OVER = 177
  53. local ACTION_SORT_OVER   = 178
  54. local NODE_COLLAPSED      = 165
  55. local NODE_EXPANDED       = 166
  56. local NODE_COLLAPSED_OVER = 179
  57. local NODE_EXPANDED_OVER  = 180
  58. local ExplorerIndex = {
  59.     ["Accessory"] = 32;
  60.     ["Accoutrement"] = 32;
  61.     ["AdService"] = 73;
  62.     ["Animation"] = 60;
  63.     ["AnimationController"] = 60;
  64.     ["AnimationTrack"] = 60;
  65.     ["Animator"] = 60;
  66.     ["ArcHandles"] = 56;
  67.     ["AssetService"] = 72;
  68.     ["Attachment"] = 34;
  69.     ["Backpack"] = 20;
  70.     ["BadgeService"] = 75;
  71.     ["BallSocketConstraint"] = 89;
  72.     ["BillboardGui"] = 64;
  73.     ["BinaryStringValue"] = 4;
  74.     ["BindableEvent"] = 67;
  75.     ["BindableFunction"] = 66;
  76.     ["BlockMesh"] = 8;
  77.     ["BloomEffect"] = 90;
  78.     ["BlurEffect"] = 90;
  79.     ["BodyAngularVelocity"] = 14;
  80.     ["BodyForce"] = 14;
  81.     ["BodyGyro"] = 14;
  82.     ["BodyPosition"] = 14;
  83.     ["BodyThrust"] = 14;
  84.     ["BodyVelocity"] = 14;
  85.     ["BoolValue"] = 4;
  86.     ["BoxHandleAdornment"] = 54;
  87.     ["BrickColorValue"] = 4;
  88.     ["Camera"] = 5;
  89.     ["CFrameValue"] = 4;
  90.     ["CharacterMesh"] = 60;
  91.     ["Chat"] = 33;
  92.     ["ClickDetector"] = 41;
  93.     ["CollectionService"] = 30;
  94.     ["Color3Value"] = 4;
  95.     ["ColorCorrectionEffect"] = 90;
  96.     ["ConeHandleAdornment"] = 54;
  97.     ["Configuration"] = 58;
  98.     ["ContentProvider"] = 72;
  99.     ["ContextActionService"] = 41;
  100.     ["CoreGui"] = 46;
  101.     ["CoreScript"] = 18;
  102.     ["CornerWedgePart"] = 1;
  103.     ["CustomEvent"] = 4;
  104.     ["CustomEventReceiver"] = 4;
  105.     ["CylinderHandleAdornment"] = 54;
  106.     ["CylinderMesh"] = 8;
  107.     ["CylindricalConstraint"] = 89;
  108.     ["Debris"] = 30;
  109.     ["Decal"] = 7;
  110.     ["Dialog"] = 62;
  111.     ["DialogChoice"] = 63;
  112.     ["DoubleConstrainedValue"] = 4;
  113.     ["Explosion"] = 36;
  114.     ["FileMesh"] = 8;
  115.     ["Fire"] = 61;
  116.     ["Flag"] = 38;
  117.     ["FlagStand"] = 39;
  118.     ["FloorWire"] = 4;
  119.     ["Folder"] = 70;
  120.     ["ForceField"] = 37;
  121.     ["Frame"] = 48;
  122.     ["GamePassService"] = 19;
  123.     ["Glue"] = 34;
  124.     ["GuiButton"] = 52;
  125.     ["GuiMain"] = 47;
  126.     ["GuiService"] = 47;
  127.     ["Handles"] = 53;
  128.     ["HapticService"] = 84;
  129.     ["Hat"] = 45;
  130.     ["HingeConstraint"] = 89;
  131.     ["Hint"] = 33;
  132.     ["HopperBin"] = 22;
  133.     ["HttpService"] = 76;
  134.     ["Humanoid"] = 9;
  135.     ["ImageButton"] = 52;
  136.     ["ImageLabel"] = 49;
  137.     ["InsertService"] = 72;
  138.     ["IntConstrainedValue"] = 4;
  139.     ["IntValue"] = 4;
  140.     ["JointInstance"] = 34;
  141.     ["JointsService"] = 34;
  142.     ["Keyframe"] = 60;
  143.     ["KeyframeSequence"] = 60;
  144.     ["KeyframeSequenceProvider"] = 60;
  145.     ["Lighting"] = 13;
  146.     ["LineHandleAdornment"] = 54;
  147.     ["LocalScript"] = 18;
  148.     ["LogService"] = 87;
  149.     ["MarketplaceService"] = 46;
  150.     ["Message"] = 33;
  151.     ["Model"] = 2;
  152.     ["ModuleScript"] = 71;
  153.     ["Motor"] = 34;
  154.     ["Motor6D"] = 34;
  155.     ["MoveToConstraint"] = 89;
  156.     ["NegateOperation"] = 78;
  157.     ["NetworkClient"] = 16;
  158.     ["NetworkReplicator"] = 29;
  159.     ["NetworkServer"] = 15;
  160.     ["NumberValue"] = 4;
  161.     ["ObjectValue"] = 4;
  162.     ["Pants"] = 44;
  163.     ["ParallelRampPart"] = 1;
  164.     ["Part"] = 1;
  165.     ["ParticleEmitter"] = 69;
  166.     ["PartPairLasso"] = 57;
  167.     ["PathfindingService"] = 37;
  168.     ["Platform"] = 35;
  169.     ["Player"] = 12;
  170.     ["PlayerGui"] = 46;
  171.     ["Players"] = 21;
  172.     ["PlayerScripts"] = 82;
  173.     ["PointLight"] = 13;
  174.     ["PointsService"] = 83;
  175.     ["Pose"] = 60;
  176.     ["PrismaticConstraint"] = 89;
  177.     ["PrismPart"] = 1;
  178.     ["PyramidPart"] = 1;
  179.     ["RayValue"] = 4;
  180.     ["ReflectionMetadata"] = 86;
  181.     ["ReflectionMetadataCallbacks"] = 86;
  182.     ["ReflectionMetadataClass"] = 86;
  183.     ["ReflectionMetadataClasses"] = 86;
  184.     ["ReflectionMetadataEnum"] = 86;
  185.     ["ReflectionMetadataEnumItem"] = 86;
  186.     ["ReflectionMetadataEnums"] = 86;
  187.     ["ReflectionMetadataEvents"] = 86;
  188.     ["ReflectionMetadataFunctions"] = 86;
  189.     ["ReflectionMetadataMember"] = 86;
  190.     ["ReflectionMetadataProperties"] = 86;
  191.     ["ReflectionMetadataYieldFunctions"] = 86;
  192.     ["RemoteEvent"] = 80;
  193.     ["RemoteFunction"] = 79;
  194.     ["ReplicatedFirst"] = 72;
  195.     ["ReplicatedStorage"] = 72;
  196.     ["RightAngleRampPart"] = 1;
  197.     ["RocketPropulsion"] = 14;
  198.     ["RodConstraint"] = 89;
  199.     ["RopeConstraint"] = 89;
  200.     ["Rotate"] = 34;
  201.     ["RotateP"] = 34;
  202.     ["RotateV"] = 34;
  203.     ["RunService"] = 66;
  204.     ["ScreenGui"] = 47;
  205.     ["Script"] = 6;
  206.     ["ScrollingFrame"] = 48;
  207.     ["Seat"] = 35;
  208.     ["Selection"] = 55;
  209.     ["SelectionBox"] = 54;
  210.     ["SelectionPartLasso"] = 57;
  211.     ["SelectionPointLasso"] = 57;
  212.     ["SelectionSphere"] = 54;
  213.     ["ServerScriptService"] = 0;
  214.     ["ServerStorage"] = 74;
  215.     ["Shirt"] = 43;
  216.     ["ShirtGraphic"] = 40;
  217.     ["SkateboardPlatform"] = 35;
  218.     ["Sky"] = 28;
  219.     ["SlidingBallConstraint"] = 89;
  220.     ["Smoke"] = 59;
  221.     ["Snap"] = 34;
  222.     ["Sound"] = 11;
  223.     ["SoundService"] = 31;
  224.     ["Sparkles"] = 42;
  225.     ["SpawnLocation"] = 25;
  226.     ["SpecialMesh"] = 8;
  227.     ["SphereHandleAdornment"] = 54;
  228.     ["SpotLight"] = 13;
  229.     ["SpringConstraint"] = 89;
  230.     ["StarterCharacterScripts"] = 82;
  231.     ["StarterGear"] = 20;
  232.     ["StarterGui"] = 46;
  233.     ["StarterPack"] = 20;
  234.     ["StarterPlayer"] = 88;
  235.     ["StarterPlayerScripts"] = 82;
  236.     ["Status"] = 2;
  237.     ["StringValue"] = 4;
  238.     ["SunRaysEffect"] = 90;
  239.     ["SurfaceGui"] = 64;
  240.     ["SurfaceLight"] = 13;
  241.     ["SurfaceSelection"] = 55;
  242.     ["Team"] = 24;
  243.     ["Teams"] = 23;
  244.     ["TeleportService"] = 81;
  245.     ["Terrain"] = 65;
  246.     ["TerrainRegion"] = 65;
  247.     ["TestService"] = 68;
  248.     ["TextBox"] = 51;
  249.     ["TextButton"] = 51;
  250.     ["TextLabel"] = 50;
  251.     ["Texture"] = 10;
  252.     ["TextureTrail"] = 4;
  253.     ["Tool"] = 17;
  254.     ["TouchTransmitter"] = 37;
  255.     ["TrussPart"] = 1;
  256.     ["UnionOperation"] = 77;
  257.     ["UserInputService"] = 84;
  258.     ["Vector3Value"] = 4;
  259.     ["VehicleSeat"] = 35;
  260.     ["VelocityMotor"] = 34;
  261.     ["WedgePart"] = 1;
  262.     ["Weld"] = 34;
  263.     ["Workspace"] = 19;
  264. }
  265. function Create(ty,data)
  266.     local obj
  267.     if type(ty) == 'string' then
  268.         obj = Instance.new(ty)
  269.     else
  270.         obj = ty
  271.     end
  272.     for k, v in pairs(data) do
  273.         if type(k) == 'number' then
  274.             v.Parent = obj
  275.         else
  276.             obj[k] = v
  277.         end
  278.     end
  279.     return obj
  280. end
  281. local barActive = false
  282. local activeOptions = {}
  283. function createDDown(dBut, callback,...)
  284.     if barActive then
  285.         for i,v in pairs(activeOptions) do
  286.             v:Destroy()
  287.         end
  288.         activeOptions = {}
  289.         barActive = false
  290.         return
  291.     else
  292.         barActive = true
  293.     end
  294.     local slots = {...}
  295.     local base = dBut
  296.     for i,v in pairs(slots) do
  297.         local newOption = base:Clone()
  298.         newOption.ZIndex = 5
  299.         newOption.Name = "Option "..tostring(i)
  300.         newOption.Parent = base.Parent.Parent.Parent
  301.         newOption.BackgroundTransparency = 0
  302.         newOption.ZIndex = 2
  303.         table.insert(activeOptions,newOption)
  304.         newOption.Position = UDim2.new(-0.4, dBut.Position.X.Offset, dBut.Position.Y.Scale, dBut.Position.Y.Offset + (#activeOptions * dBut.Size.Y.Offset))
  305.         newOption.Text = slots[i]
  306.         newOption.MouseButton1Down:connect(function()
  307.             dBut.Text = slots[i]
  308.             callback(slots[i])
  309.             for i,v in pairs(activeOptions) do
  310.                 v:Destroy()
  311.             end
  312.             activeOptions = {}
  313.             barActive = false
  314.         end)
  315.     end
  316. end
  317. function Connect(event,func)
  318.     return event:connect(function(...)
  319.         local a = {...}
  320.         spawn(function() func(unpack(a)) end)
  321.     end)
  322. end
  323. function GetScreen(screen)
  324.     if screen == nil then return nil end
  325.     while not screen:IsA("ScreenGui") do
  326.         screen = screen.Parent
  327.         if screen == nil then return nil end
  328.     end
  329.     return screen
  330. end
  331. do
  332.     local ZIndexLock = {}
  333.     function SetZIndex(object,z)
  334.         if not ZIndexLock[object] then
  335.             ZIndexLock[object] = true
  336.             if object:IsA'GuiObject' then
  337.                 object.ZIndex = z
  338.             end
  339.             local children = object:GetChildren()
  340.             for i = 1,#children do
  341.                 SetZIndex(children[i],z)
  342.             end
  343.             ZIndexLock[object] = nil
  344.         end
  345.     end
  346.  
  347.     function SetZIndexOnChanged(object)
  348.         return object.Changed:connect(function(p)
  349.             if p == "ZIndex" then
  350.                 SetZIndex(object,object.ZIndex)
  351.             end
  352.         end)
  353.     end
  354. end
  355. local Icon do
  356.     local iconMap = 'http://www.roblox.com/asset/?id=' .. MAP_ID
  357.     game:GetService('ContentProvider'):Preload(iconMap)
  358.     local iconDehash do
  359.         -- 14 x 14, 0-based input, 0-based output
  360.         local f=math.floor
  361.         function iconDehash(h)
  362.             return f(h/14%14),f(h%14)
  363.         end
  364.     end
  365.  
  366.     function Icon(IconFrame,index)
  367.         local row,col = iconDehash(index)
  368.         local mapSize = Vector2.new(256,256)
  369.         local pad,border = 2,1
  370.         local iconSize = 16
  371.  
  372.         local class = 'Frame'
  373.         if type(IconFrame) == 'string' then
  374.             class = IconFrame
  375.             IconFrame = nil
  376.         end
  377.  
  378.         if not IconFrame then
  379.             IconFrame = Create(class,{
  380.                 Name = "Icon";
  381.                 BackgroundTransparency = 1;
  382.                 ClipsDescendants = true;
  383.                 Create('ImageLabel',{
  384.                     Name = "IconMap";
  385.                     Active = false;
  386.                     BackgroundTransparency = 1;
  387.                     Image = iconMap;
  388.                     Size = UDim2.new(mapSize.x/iconSize,0,mapSize.y/iconSize,0);
  389.                 });
  390.             })
  391.         end
  392.  
  393.         IconFrame.IconMap.Position = UDim2.new(-col - (pad*(col+1) + border)/iconSize,0,-row - (pad*(row+1) + border)/iconSize,0)
  394.         return IconFrame
  395.     end
  396. end
  397. do
  398.     local function ResetButtonColor(button)
  399.         local active = button.Active
  400.         button.Active = not active
  401.         button.Active = active
  402.     end
  403.     local function ArrowGraphic(size,dir,scaled,template)
  404.         local Frame = Create('Frame',{
  405.             Name = "Arrow Graphic";
  406.             BorderSizePixel = 0;
  407.             Size = UDim2.new(0,size,0,size);
  408.             Transparency = 1;
  409.         })
  410.         if not template then
  411.             template = Instance.new("Frame")
  412.             template.BorderSizePixel = 0
  413.         end
  414.  
  415.         local transform
  416.         if dir == nil or dir == 'Up' then
  417.             function transform(p,s) return p,s end
  418.         elseif dir == 'Down' then
  419.             function transform(p,s) return UDim2.new(0,p.X.Offset,0,size-p.Y.Offset-1),s end
  420.         elseif dir == 'Left' then
  421.             function transform(p,s) return UDim2.new(0,p.Y.Offset,0,p.X.Offset),UDim2.new(0,s.Y.Offset,0,s.X.Offset) end
  422.         elseif dir == 'Right' then
  423.             function transform(p,s) return UDim2.new(0,size-p.Y.Offset-1,0,p.X.Offset),UDim2.new(0,s.Y.Offset,0,s.X.Offset) end
  424.         end
  425.  
  426.         local scale
  427.         if scaled then
  428.             function scale(p,s) return UDim2.new(p.X.Offset/size,0,p.Y.Offset/size,0),UDim2.new(s.X.Offset/size,0,s.Y.Offset/size,0) end
  429.         else
  430.             function scale(p,s) return p,s end
  431.         end
  432.  
  433.         local o = math.floor(size/4)
  434.         if size%2 == 0 then
  435.             local n = size/2-1
  436.             for i = 0,n do
  437.                 local t = template:Clone()
  438.                 local p,s = scale(transform(
  439.                     UDim2.new(0,n-i,0,o+i),
  440.                     UDim2.new(0,(i+1)*2,0,1)
  441.                 ))
  442.                 t.Position = p
  443.                 t.Size = s
  444.                 t.Parent = Frame
  445.             end
  446.         else
  447.             local n = (size-1)/2
  448.             for i = 0,n do
  449.                 local t = template:Clone()
  450.                 local p,s = scale(transform(
  451.                     UDim2.new(0,n-i,0,o+i),
  452.                     UDim2.new(0,i*2+1,0,1)
  453.                 ))
  454.                 t.Position = p
  455.                 t.Size = s
  456.                 t.Parent = Frame
  457.             end
  458.         end
  459.         if size%4 > 1 then
  460.             local t = template:Clone()
  461.             local p,s = scale(transform(
  462.                 UDim2.new(0,0,0,size-o-1),
  463.                 UDim2.new(0,size,0,1)
  464.             ))
  465.             t.Position = p
  466.             t.Size = s
  467.             t.Parent = Frame
  468.         end
  469.         return Frame
  470.     end
  471.  
  472.  
  473.     local function GripGraphic(size,dir,spacing,scaled,template)
  474.         local Frame = Create('Frame',{
  475.             Name = "Grip Graphic";
  476.             BorderSizePixel = 0;
  477.             Size = UDim2.new(0,size.x,0,size.y);
  478.             Transparency = 1;
  479.         })
  480.         if not template then
  481.             template = Instance.new("Frame")
  482.             template.BorderSizePixel = 0
  483.         end
  484.  
  485.         spacing = spacing or 2
  486.  
  487.         local scale
  488.         if scaled then
  489.             function scale(p) return UDim2.new(p.X.Offset/size.x,0,p.Y.Offset/size.y,0) end
  490.         else
  491.             function scale(p) return p end
  492.         end
  493.  
  494.         if dir == 'Vertical' then
  495.             for i=0,size.x-1,spacing do
  496.                 local t = template:Clone()
  497.                 t.Size = scale(UDim2.new(0,1,0,size.y))
  498.                 t.Position = scale(UDim2.new(0,i,0,0))
  499.                 t.Parent = Frame
  500.             end
  501.         elseif dir == nil or dir == 'Horizontal' then
  502.             for i=0,size.y-1,spacing do
  503.                 local t = template:Clone()
  504.                 t.Size = scale(UDim2.new(0,size.x,0,1))
  505.                 t.Position = scale(UDim2.new(0,0,0,i))
  506.                 t.Parent = Frame
  507.             end
  508.         end
  509.  
  510.         return Frame
  511.     end
  512.  
  513.     local mt = {
  514.         __index = {
  515.             GetScrollPercent = function(self)
  516.                 return self.ScrollIndex/(self.TotalSpace-self.VisibleSpace)
  517.             end;
  518.             CanScrollDown = function(self)
  519.                 return self.ScrollIndex + self.VisibleSpace < self.TotalSpace
  520.             end;
  521.             CanScrollUp = function(self)
  522.                 return self.ScrollIndex > 0
  523.             end;
  524.             ScrollDown = function(self)
  525.                 self.ScrollIndex = self.ScrollIndex + self.PageIncrement
  526.                 self:Update()
  527.             end;
  528.             ScrollUp = function(self)
  529.                 self.ScrollIndex = self.ScrollIndex - self.PageIncrement
  530.                 self:Update()
  531.             end;
  532.             ScrollTo = function(self,index)
  533.                 self.ScrollIndex = index
  534.                 self:Update()
  535.             end;
  536.             SetScrollPercent = function(self,percent)
  537.                 self.ScrollIndex = math.floor((self.TotalSpace - self.VisibleSpace)*percent + 0.5)
  538.                 self:Update()
  539.             end;
  540.         };
  541.     }
  542.     mt.__index.CanScrollRight = mt.__index.CanScrollDown
  543.     mt.__index.CanScrollLeft = mt.__index.CanScrollUp
  544.     mt.__index.ScrollLeft = mt.__index.ScrollUp
  545.     mt.__index.ScrollRight = mt.__index.ScrollDown
  546.  
  547.     function ScrollBar(horizontal)
  548.         -- create row scroll bar
  549.         local ScrollFrame = Create('Frame',{
  550.             Name = "ScrollFrame";
  551.             Position = horizontal and UDim2.new(0,0,1,-GUI_SIZE) or UDim2.new(1,-GUI_SIZE,0,0);
  552.             Size = horizontal and UDim2.new(1,0,0,GUI_SIZE) or UDim2.new(0,GUI_SIZE,1,0);
  553.             BackgroundTransparency = 1;
  554.             Create('ImageButton',{
  555.                 Name = "ScrollDown";
  556.                 Position = horizontal and UDim2.new(1,-GUI_SIZE,0,0) or UDim2.new(0,0,1,-GUI_SIZE);
  557.                 Size = UDim2.new(0, GUI_SIZE, 0, GUI_SIZE);
  558.                 BackgroundColor3 = GuiColor.Button;
  559.                 BorderColor3 = GuiColor.Border;
  560.                 --BorderSizePixel = 0;
  561.             });
  562.             Create('ImageButton',{
  563.                 Name = "ScrollUp";
  564.                 Size = UDim2.new(0, GUI_SIZE, 0, GUI_SIZE);
  565.                 BackgroundColor3 = GuiColor.Button;
  566.                 BorderColor3 = GuiColor.Border;
  567.                 --BorderSizePixel = 0;
  568.             });
  569.             Create('ImageButton',{
  570.                 Name = "ScrollBar";
  571.                 Size = horizontal and UDim2.new(1,-GUI_SIZE*2,1,0) or UDim2.new(1,0,1,-GUI_SIZE*2);
  572.                 Position = horizontal and UDim2.new(0,GUI_SIZE,0,0) or UDim2.new(0,0,0,GUI_SIZE);
  573.                 AutoButtonColor = false;
  574.                 BackgroundColor3 = Color3.new(0.94902, 0.94902, 0.94902);
  575.                 BorderColor3 = GuiColor.Border;
  576.                 --BorderSizePixel = 0;
  577.                 Create('ImageButton',{
  578.                     Name = "ScrollThumb";
  579.                     AutoButtonColor = false;
  580.                     Size = UDim2.new(0, GUI_SIZE, 0, GUI_SIZE);
  581.                     BackgroundColor3 = GuiColor.Button;
  582.                     BorderColor3 = GuiColor.Border;
  583.                     --BorderSizePixel = 0;
  584.                 });
  585.             });
  586.         })
  587.  
  588.         local graphicTemplate = Create('Frame',{
  589.             Name="Graphic";
  590.             BorderSizePixel = 0;
  591.             BackgroundColor3 = GuiColor.Border;
  592.         })
  593.         local graphicSize = GUI_SIZE/2
  594.  
  595.         local ScrollDownFrame = ScrollFrame.ScrollDown
  596.             local ScrollDownGraphic = ArrowGraphic(graphicSize,horizontal and 'Right' or 'Down',true,graphicTemplate)
  597.             ScrollDownGraphic.Position = UDim2.new(0.5,-graphicSize/2,0.5,-graphicSize/2)
  598.             ScrollDownGraphic.Parent = ScrollDownFrame
  599.         local ScrollUpFrame = ScrollFrame.ScrollUp
  600.             local ScrollUpGraphic = ArrowGraphic(graphicSize,horizontal and 'Left' or 'Up',true,graphicTemplate)
  601.             ScrollUpGraphic.Position = UDim2.new(0.5,-graphicSize/2,0.5,-graphicSize/2)
  602.             ScrollUpGraphic.Parent = ScrollUpFrame
  603.         local ScrollBarFrame = ScrollFrame.ScrollBar
  604.         local ScrollThumbFrame = ScrollBarFrame.ScrollThumb
  605.         do
  606.             local size = GUI_SIZE*3/8
  607.             local Decal = GripGraphic(Vector2.new(size,size),horizontal and 'Vertical' or 'Horizontal',2,graphicTemplate)
  608.             Decal.Position = UDim2.new(0.5,-size/2,0.5,-size/2)
  609.             Decal.Parent = ScrollThumbFrame
  610.         end
  611.  
  612.         local Class = setmetatable({
  613.             GUI = ScrollFrame;
  614.             ScrollIndex = 0;
  615.             VisibleSpace = 0;
  616.             TotalSpace = 0;
  617.             PageIncrement = 1;
  618.         },mt)
  619.  
  620.         local UpdateScrollThumb
  621.         if horizontal then
  622.             function UpdateScrollThumb()
  623.                 ScrollThumbFrame.Size = UDim2.new(Class.VisibleSpace/Class.TotalSpace,0,0,GUI_SIZE)
  624.                 if ScrollThumbFrame.AbsoluteSize.x < GUI_SIZE then
  625.                     ScrollThumbFrame.Size = UDim2.new(0,GUI_SIZE,0,GUI_SIZE)
  626.                 end
  627.                 local barSize = ScrollBarFrame.AbsoluteSize.x
  628.                 ScrollThumbFrame.Position = UDim2.new(Class:GetScrollPercent()*(barSize - ScrollThumbFrame.AbsoluteSize.x)/barSize,0,0,0)
  629.             end
  630.         else
  631.             function UpdateScrollThumb()
  632.                 ScrollThumbFrame.Size = UDim2.new(0,GUI_SIZE,Class.VisibleSpace/Class.TotalSpace,0)
  633.                 if ScrollThumbFrame.AbsoluteSize.y < GUI_SIZE then
  634.                     ScrollThumbFrame.Size = UDim2.new(0,GUI_SIZE,0,GUI_SIZE)
  635.                 end
  636.                 local barSize = ScrollBarFrame.AbsoluteSize.y
  637.                 ScrollThumbFrame.Position = UDim2.new(0,0,Class:GetScrollPercent()*(barSize - ScrollThumbFrame.AbsoluteSize.y)/barSize,0)
  638.             end
  639.         end
  640.  
  641.         local lastDown
  642.         local lastUp
  643.         local scrollStyle = {BackgroundColor3=GuiColor.Border,BackgroundTransparency=0}
  644.         local scrollStyle_ds = {BackgroundColor3=GuiColor.Border,BackgroundTransparency=0.7}
  645.  
  646.         local function Update()
  647.             local t = Class.TotalSpace
  648.             local v = Class.VisibleSpace
  649.             local s = Class.ScrollIndex
  650.             if v <= t then
  651.                 if s > 0 then
  652.                     if s + v > t then
  653.                         Class.ScrollIndex = t - v
  654.                     end
  655.                 else
  656.                     Class.ScrollIndex = 0
  657.                 end
  658.             else
  659.                 Class.ScrollIndex = 0
  660.             end
  661.  
  662.             if Class.UpdateCallback then
  663.                 if Class.UpdateCallback(Class) == false then
  664.                     return
  665.                 end
  666.             end
  667.  
  668.             local down = Class:CanScrollDown()
  669.             local up = Class:CanScrollUp()
  670.             if down ~= lastDown then
  671.                 lastDown = down
  672.                 ScrollDownFrame.Active = down
  673.                 ScrollDownFrame.AutoButtonColor = down
  674.                 local children = ScrollDownGraphic:GetChildren()
  675.                 local style = down and scrollStyle or scrollStyle_ds
  676.                 for i = 1,#children do
  677.                     Create(children[i],style)
  678.                 end
  679.             end
  680.             if up ~= lastUp then
  681.                 lastUp = up
  682.                 ScrollUpFrame.Active = up
  683.                 ScrollUpFrame.AutoButtonColor = up
  684.                 local children = ScrollUpGraphic:GetChildren()
  685.                 local style = up and scrollStyle or scrollStyle_ds
  686.                 for i = 1,#children do
  687.                     Create(children[i],style)
  688.                 end
  689.             end
  690.             ScrollThumbFrame.Visible = down or up
  691.             UpdateScrollThumb()
  692.         end
  693.         Class.Update = Update
  694.  
  695.         SetZIndexOnChanged(ScrollFrame)
  696.  
  697.         local MouseDrag = Create('ImageButton',{
  698.             Name = "MouseDrag";
  699.             Position = UDim2.new(-0.25,0,-0.25,0);
  700.             Size = UDim2.new(1.5,0,1.5,0);
  701.             Transparency = 1;
  702.             AutoButtonColor = false;
  703.             Active = true;
  704.             ZIndex = 10;
  705.         })
  706.  
  707.         local scrollEventID = 0
  708.         ScrollDownFrame.MouseButton1Down:connect(function()
  709.             scrollEventID = tick()
  710.             local current = scrollEventID
  711.             local up_con
  712.             up_con = MouseDrag.MouseButton1Up:connect(function()
  713.                 scrollEventID = tick()
  714.                 MouseDrag.Parent = nil
  715.                 ResetButtonColor(ScrollDownFrame)
  716.                 up_con:disconnect(); drag = nil
  717.             end)
  718.             MouseDrag.Parent = GetScreen(ScrollFrame)
  719.             Class:ScrollDown()
  720.             wait(0.2) -- delay before auto scroll
  721.             while scrollEventID == current do
  722.                 Class:ScrollDown()
  723.                 if not Class:CanScrollDown() then break end
  724.                 wait()
  725.             end
  726.         end)
  727.  
  728.         ScrollDownFrame.MouseButton1Up:connect(function()
  729.             scrollEventID = tick()
  730.         end)
  731.  
  732.         ScrollUpFrame.MouseButton1Down:connect(function()
  733.             scrollEventID = tick()
  734.             local current = scrollEventID
  735.             local up_con
  736.             up_con = MouseDrag.MouseButton1Up:connect(function()
  737.                 scrollEventID = tick()
  738.                 MouseDrag.Parent = nil
  739.                 ResetButtonColor(ScrollUpFrame)
  740.                 up_con:disconnect(); drag = nil
  741.             end)
  742.             MouseDrag.Parent = GetScreen(ScrollFrame)
  743.             Class:ScrollUp()
  744.             wait(0.2)
  745.             while scrollEventID == current do
  746.                 Class:ScrollUp()
  747.                 if not Class:CanScrollUp() then break end
  748.                 wait()
  749.             end
  750.         end)
  751.  
  752.         ScrollUpFrame.MouseButton1Up:connect(function()
  753.             scrollEventID = tick()
  754.         end)
  755.  
  756.         if horizontal then
  757.             ScrollBarFrame.MouseButton1Down:connect(function(x,y)
  758.                 scrollEventID = tick()
  759.                 local current = scrollEventID
  760.                 local up_con
  761.                 up_con = MouseDrag.MouseButton1Up:connect(function()
  762.                     scrollEventID = tick()
  763.                     MouseDrag.Parent = nil
  764.                     ResetButtonColor(ScrollUpFrame)
  765.                     up_con:disconnect(); drag = nil
  766.                 end)
  767.                 MouseDrag.Parent = GetScreen(ScrollFrame)
  768.                 if x > ScrollThumbFrame.AbsolutePosition.x then
  769.                     Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
  770.                     wait(0.2)
  771.                     while scrollEventID == current do
  772.                         if x < ScrollThumbFrame.AbsolutePosition.x + ScrollThumbFrame.AbsoluteSize.x then break end
  773.                         Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
  774.                         wait()
  775.                     end
  776.                 else
  777.                     Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
  778.                     wait(0.2)
  779.                     while scrollEventID == current do
  780.                         if x > ScrollThumbFrame.AbsolutePosition.x then break end
  781.                         Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
  782.                         wait()
  783.                     end
  784.                 end
  785.             end)
  786.         else
  787.             ScrollBarFrame.MouseButton1Down:connect(function(x,y)
  788.                 scrollEventID = tick()
  789.                 local current = scrollEventID
  790.                 local up_con
  791.                 up_con = MouseDrag.MouseButton1Up:connect(function()
  792.                     scrollEventID = tick()
  793.                     MouseDrag.Parent = nil
  794.                     ResetButtonColor(ScrollUpFrame)
  795.                     up_con:disconnect(); drag = nil
  796.                 end)
  797.                 MouseDrag.Parent = GetScreen(ScrollFrame)
  798.                 if y > ScrollThumbFrame.AbsolutePosition.y then
  799.                     Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
  800.                     wait(0.2)
  801.                     while scrollEventID == current do
  802.                         if y < ScrollThumbFrame.AbsolutePosition.y + ScrollThumbFrame.AbsoluteSize.y then break end
  803.                         Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
  804.                         wait()
  805.                     end
  806.                 else
  807.                     Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
  808.                     wait(0.2)
  809.                     while scrollEventID == current do
  810.                         if y > ScrollThumbFrame.AbsolutePosition.y then break end
  811.                         Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
  812.                         wait()
  813.                     end
  814.                 end
  815.             end)
  816.         end
  817.  
  818.         if horizontal then
  819.             ScrollThumbFrame.MouseButton1Down:connect(function(x,y)
  820.                 scrollEventID = tick()
  821.                 local mouse_offset = x - ScrollThumbFrame.AbsolutePosition.x
  822.                 local drag_con
  823.                 local up_con
  824.                 drag_con = MouseDrag.MouseMoved:connect(function(x,y)
  825.                     local bar_abs_pos = ScrollBarFrame.AbsolutePosition.x
  826.                     local bar_drag = ScrollBarFrame.AbsoluteSize.x - ScrollThumbFrame.AbsoluteSize.x
  827.                     local bar_abs_one = bar_abs_pos + bar_drag
  828.                     x = x - mouse_offset
  829.                     x = x < bar_abs_pos and bar_abs_pos or x > bar_abs_one and bar_abs_one or x
  830.                     x = x - bar_abs_pos
  831.                     Class:SetScrollPercent(x/(bar_drag))
  832.                 end)
  833.                 up_con = MouseDrag.MouseButton1Up:connect(function()
  834.                     scrollEventID = tick()
  835.                     MouseDrag.Parent = nil
  836.                     ResetButtonColor(ScrollThumbFrame)
  837.                     drag_con:disconnect(); drag_con = nil
  838.                     up_con:disconnect(); drag = nil
  839.                 end)
  840.                 MouseDrag.Parent = GetScreen(ScrollFrame)
  841.             end)
  842.         else
  843.             ScrollThumbFrame.MouseButton1Down:connect(function(x,y)
  844.                 scrollEventID = tick()
  845.                 local mouse_offset = y - ScrollThumbFrame.AbsolutePosition.y
  846.                 local drag_con
  847.                 local up_con
  848.                 drag_con = MouseDrag.MouseMoved:connect(function(x,y)
  849.                     local bar_abs_pos = ScrollBarFrame.AbsolutePosition.y
  850.                     local bar_drag = ScrollBarFrame.AbsoluteSize.y - ScrollThumbFrame.AbsoluteSize.y
  851.                     local bar_abs_one = bar_abs_pos + bar_drag
  852.                     y = y - mouse_offset
  853.                     y = y < bar_abs_pos and bar_abs_pos or y > bar_abs_one and bar_abs_one or y
  854.                     y = y - bar_abs_pos
  855.                     Class:SetScrollPercent(y/(bar_drag))
  856.                 end)
  857.                 up_con = MouseDrag.MouseButton1Up:connect(function()
  858.                     scrollEventID = tick()
  859.                     MouseDrag.Parent = nil
  860.                     ResetButtonColor(ScrollThumbFrame)
  861.                     drag_con:disconnect(); drag_con = nil
  862.                     up_con:disconnect(); drag = nil
  863.                 end)
  864.                 MouseDrag.Parent = GetScreen(ScrollFrame)
  865.             end)
  866.         end
  867.  
  868.         function Class:Destroy()
  869.             ScrollFrame:Destroy()
  870.             MouseDrag:Destroy()
  871.             for k in pairs(Class) do
  872.                 Class[k] = nil
  873.             end
  874.             setmetatable(Class,nil)
  875.         end
  876.  
  877.         Update()
  878.  
  879.         return Class
  880.     end
  881. end
  882. local explorerPanel = script.Parent
  883. Create(explorerPanel,{
  884.     BackgroundColor3 = GuiColor.Field;
  885.     BorderColor3 = GuiColor.Border;
  886.     Active = true;
  887. })
  888. local SettingsRemote = explorerPanel.Parent:WaitForChild("SettingsPanel"):WaitForChild("GetSetting")
  889. local GetApiRemote = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("GetApi")
  890. local GetAwaitRemote = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("GetAwaiting")
  891. local bindSetAwaiting = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("SetAwaiting")
  892. local ConfirmationWindow = explorerPanel.Parent:WaitForChild("Confirmation")
  893. local CautionWindow = explorerPanel.Parent:WaitForChild("Caution")
  894. local TableCautionWindow = explorerPanel.Parent:WaitForChild("TableCaution")
  895. local RemoteWindow = explorerPanel.Parent:WaitForChild("CallRemote")
  896. local CurrentRemoteWindow
  897. local lastSelectedNode
  898. local listFrame = Create('Frame',{
  899.     Name = "List";
  900.     BackgroundTransparency = 1;
  901.     ClipsDescendants = true;
  902.     Position = UDim2.new(0,0,0,HEADER_SIZE);
  903.     Size = UDim2.new(1,-GUI_SIZE,1,-HEADER_SIZE);
  904.     Parent = explorerPanel;
  905. })
  906.  
  907. local scrollBar = ScrollBar(false)
  908. scrollBar.PageIncrement = 1
  909. Create(scrollBar.GUI,{
  910.     Position = UDim2.new(1,-GUI_SIZE,0,HEADER_SIZE);
  911.     Size = UDim2.new(0,GUI_SIZE,1,-HEADER_SIZE);
  912.     Parent = explorerPanel;
  913. })
  914.  
  915. local scrollBarH = ScrollBar(true)
  916. scrollBarH.PageIncrement = GUI_SIZE
  917. Create(scrollBarH.GUI,{
  918.     Position = UDim2.new(0,0,1,-GUI_SIZE);
  919.     Size = UDim2.new(1,-GUI_SIZE,0,GUI_SIZE);
  920.     Visible = false;
  921.     Parent = explorerPanel;
  922. })
  923.  
  924. local headerFrame = Create('Frame',{
  925.     Name = "Header";
  926.     BackgroundColor3 = GuiColor.Background;
  927.     BorderColor3 = GuiColor.Border;
  928.     Position = UDim2.new(0,0,0,0);
  929.     Size = UDim2.new(1,0,0,HEADER_SIZE);
  930.     Parent = explorerPanel;
  931.     Create('TextLabel',{
  932.         Text = "Explorer";
  933.         BackgroundTransparency = 1;
  934.         TextColor3 = GuiColor.Text;
  935.         TextXAlignment = 'Left';
  936.         Font = FONT;
  937.         FontSize = FONT_SIZE;
  938.         Position = UDim2.new(0,4,0,0);
  939.         Size = UDim2.new(1,-4,0.5,0);
  940.     });
  941. })
  942.  
  943. local explorerFilter =  Create('TextBox',{
  944.     Text = "Filter Workspace";
  945.     BackgroundTransparency = 0.8;
  946.     TextColor3 = GuiColor.Text;
  947.     TextXAlignment = 'Left';
  948.     Font = FONT;
  949.     FontSize = FONT_SIZE;
  950.     Position = UDim2.new(0,4,0.5,0);
  951.     Size = UDim2.new(1,-8,0.5,-2);
  952. });
  953. explorerFilter.Parent = headerFrame
  954.  
  955. SetZIndexOnChanged(explorerPanel)
  956.  
  957. local function CreateColor3(r, g, b) return Color3.new(r/255,g/255,b/255) end
  958.  
  959. local Styles = {
  960.     Font = Enum.Font.Arial;
  961.     Margin = 5;
  962.     Black = CreateColor3(0,0,0);
  963.     White = CreateColor3(255,255,255);
  964. }
  965.  
  966. local DropDown = {
  967.     Font = Styles.Font;
  968.     FontSize = Enum.FontSize.Size14;
  969.     TextColor = CreateColor3(0,0,0);
  970.     TextColorOver = Styles.White;
  971.     TextXAlignment = Enum.TextXAlignment.Left;
  972.     Height = 20;
  973.     BackColor = Styles.White;
  974.     BackColorOver = CreateColor3(86,125,188);
  975.     BorderColor = CreateColor3(216,216,216);
  976.     BorderSizePixel = 2;
  977.     ArrowColor = CreateColor3(160,160,160);
  978.     ArrowColorOver = Styles.Black;
  979. }
  980.  
  981. local Row = {
  982.     Font = Styles.Font;
  983.     FontSize = Enum.FontSize.Size14;
  984.     TextXAlignment = Enum.TextXAlignment.Left;
  985.     TextColor = Styles.Black;
  986.     TextColorOver = Styles.White;
  987.     TextLockedColor = CreateColor3(120,120,120);
  988.     Height = 24;
  989.     BorderColor = CreateColor3(216,216,216);
  990.     BackgroundColor = Styles.White;
  991.     BackgroundColorAlternate = CreateColor3(246,246,246);
  992.     BackgroundColorMouseover = CreateColor3(211,224,244);
  993.     TitleMarginLeft = 15;
  994. }
  995.  
  996. local currentRightClickMenu
  997. local CurrentInsertObjectWindow
  998. local CurrentFunctionCallerWindow
  999.  
  1000. local RbxApi
  1001.  
  1002. function ClassCanCreate(IName)
  1003.     local success,err = pcall(function() Instance.new(IName) end)
  1004.     if err then
  1005.         return false
  1006.     else
  1007.         return true
  1008.     end
  1009. end
  1010.  
  1011. function GetClasses()
  1012.     if RbxApi == nil then return {} end
  1013.     local classTable = {}
  1014.     for i,v in pairs(RbxApi.Classes) do
  1015.         if ClassCanCreate(v.Name) then
  1016.             table.insert(classTable,v.Name)
  1017.         end
  1018.     end
  1019.     return classTable
  1020. end
  1021.  
  1022. local function sortAlphabetic(t, property)
  1023.     table.sort(t,
  1024.         function(x,y) return x[property] < y[property]
  1025.     end)
  1026. end
  1027.  
  1028. local function FunctionIsHidden(functionData)
  1029.     local tags = functionData["tags"]
  1030.     for _,name in pairs(tags) do
  1031.         if name == "deprecated"
  1032.             or name == "hidden"
  1033.             or name == "writeonly" then
  1034.             return true
  1035.         end
  1036.     end
  1037.     return false
  1038. end
  1039.  
  1040. local function GetAllFunctions(className)
  1041.     local class = RbxApi.Classes[className]
  1042.     local functions = {}
  1043.    
  1044.     if not class then return functions end
  1045.    
  1046.     while class do
  1047.         if class.Name == "Instance" then break end
  1048.         for _,nextFunction in pairs(class.Functions) do
  1049.             if not FunctionIsHidden(nextFunction) then
  1050.                 table.insert(functions, nextFunction)
  1051.             end
  1052.         end
  1053.         class = RbxApi.Classes[class.Superclass]
  1054.     end
  1055.    
  1056.     sortAlphabetic(functions, "Name")
  1057.  
  1058.     return functions
  1059. end
  1060.  
  1061. function GetFunctions()
  1062.     if RbxApi == nil then return {} end
  1063.     local List = SelectionVar():Get()
  1064.    
  1065.     if #List == 0 then return end
  1066.    
  1067.     local MyObject = List[1]
  1068.    
  1069.     local functionTable = {}
  1070.     for i,v in pairs(GetAllFunctions(MyObject.ClassName)) do
  1071.         table.insert(functionTable,v)
  1072.     end
  1073.     return functionTable
  1074. end
  1075.  
  1076. function CreateInsertObjectMenu(choices, currentChoice, readOnly, onClick)
  1077.     local totalSize = explorerPanel.Parent.AbsoluteSize.y
  1078.     if #choices == 0 then return end
  1079.     table.sort(choices, function(a,b) return a < b end)
  1080.     local frame = Instance.new("Frame")
  1081.     frame.Name = "InsertObject"
  1082.     frame.Size = UDim2.new(0, 200, 1, 0)
  1083.     frame.BackgroundTransparency = 1
  1084.     frame.Active = true
  1085.     local menu = nil
  1086.     local arrow = nil
  1087.     local expanded = false
  1088.     local margin = DropDown.BorderSizePixel;
  1089.     local function hideMenu()
  1090.         expanded = false
  1091.         --showArrow(DropDown.ArrowColor)
  1092.         if frame then
  1093.             --frame:Destroy()
  1094.             CurrentInsertObjectWindow.Visible = false
  1095.         end
  1096.     end
  1097.    
  1098.     local function showMenu()
  1099.         expanded = true
  1100.         menu = Instance.new("ScrollingFrame")
  1101.         menu.Size = UDim2.new(0,200,1,0)
  1102.         menu.CanvasSize = UDim2.new(0, 200, 0, #choices * DropDown.Height)
  1103.         menu.Position = UDim2.new(0, margin, 0, 0)
  1104.         menu.BackgroundTransparency = 0
  1105.         menu.BackgroundColor3 = DropDown.BackColor
  1106.         menu.BorderColor3 = DropDown.BorderColor
  1107.         menu.BorderSizePixel = DropDown.BorderSizePixel
  1108.         menu.TopImage = "rbxasset://textures/blackBkg_square.png"
  1109.         menu.MidImage = "rbxasset://textures/blackBkg_square.png"
  1110.         menu.BottomImage = "rbxasset://textures/blackBkg_square.png"
  1111.         menu.Active = true
  1112.         menu.ZIndex = 5
  1113.         menu.Parent = frame
  1114.        
  1115.         --local parentFrameHeight = script.Parent.List.Size.Y.Offset
  1116.         --local rowHeight = mouse.Y
  1117.         --if (rowHeight + menu.Size.Y.Offset) > parentFrameHeight then
  1118.         --  menu.Position = UDim2.new(0, margin, 0, -1 * (#choices * DropDown.Height) - margin)
  1119.         --end
  1120.            
  1121.         local function choice(name)
  1122.             onClick(name)
  1123.             hideMenu()
  1124.         end
  1125.        
  1126.         for i,name in pairs(choices) do
  1127.             local option = CreateRightClickMenuItem(name, function()
  1128.                 choice(name)
  1129.             end,1)
  1130.             option.Size = UDim2.new(1, 0, 0, 20)
  1131.             option.Position = UDim2.new(0, 0, 0, (i - 1) * DropDown.Height)
  1132.             option.ZIndex = menu.ZIndex
  1133.             option.Parent = menu
  1134.         end
  1135.     end
  1136.  
  1137.  
  1138.     showMenu()
  1139.  
  1140.    
  1141.     return frame
  1142. end
  1143.  
  1144. function CreateFunctionCallerMenu(choices, currentChoice, readOnly, onClick)
  1145.     local totalSize = explorerPanel.Parent.AbsoluteSize.y
  1146.     if #choices == 0 then return end
  1147.    
  1148.     table.sort(choices, function(a,b) return a.Name < b.Name end)
  1149.  
  1150.     local frame = Instance.new("Frame")
  1151.     frame.Name = "InsertObject"
  1152.     frame.Size = UDim2.new(0, 200, 1, 0)
  1153.     frame.BackgroundTransparency = 1
  1154.     frame.Active = true
  1155.    
  1156.     local menu = nil
  1157.     local arrow = nil
  1158.     local expanded = false
  1159.     local margin = DropDown.BorderSizePixel;
  1160.    
  1161.     local function hideMenu()
  1162.         expanded = false
  1163.         --showArrow(DropDown.ArrowColor)
  1164.         if frame then
  1165.             --frame:Destroy()
  1166.             CurrentInsertObjectWindow.Visible = false
  1167.         end
  1168.     end
  1169.    
  1170.     local function showMenu()
  1171.         expanded = true
  1172.         menu = Instance.new("ScrollingFrame")
  1173.         menu.Size = UDim2.new(0,300,1,0)
  1174.         menu.CanvasSize = UDim2.new(0, 300, 0, #choices * DropDown.Height)
  1175.         menu.Position = UDim2.new(0, margin, 0, 0)
  1176.         menu.BackgroundTransparency = 0
  1177.         menu.BackgroundColor3 = DropDown.BackColor
  1178.         menu.BorderColor3 = DropDown.BorderColor
  1179.         menu.BorderSizePixel = DropDown.BorderSizePixel
  1180.         menu.TopImage = "rbxasset://textures/blackBkg_square.png"
  1181.         menu.MidImage = "rbxasset://textures/blackBkg_square.png"
  1182.         menu.BottomImage = "rbxasset://textures/blackBkg_square.png"
  1183.         menu.Active = true
  1184.         menu.ZIndex = 5
  1185.         menu.Parent = frame
  1186.        
  1187.         --local parentFrameHeight = script.Parent.List.Size.Y.Offset
  1188.         --local rowHeight = mouse.Y
  1189.         --if (rowHeight + menu.Size.Y.Offset) > parentFrameHeight then
  1190.         --  menu.Position = UDim2.new(0, margin, 0, -1 * (#choices * DropDown.Height) - margin)
  1191.         --end
  1192.        
  1193.         local function GetParameters(functionData)
  1194.             local paraString = ""
  1195.             paraString = paraString.."("
  1196.             for i,v in pairs(functionData.Arguments) do
  1197.                 paraString = paraString..v.Type.." "..v.Name
  1198.                 if i < #functionData.Arguments then
  1199.                     paraString = paraString..", "
  1200.                 end
  1201.             end
  1202.             paraString = paraString..")"
  1203.             return paraString
  1204.         end
  1205.            
  1206.         local function choice(name)
  1207.             onClick(name)
  1208.             hideMenu()
  1209.         end
  1210.        
  1211.         for i,name in pairs(choices) do
  1212.             local option = CreateRightClickMenuItem(name.ReturnType.." "..name.Name..GetParameters(name), function()
  1213.                 choice(name)
  1214.             end,2)
  1215.             option.Size = UDim2.new(1, 0, 0, 20)
  1216.             option.Position = UDim2.new(0, 0, 0, (i - 1) * DropDown.Height)
  1217.             option.ZIndex = menu.ZIndex
  1218.             option.Parent = menu
  1219.         end
  1220.     end
  1221.  
  1222.  
  1223.     showMenu()
  1224.  
  1225.    
  1226.     return frame
  1227. end
  1228.  
  1229. function CreateInsertObject()
  1230.     if not CurrentInsertObjectWindow then return end
  1231.     CurrentInsertObjectWindow.Visible = true
  1232.     if currentRightClickMenu and CurrentInsertObjectWindow.Visible then
  1233.         CurrentInsertObjectWindow.Position = UDim2.new(0,currentRightClickMenu.Position.X.Offset-currentRightClickMenu.Size.X.Offset-2,0,0)
  1234.     end
  1235.     if CurrentInsertObjectWindow.Visible then
  1236.         CurrentInsertObjectWindow.Parent = explorerPanel.Parent
  1237.     end
  1238. end
  1239.  
  1240. function CreateFunctionCaller()
  1241.     if CurrentFunctionCallerWindow then
  1242.         CurrentFunctionCallerWindow:Destroy()
  1243.         CurrentFunctionCallerWindow = nil
  1244.     end
  1245.     CurrentFunctionCallerWindow = CreateFunctionCallerMenu(
  1246.         GetFunctions(),
  1247.         "",
  1248.         false,
  1249.         function(option)
  1250.             CurrentFunctionCallerWindow:Destroy()
  1251.             CurrentFunctionCallerWindow = nil
  1252.             local list = SelectionVar():Get()
  1253.             for i = 1,#list do
  1254.                 pcall(function() Instance.new(option,list[i]) end)
  1255.             end
  1256.             print(option.Name .. " selected to be called. Function caller being added soon, please wait!")
  1257.             --CallFunction()
  1258.             DestroyRightClick()
  1259.         end
  1260.     )
  1261.     if currentRightClickMenu and CurrentFunctionCallerWindow then
  1262.         CurrentFunctionCallerWindow.Position = UDim2.new(0,currentRightClickMenu.Position.X.Offset-currentRightClickMenu.Size.X.Offset*1.5-2,0,0)
  1263.     end
  1264.     if CurrentFunctionCallerWindow then
  1265.         CurrentFunctionCallerWindow.Parent = explorerPanel.Parent
  1266.     end
  1267. end
  1268.  
  1269. function CreateRightClickMenuItem(text, onClick, insObj)
  1270.     local button = Instance.new("TextButton")
  1271.     button.Font = DropDown.Font
  1272.     button.FontSize = DropDown.FontSize
  1273.     button.TextColor3 = DropDown.TextColor
  1274.     button.TextXAlignment = DropDown.TextXAlignment
  1275.     button.BackgroundColor3 = DropDown.BackColor
  1276.     button.AutoButtonColor = false
  1277.     button.BorderSizePixel = 0
  1278.     button.Active = true
  1279.     button.Text = text
  1280.    
  1281.     if insObj == 1 then
  1282.         local newIcon = Icon(nil,ExplorerIndex[text] or 0)
  1283.         newIcon.Position = UDim2.new(0,0,0,2)
  1284.         newIcon.Size = UDim2.new(0,16,0,16)
  1285.         newIcon.IconMap.ZIndex = 5
  1286.         newIcon.Parent = button
  1287.         button.Text = "\t\t"..button.Text
  1288.     elseif insObj == 2 then
  1289.         button.FontSize = Enum.FontSize.Size11
  1290.     end
  1291.    
  1292.     button.MouseEnter:connect(function()
  1293.         button.TextColor3 = DropDown.TextColorOver
  1294.         button.BackgroundColor3 = DropDown.BackColorOver
  1295.         if not insObj and CurrentInsertObjectWindow then
  1296.             if CurrentInsertObjectWindow.Visible == false and button.Text == "Insert Object" then
  1297.                 CreateInsertObject()
  1298.             elseif CurrentInsertObjectWindow.Visible and button.Text ~= "Insert Object" then
  1299.                 CurrentInsertObjectWindow.Visible = false
  1300.             end
  1301.         end
  1302.         if not insObj then
  1303.             if CurrentFunctionCallerWindow and button.Text ~= "Call Function" then
  1304.                 CurrentFunctionCallerWindow:Destroy()
  1305.                 CurrentFunctionCallerWindow = nil
  1306.             elseif button.Text == "Call Function" then
  1307.                 CreateFunctionCaller()
  1308.             end
  1309.         end
  1310.     end)
  1311.     button.MouseLeave:connect(function()
  1312.         button.TextColor3 = DropDown.TextColor
  1313.         button.BackgroundColor3 = DropDown.BackColor
  1314.     end)
  1315.     button.MouseButton1Click:connect(function()
  1316.         button.TextColor3 = DropDown.TextColor
  1317.         button.BackgroundColor3 = DropDown.BackColor
  1318.         onClick(text)
  1319.     end)   
  1320.     return button
  1321. end
  1322.  
  1323. function CreateRightClickMenu(choices, currentChoice, readOnly, onClick)
  1324.     local frame = Instance.new("Frame")
  1325.     frame.Name = "DropDown"
  1326.     frame.Size = UDim2.new(0, 200, 1, 0)
  1327.     frame.BackgroundTransparency = 1
  1328.     frame.Active = true
  1329.    
  1330.     local menu = nil
  1331.     local arrow = nil
  1332.     local expanded = false
  1333.     local margin = DropDown.BorderSizePixel;
  1334.    
  1335.     --[[
  1336.     local button = Instance.new("TextButton")
  1337.     button.Font = Row.Font
  1338.     button.FontSize = Row.FontSize
  1339.     button.TextXAlignment = Row.TextXAlignment
  1340.     button.BackgroundTransparency = 1
  1341.     button.TextColor3 = Row.TextColor
  1342.     if readOnly then
  1343.         button.TextColor3 = Row.TextLockedColor
  1344.     end
  1345.     button.Text = currentChoice
  1346.     button.Size = UDim2.new(1, -2 * Styles.Margin, 1, 0)
  1347.     button.Position = UDim2.new(0, Styles.Margin, 0, 0)
  1348.     button.Parent = frame
  1349.     --]]
  1350.    
  1351.     local function hideMenu()
  1352.         expanded = false
  1353.         --showArrow(DropDown.ArrowColor)
  1354.         if frame then
  1355.             frame:Destroy()
  1356.             DestroyRightClick()
  1357.         end
  1358.     end
  1359.    
  1360.     local function showMenu()
  1361.         expanded = true
  1362.         menu = Instance.new("Frame")
  1363.         menu.Size = UDim2.new(0, 200, 0, #choices * DropDown.Height)
  1364.         menu.Position = UDim2.new(0, margin, 0, 5)
  1365.         menu.BackgroundTransparency = 0
  1366.         menu.BackgroundColor3 = DropDown.BackColor
  1367.         menu.BorderColor3 = DropDown.BorderColor
  1368.         menu.BorderSizePixel = DropDown.BorderSizePixel
  1369.         menu.Active = true
  1370.         menu.ZIndex = 5
  1371.         menu.Parent = frame
  1372.        
  1373.         --local parentFrameHeight = script.Parent.List.Size.Y.Offset
  1374.         --local rowHeight = mouse.Y
  1375.         --if (rowHeight + menu.Size.Y.Offset) > parentFrameHeight then
  1376.         --  menu.Position = UDim2.new(0, margin, 0, -1 * (#choices * DropDown.Height) - margin)
  1377.         --end
  1378.            
  1379.         local function choice(name)
  1380.             onClick(name)
  1381.             hideMenu()
  1382.         end
  1383.        
  1384.         for i,name in pairs(choices) do
  1385.             local option = CreateRightClickMenuItem(name, function()
  1386.                 choice(name)
  1387.             end)
  1388.             option.Size = UDim2.new(1, 0, 0, 20)
  1389.             option.Position = UDim2.new(0, 0, 0, (i - 1) * DropDown.Height)
  1390.             option.ZIndex = menu.ZIndex
  1391.             option.Parent = menu
  1392.         end
  1393.     end
  1394.  
  1395.  
  1396.     showMenu()
  1397.  
  1398.    
  1399.     return frame
  1400. end
  1401.  
  1402. function checkMouseInGui(gui)
  1403.     if gui == nil then return false end
  1404.     local guiPosition = gui.AbsolutePosition
  1405.     local guiSize = gui.AbsoluteSize   
  1406.    
  1407.     if mouse.X >= guiPosition.x and mouse.X <= guiPosition.x + guiSize.x and mouse.Y >= guiPosition.y and mouse.Y <= guiPosition.y + guiSize.y then
  1408.         return true
  1409.     else
  1410.         return false
  1411.     end
  1412. end
  1413.  
  1414. local clipboard = {}
  1415. local function delete(o)
  1416.     o.Parent = nil
  1417. end
  1418.  
  1419. local getTextWidth do
  1420.     local text = Create('TextLabel',{
  1421.         Name = "TextWidth";
  1422.         TextXAlignment = 'Left';
  1423.         TextYAlignment = 'Center';
  1424.         Font = FONT;
  1425.         FontSize = FONT_SIZE;
  1426.         Text = "";
  1427.         Position = UDim2.new(0,0,0,0);
  1428.         Size = UDim2.new(1,0,1,0);
  1429.         Visible = false;
  1430.         Parent = explorerPanel;
  1431.     })
  1432.     function getTextWidth(s)
  1433.         text.Text = s
  1434.         return text.TextBounds.x
  1435.     end
  1436. end
  1437.  
  1438. local nameScanned = false
  1439. -- Holds the game tree converted to a list.
  1440. local TreeList = {}
  1441. -- Matches objects to their tree node representation.
  1442. local NodeLookup = {}
  1443.  
  1444. local nodeWidth = 0
  1445.  
  1446. function filteringWorkspace()
  1447.     if explorerFilter.Text ~= "" and explorerFilter.Text ~= "Filter Workspace" then
  1448.         return true
  1449.     end
  1450.     return false
  1451. end
  1452.  
  1453. function lookForAName(obj,name)
  1454.     for i,v in pairs(obj:GetChildren()) do
  1455.         if string.find(string.lower(v.Name),string.lower(name)) then nameScanned = true end
  1456.         lookForAName(v,name)
  1457.     end
  1458. end
  1459.  
  1460. function scanName(obj)
  1461.     nameScanned = false
  1462.     if string.find(string.lower(obj.Name),string.lower(explorerFilter.Text)) then
  1463.         nameScanned = true
  1464.     else
  1465.         lookForAName(obj,explorerFilter.Text)
  1466.     end
  1467.     return nameScanned
  1468. end
  1469.  
  1470. local updateList,rawUpdateList,updateScroll,rawUpdateSize do
  1471.     local function r(t)
  1472.         for i = 1,#t do
  1473.             if not filteringWorkspace() or scanName(t[i].Object) then
  1474.                 TreeList[#TreeList+1] = t[i]
  1475.  
  1476.                 local w = (t[i].Depth)*(2+ENTRY_PADDING+GUI_SIZE) + 2 + ENTRY_SIZE + 4 + getTextWidth(t[i].Object.Name) + 4
  1477.                 if w > nodeWidth then
  1478.                     nodeWidth = w
  1479.                 end
  1480.                 if t[i].Expanded or filteringWorkspace() then
  1481.                     r(t[i])
  1482.                 end
  1483.             end
  1484.         end
  1485.     end
  1486.  
  1487.     function rawUpdateSize()
  1488.         scrollBarH.TotalSpace = nodeWidth
  1489.         scrollBarH.VisibleSpace = listFrame.AbsoluteSize.x
  1490.         scrollBarH:Update()
  1491.         local visible = scrollBarH:CanScrollDown() or scrollBarH:CanScrollUp()
  1492.         scrollBarH.GUI.Visible = visible
  1493.  
  1494.         listFrame.Size = UDim2.new(1,-GUI_SIZE,1,-GUI_SIZE*(visible and 1 or 0) - HEADER_SIZE)
  1495.  
  1496.         scrollBar.VisibleSpace = math.ceil(listFrame.AbsoluteSize.y/ENTRY_BOUND)
  1497.         scrollBar.GUI.Size = UDim2.new(0,GUI_SIZE,1,-GUI_SIZE*(visible and 1 or 0) - HEADER_SIZE)
  1498.        
  1499.         scrollBar.TotalSpace = #TreeList+1
  1500.         scrollBar:Update()
  1501.     end
  1502.  
  1503.     function rawUpdateList()
  1504.         -- Clear then repopulate the entire list. It appears to be fast enough.
  1505.         TreeList = {}
  1506.         nodeWidth = 0
  1507.         r(NodeLookup[workspace.Parent])
  1508.         rawUpdateSize()
  1509.     end
  1510.  
  1511.     -- Adding or removing large models will cause many updates to occur. We
  1512.     -- can reduce the number of updates by creating a delay, then dropping any
  1513.     -- updates that occur during the delay.
  1514.     local updatingList = false
  1515.     function updateList()
  1516.         if updatingList then return end
  1517.         updatingList = true
  1518.         wait(0.25)
  1519.         updatingList = false
  1520.         rawUpdateList()
  1521.     end
  1522.  
  1523.     local updatingScroll = false
  1524.     function updateScroll()
  1525.         if updatingScroll then return end
  1526.         updatingScroll = true
  1527.         wait(0.25)
  1528.         updatingScroll = false
  1529.         scrollBar:Update()
  1530.     end
  1531. end
  1532.  
  1533. local Selection do
  1534.     local bindGetSelection = explorerPanel:FindFirstChild("GetSelection")
  1535.     if not bindGetSelection then
  1536.         bindGetSelection = Create('BindableFunction',{Name = "GetSelection"})
  1537.         bindGetSelection.Parent = explorerPanel
  1538.     end
  1539.  
  1540.     local bindSetSelection = explorerPanel:FindFirstChild("SetSelection")
  1541.     if not bindSetSelection then
  1542.         bindSetSelection = Create('BindableFunction',{Name = "SetSelection"})
  1543.         bindSetSelection.Parent = explorerPanel
  1544.     end
  1545.  
  1546.     local bindSelectionChanged = explorerPanel:FindFirstChild("SelectionChanged")
  1547.     if not bindSelectionChanged then
  1548.         bindSelectionChanged = Create('BindableEvent',{Name = "SelectionChanged"})
  1549.         bindSelectionChanged.Parent = explorerPanel
  1550.     end
  1551.  
  1552.     local SelectionList = {}
  1553.     local SelectionSet = {}
  1554.     local Updates = true
  1555.     Selection = {
  1556.         Selected = SelectionSet;
  1557.         List = SelectionList;
  1558.     }
  1559.  
  1560.     local function addObject(object)
  1561.         -- list update
  1562.         local lupdate = false
  1563.         -- scroll update
  1564.         local supdate = false
  1565.  
  1566.         if not SelectionSet[object] then
  1567.             local node = NodeLookup[object]
  1568.             if node then
  1569.                 table.insert(SelectionList,object)
  1570.                 SelectionSet[object] = true
  1571.                 node.Selected = true
  1572.  
  1573.                 -- expand all ancestors so that selected node becomes visible
  1574.                 node = node.Parent
  1575.                 while node do
  1576.                     if not node.Expanded then
  1577.                         node.Expanded = true
  1578.                         lupdate = true
  1579.                     end
  1580.                     node = node.Parent
  1581.                 end
  1582.                 supdate = true
  1583.             end
  1584.         end
  1585.         return lupdate,supdate
  1586.     end
  1587.  
  1588.     function Selection:Set(objects)
  1589.         local lupdate = false
  1590.         local supdate = false
  1591.  
  1592.         if #SelectionList > 0 then
  1593.             for i = 1,#SelectionList do
  1594.                 local object = SelectionList[i]
  1595.                 local node = NodeLookup[object]
  1596.                 if node then
  1597.                     node.Selected = false
  1598.                     SelectionSet[object] = nil
  1599.                 end
  1600.             end
  1601.  
  1602.             SelectionList = {}
  1603.             Selection.List = SelectionList
  1604.             supdate = true
  1605.         end
  1606.  
  1607.         for i = 1,#objects do
  1608.             local l,s = addObject(objects[i])
  1609.             lupdate = l or lupdate
  1610.             supdate = s or supdate
  1611.         end
  1612.  
  1613.         if lupdate then
  1614.             rawUpdateList()
  1615.             supdate = true
  1616.         elseif supdate then
  1617.             scrollBar:Update()
  1618.         end
  1619.  
  1620.         if supdate then
  1621.             bindSelectionChanged:Fire()
  1622.         end
  1623.     end
  1624.  
  1625.     function Selection:Add(object)
  1626.         local l,s = addObject(object)
  1627.         if l then
  1628.             rawUpdateList()
  1629.             if Updates then
  1630.                 bindSelectionChanged:Fire()
  1631.             end
  1632.         elseif s then
  1633.             scrollBar:Update()
  1634.             if Updates then
  1635.                 bindSelectionChanged:Fire()
  1636.             end
  1637.         end
  1638.     end
  1639.    
  1640.     function Selection:StopUpdates()
  1641.         Updates = false
  1642.     end
  1643.    
  1644.     function Selection:ResumeUpdates()
  1645.         Updates = true
  1646.         bindSelectionChanged:Fire()
  1647.     end
  1648.  
  1649.     function Selection:Remove(object,noupdate)
  1650.         if SelectionSet[object] then
  1651.             local node = NodeLookup[object]
  1652.             if node then
  1653.                 node.Selected = false
  1654.                 SelectionSet[object] = nil
  1655.                 for i = 1,#SelectionList do
  1656.                     if SelectionList[i] == object then
  1657.                         table.remove(SelectionList,i)
  1658.                         break
  1659.                     end
  1660.                 end
  1661.  
  1662.                 if not noupdate then
  1663.                     scrollBar:Update()
  1664.                 end
  1665.                 bindSelectionChanged:Fire()
  1666.             end
  1667.         end
  1668.     end
  1669.  
  1670.     function Selection:Get()
  1671.         local list = {}
  1672.         for i = 1,#SelectionList do
  1673.             list[i] = SelectionList[i]
  1674.         end
  1675.         return list
  1676.     end
  1677.  
  1678.     bindSetSelection.OnInvoke = function(...)
  1679.         Selection:Set(...)
  1680.     end
  1681.  
  1682.     bindGetSelection.OnInvoke = function()
  1683.         return Selection:Get()
  1684.     end
  1685. end
  1686.  
  1687. function CreateCaution(title,msg)
  1688.     local newCaution = CautionWindow:Clone()
  1689.     newCaution.Title.Text = title
  1690.     newCaution.MainWindow.Desc.Text = msg
  1691.     newCaution.Parent = explorerPanel.Parent
  1692.     newCaution.Visible = true
  1693.     newCaution.MainWindow.Ok.MouseButton1Up:connect(function()
  1694.         newCaution:Destroy()
  1695.     end)
  1696. end
  1697.  
  1698. function CreateTableCaution(title,msg)
  1699.     if type(msg) ~= "table" then return CreateCaution(title,tostring(msg)) end
  1700.     local newCaution = TableCautionWindow:Clone()
  1701.     newCaution.Title.Text = title
  1702.    
  1703.     local TableList = newCaution.MainWindow.TableResults
  1704.     local TableTemplate = newCaution.MainWindow.TableTemplate
  1705.    
  1706.     for i,v in pairs(msg) do
  1707.         local newResult = TableTemplate:Clone()
  1708.         newResult.Type.Text = type(v)
  1709.         newResult.Value.Text = tostring(v)
  1710.         newResult.Position = UDim2.new(0,0,0,#TableList:GetChildren() * 20)
  1711.         newResult.Parent = TableList
  1712.         TableList.CanvasSize = UDim2.new(0,0,0,#TableList:GetChildren() * 20)
  1713.         newResult.Visible = true
  1714.     end
  1715.     newCaution.Parent = explorerPanel.Parent
  1716.     newCaution.Visible = true
  1717.     newCaution.MainWindow.Ok.MouseButton1Up:connect(function()
  1718.         newCaution:Destroy()
  1719.     end)
  1720. end
  1721.  
  1722. local function Split(str, delimiter)
  1723.     local start = 1
  1724.     local t = {}
  1725.     while true do
  1726.         local pos = string.find (str, delimiter, start, true)
  1727.         if not pos then
  1728.             break
  1729.         end
  1730.         table.insert (t, string.sub (str, start, pos - 1))
  1731.         start = pos + string.len (delimiter)
  1732.     end
  1733.     table.insert (t, string.sub (str, start))
  1734.     return t
  1735. end
  1736.  
  1737. local function ToValue(value,type)
  1738.     if type == "Vector2" then
  1739.         local list = Split(value,",")
  1740.         if #list < 2 then return nil end
  1741.         local x = tonumber(list[1]) or 0
  1742.         local y = tonumber(list[2]) or 0
  1743.         return Vector2.new(x,y)
  1744.     elseif type == "Vector3" then
  1745.         local list = Split(value,",")
  1746.         if #list < 3 then return nil end
  1747.         local x = tonumber(list[1]) or 0
  1748.         local y = tonumber(list[2]) or 0
  1749.         local z = tonumber(list[3]) or 0
  1750.         return Vector3.new(x,y,z)
  1751.     elseif type == "Color3" then
  1752.         local list = Split(value,",")
  1753.         if #list < 3 then return nil end
  1754.         local r = tonumber(list[1]) or 0
  1755.         local g = tonumber(list[2]) or 0
  1756.         local b = tonumber(list[3]) or 0
  1757.         return Color3.new(r/255,g/255, b/255)
  1758.     elseif type == "UDim2" then
  1759.         local list = Split(string.gsub(string.gsub(value, "{", ""),"}",""),",")
  1760.         if #list < 4 then return nil end
  1761.         local xScale = tonumber(list[1]) or 0
  1762.         local xOffset = tonumber(list[2]) or 0
  1763.         local yScale = tonumber(list[3]) or 0
  1764.         local yOffset = tonumber(list[4]) or 0
  1765.         return UDim2.new(xScale, xOffset, yScale, yOffset)
  1766.     elseif type == "Number" then
  1767.         return tonumber(value)
  1768.     elseif type == "String" then
  1769.         return value
  1770.     elseif type == "NumberRange" then
  1771.         local list = Split(value,",")
  1772.         if #list == 1 then
  1773.             if tonumber(list[1]) == nil then return nil end
  1774.             local newVal = tonumber(list[1]) or 0
  1775.             return NumberRange.new(newVal)
  1776.         end
  1777.         if #list < 2 then return nil end
  1778.         local x = tonumber(list[1]) or 0
  1779.         local y = tonumber(list[2]) or 0
  1780.         return NumberRange.new(x,y)
  1781.     elseif type == "Script" then
  1782.         local success,err = ypcall(function()
  1783.         _G.D_E_X_DONOTUSETHISPLEASE = nil
  1784.         loadstring(
  1785.             "_G.D_E_X_DONOTUSETHISPLEASE = "..value
  1786.         )()
  1787.         return _G.D_E_X_DONOTUSETHISPLEASE
  1788.         end)
  1789.         if err then
  1790.             return nil
  1791.         end
  1792.     else
  1793.         return nil
  1794.     end
  1795. end
  1796.  
  1797. function PromptRemoteCaller(inst)
  1798.     if CurrentRemoteWindow then
  1799.         CurrentRemoteWindow:Destroy()
  1800.         CurrentRemoteWindow = nil
  1801.     end
  1802.     CurrentRemoteWindow = RemoteWindow:Clone()
  1803.     CurrentRemoteWindow.Parent = explorerPanel.Parent
  1804.     CurrentRemoteWindow.Visible = true
  1805.    
  1806.     local displayValues = false
  1807.    
  1808.     local ArgumentList = CurrentRemoteWindow.MainWindow.Arguments
  1809.     local ArgumentTemplate = CurrentRemoteWindow.MainWindow.ArgumentTemplate
  1810.    
  1811.     if inst:IsA("RemoteEvent") then
  1812.         CurrentRemoteWindow.Title.Text = "Fire Event"
  1813.         CurrentRemoteWindow.MainWindow.Ok.Text = "Fire"
  1814.         CurrentRemoteWindow.MainWindow.DisplayReturned.Visible = false
  1815.         CurrentRemoteWindow.MainWindow.Desc2.Visible = false
  1816.     end
  1817.    
  1818.     local newArgument = ArgumentTemplate:Clone()
  1819.     newArgument.Parent = ArgumentList
  1820.     newArgument.Visible = true
  1821.     newArgument.Type.MouseButton1Down:connect(function()
  1822.         createDDown(newArgument.Type,function(choice)
  1823.             newArgument.Type.Text = choice
  1824.         end,"Script","Number","String","Color3","Vector3","Vector2","UDim2","NumberRange")
  1825.     end)
  1826.    
  1827.     CurrentRemoteWindow.MainWindow.Ok.MouseButton1Up:connect(function()
  1828.         if CurrentRemoteWindow and inst.Parent ~= nil then
  1829.             local MyArguments = {}
  1830.             for i,v in pairs(ArgumentList:GetChildren()) do
  1831.                 table.insert(MyArguments,ToValue(v.Value.Text,v.Type.Text))
  1832.             end
  1833.             if inst:IsA("RemoteFunction") then
  1834.                 if displayValues then
  1835.                     spawn(function()
  1836.                         local myResults = inst:InvokeServer(unpack(MyArguments))
  1837.                         if myResults then
  1838.                             CreateTableCaution("Remote Caller",myResults)
  1839.                         else
  1840.                             CreateCaution("Remote Caller","This remote did not return anything.")
  1841.                         end
  1842.                     end)
  1843.                 else
  1844.                     spawn(function()
  1845.                         inst:InvokeServer(unpack(MyArguments))
  1846.                     end)
  1847.                 end
  1848.             else
  1849.                 inst:FireServer(unpack(MyArguments))
  1850.             end
  1851.             CurrentRemoteWindow:Destroy()
  1852.             CurrentRemoteWindow = nil
  1853.         end
  1854.     end)
  1855.    
  1856.     CurrentRemoteWindow.MainWindow.Add.MouseButton1Up:connect(function()
  1857.         if CurrentRemoteWindow then
  1858.             local newArgument = ArgumentTemplate:Clone()
  1859.             newArgument.Position = UDim2.new(0,0,0,#ArgumentList:GetChildren() * 20)
  1860.             newArgument.Parent = ArgumentList
  1861.             ArgumentList.CanvasSize = UDim2.new(0,0,0,#ArgumentList:GetChildren() * 20)
  1862.             newArgument.Visible = true
  1863.             newArgument.Type.MouseButton1Down:connect(function()
  1864.                 createDDown(newArgument.Type,function(choice)
  1865.                     newArgument.Type.Text = choice
  1866.                 end,"Script","Number","String","Color3","Vector3","Vector2","UDim2","NumberRange")
  1867.             end)
  1868.         end
  1869.     end)
  1870.    
  1871.     CurrentRemoteWindow.MainWindow.Subtract.MouseButton1Up:connect(function()
  1872.         if CurrentRemoteWindow then
  1873.             if #ArgumentList:GetChildren() > 1 then
  1874.                 ArgumentList:GetChildren()[#ArgumentList:GetChildren()]:Destroy()
  1875.                 ArgumentList.CanvasSize = UDim2.new(0,0,0,#ArgumentList:GetChildren() * 20)
  1876.             end
  1877.         end
  1878.     end)
  1879.    
  1880.     CurrentRemoteWindow.MainWindow.Cancel.MouseButton1Up:connect(function()
  1881.         if CurrentRemoteWindow then
  1882.             CurrentRemoteWindow:Destroy()
  1883.             CurrentRemoteWindow = nil
  1884.         end
  1885.     end)
  1886.    
  1887.     CurrentRemoteWindow.MainWindow.DisplayReturned.MouseButton1Up:connect(function()
  1888.         if displayValues then
  1889.             displayValues = false
  1890.             CurrentRemoteWindow.MainWindow.DisplayReturned.enabled.Visible = false
  1891.         else
  1892.             displayValues = true
  1893.             CurrentRemoteWindow.MainWindow.DisplayReturned.enabled.Visible = true
  1894.         end
  1895.     end)
  1896. end
  1897. function DestroyRightClick()
  1898.     if currentRightClickMenu then
  1899.         currentRightClickMenu:Destroy()
  1900.         currentRightClickMenu = nil
  1901.     end
  1902.     if CurrentInsertObjectWindow and CurrentInsertObjectWindow.Visible then
  1903.         CurrentInsertObjectWindow.Visible = false
  1904.     end
  1905. end
  1906.  
  1907. function rightClickMenu(sObj)
  1908.     currentRightClickMenu = CreateRightClickMenu(
  1909.         {"Cut","Copy","Paste Into","Duplicate","Delete","Group","Ungroup","Select Children","Teleport To","Insert Part","Insert Object","Save Instance","Call Function","Call Remote"},
  1910.         "",
  1911.         false,
  1912.         function(option)
  1913.             if option == "Cut" then
  1914.                 if not Option.Modifiable then return end
  1915.                 clipboard = {}
  1916.                 local list = Selection.List
  1917.                 local cut = {}
  1918.                 for i = 1,#list do
  1919.                     local obj = list[i]:Clone()
  1920.                     if obj then
  1921.                         table.insert(clipboard,obj)
  1922.                         table.insert(cut,list[i])
  1923.                     end
  1924.                 end
  1925.                 for i = 1,#cut do
  1926.                     pcall(delete,cut[i])
  1927.                 end
  1928.             elseif option == "Copy" then
  1929.                 if not Option.Modifiable then return end
  1930.                 clipboard = {}
  1931.                 local list = Selection.List
  1932.                 for i = 1,#list do
  1933.                     table.insert(clipboard,list[i]:Clone())
  1934.                 end
  1935.             elseif option == "Paste Into" then
  1936.                 if not Option.Modifiable then return end
  1937.                 local parent = Selection.List[1] or workspace
  1938.                 for i = 1,#clipboard do
  1939.                     clipboard[i]:Clone().Parent = parent
  1940.                 end
  1941.             elseif option == "Duplicate" then
  1942.                 if not Option.Modifiable then return end
  1943.                 local list = Selection:Get()
  1944.                 for i = 1,#list do
  1945.                     list[i]:Clone().Parent = Selection.List[1].Parent or workspace
  1946.                 end
  1947.             elseif option == "Delete" then
  1948.                 if not Option.Modifiable then return end
  1949.                 local list = Selection:Get()
  1950.                 for i = 1,#list do
  1951.                     pcall(delete,list[i])
  1952.                 end
  1953.                 Selection:Set({})
  1954.             elseif option == "Group" then
  1955.                 if not Option.Modifiable then return end
  1956.                 local newModel = Instance.new("Model")
  1957.                 local list = Selection:Get()
  1958.                 newModel.Parent = Selection.List[1].Parent or workspace
  1959.                 for i = 1,#list do
  1960.                     list[i].Parent = newModel
  1961.                 end
  1962.                 Selection:Set({})
  1963.             elseif option == "Ungroup" then
  1964.                 if not Option.Modifiable then return end
  1965.                 local ungrouped = {}
  1966.                 local list = Selection:Get()
  1967.                 for i = 1,#list do
  1968.                     if list[i]:IsA("Model") then
  1969.                         for i2,v2 in pairs(list[i]:GetChildren()) do
  1970.                             v2.Parent = list[i].Parent or workspace
  1971.                             table.insert(ungrouped,v2)
  1972.                         end    
  1973.                         pcall(delete,list[i])          
  1974.                     end
  1975.                 end
  1976.                 Selection:Set({})
  1977.                 if SettingsRemote:Invoke("SelectUngrouped") then
  1978.                     for i,v in pairs(ungrouped) do
  1979.                         Selection:Add(v)
  1980.                     end
  1981.                 end
  1982.             elseif option == "Select Children" then
  1983.                 if not Option.Modifiable then return end
  1984.                 local list = Selection:Get()
  1985.                 Selection:Set({})
  1986.                 Selection:StopUpdates()
  1987.                 for i = 1,#list do
  1988.                     for i2,v2 in pairs(list[i]:GetChildren()) do
  1989.                         Selection:Add(v2)
  1990.                     end
  1991.                 end
  1992.                 Selection:ResumeUpdates()
  1993.             elseif option == "Teleport To" then
  1994.                 if not Option.Modifiable then return end
  1995.                 local list = Selection:Get()
  1996.                 for i = 1,#list do
  1997.                     if list[i]:IsA("BasePart") then
  1998.                         pcall(function()
  1999.                             Player.Character.HumanoidRootPart.CFrame = list[i].CFrame
  2000.                         end)
  2001.                         break
  2002.                     end
  2003.                 end
  2004.             elseif option == "Insert Part" then
  2005.                 if not Option.Modifiable then return end
  2006.                 local insertedParts = {}
  2007.                 local list = Selection:Get()
  2008.                 for i = 1,#list do
  2009.                     pcall(function()
  2010.                         local newPart = Instance.new("Part")
  2011.                         newPart.Parent = list[i]
  2012.                         newPart.CFrame = CFrame.new(Player.Character.Head.Position) + Vector3.new(0,3,0)
  2013.                         table.insert(insertedParts,newPart)
  2014.                     end)
  2015.                 end
  2016.             elseif option == "Call Remote" then
  2017.                 if not Option.Modifiable then return end
  2018.                 local list = Selection:Get()
  2019.                 for i = 1,#list do
  2020.                     if list[i]:IsA("RemoteFunction") or list[i]:IsA("RemoteEvent") then
  2021.                         PromptRemoteCaller(list[i])
  2022.                         break
  2023.                     end
  2024.                 end
  2025.             end
  2026.     end)
  2027.     currentRightClickMenu.Parent = explorerPanel.Parent
  2028.     currentRightClickMenu.Position = UDim2.new(0,mouse.X,0,mouse.Y)
  2029.     if currentRightClickMenu.AbsolutePosition.X + currentRightClickMenu.AbsoluteSize.X > explorerPanel.AbsolutePosition.X + explorerPanel.AbsoluteSize.X then
  2030.         currentRightClickMenu.Position = UDim2.new(0, explorerPanel.AbsolutePosition.X + explorerPanel.AbsoluteSize.X - currentRightClickMenu.AbsoluteSize.X, 0, mouse.Y)
  2031.     end
  2032. end
  2033.  
  2034. local function cancelReparentDrag()end
  2035. local function cancelSelectDrag()end
  2036. do
  2037.     local listEntries = {}
  2038.     local nameConnLookup = {}
  2039.  
  2040.     local mouseDrag = Create('ImageButton',{
  2041.         Name = "MouseDrag";
  2042.         Position = UDim2.new(-0.25,0,-0.25,0);
  2043.         Size = UDim2.new(1.5,0,1.5,0);
  2044.         Transparency = 1;
  2045.         AutoButtonColor = false;
  2046.         Active = true;
  2047.         ZIndex = 10;
  2048.     })
  2049.     local function dragSelect(last,add,button)
  2050.         local connDrag
  2051.         local conUp
  2052.  
  2053.         conDrag = mouseDrag.MouseMoved:connect(function(x,y)
  2054.             local pos = Vector2.new(x,y) - listFrame.AbsolutePosition
  2055.             local size = listFrame.AbsoluteSize
  2056.             if pos.x < 0 or pos.x > size.x or pos.y < 0 or pos.y > size.y then return end
  2057.  
  2058.             local i = math.ceil(pos.y/ENTRY_BOUND) + scrollBar.ScrollIndex
  2059.             -- Mouse may have made a large step, so interpolate between the
  2060.             -- last index and the current.
  2061.             for n = i<last and i or last, i>last and i or last do
  2062.                 local node = TreeList[n]
  2063.                 if node then
  2064.                     if add then
  2065.                         Selection:Add(node.Object)
  2066.                     else
  2067.                         Selection:Remove(node.Object)
  2068.                     end
  2069.                 end
  2070.             end
  2071.             last = i
  2072.         end)
  2073.  
  2074.         function cancelSelectDrag()
  2075.             mouseDrag.Parent = nil
  2076.             conDrag:disconnect()
  2077.             conUp:disconnect()
  2078.             function cancelSelectDrag()end
  2079.         end
  2080.  
  2081.         conUp = mouseDrag[button]:connect(cancelSelectDrag)
  2082.  
  2083.         mouseDrag.Parent = GetScreen(listFrame)
  2084.     end
  2085.  
  2086.     local function dragReparent(object,dragGhost,clickPos,ghostOffset)
  2087.         local connDrag
  2088.         local conUp
  2089.         local conUp2
  2090.  
  2091.         local parentIndex = nil
  2092.         local dragged = false
  2093.  
  2094.         local parentHighlight = Create('Frame',{
  2095.             Transparency = 1;
  2096.             Visible = false;
  2097.             Create('Frame',{
  2098.                 BorderSizePixel = 0;
  2099.                 BackgroundColor3 = Color3.new(0,0,0);
  2100.                 BackgroundTransparency = 0.1;
  2101.                 Position = UDim2.new(0,0,0,0);
  2102.                 Size = UDim2.new(1,0,0,1);
  2103.             });
  2104.             Create('Frame',{
  2105.                 BorderSizePixel = 0;
  2106.                 BackgroundColor3 = Color3.new(0,0,0);
  2107.                 BackgroundTransparency = 0.1;
  2108.                 Position = UDim2.new(1,0,0,0);
  2109.                 Size = UDim2.new(0,1,1,0);
  2110.             });
  2111.             Create('Frame',{
  2112.                 BorderSizePixel = 0;
  2113.                 BackgroundColor3 = Color3.new(0,0,0);
  2114.                 BackgroundTransparency = 0.1;
  2115.                 Position = UDim2.new(0,0,1,0);
  2116.                 Size = UDim2.new(1,0,0,1);
  2117.             });
  2118.             Create('Frame',{
  2119.                 BorderSizePixel = 0;
  2120.                 BackgroundColor3 = Color3.new(0,0,0);
  2121.                 BackgroundTransparency = 0.1;
  2122.                 Position = UDim2.new(0,0,0,0);
  2123.                 Size = UDim2.new(0,1,1,0);
  2124.             });
  2125.         })
  2126.         SetZIndex(parentHighlight,9)
  2127.  
  2128.         conDrag = mouseDrag.MouseMoved:connect(function(x,y)
  2129.             local dragPos = Vector2.new(x,y)
  2130.             if dragged then
  2131.                 local pos = dragPos - listFrame.AbsolutePosition
  2132.                 local size = listFrame.AbsoluteSize
  2133.  
  2134.                 parentIndex = nil
  2135.                 parentHighlight.Visible = false
  2136.                 if pos.x >= 0 and pos.x <= size.x and pos.y >= 0 and pos.y <= size.y + ENTRY_SIZE*2 then
  2137.                     local i = math.ceil(pos.y/ENTRY_BOUND-2)
  2138.                     local node = TreeList[i + scrollBar.ScrollIndex]
  2139.                     if node and node.Object ~= object and not object:IsAncestorOf(node.Object) then
  2140.                         parentIndex = i
  2141.                         local entry = listEntries[i]
  2142.                         if entry then
  2143.                             parentHighlight.Visible = true
  2144.                             parentHighlight.Position = UDim2.new(0,1,0,entry.AbsolutePosition.y-listFrame.AbsolutePosition.y)
  2145.                             parentHighlight.Size = UDim2.new(0,size.x-4,0,entry.AbsoluteSize.y)
  2146.                         end
  2147.                     end
  2148.                 end
  2149.  
  2150.                 dragGhost.Position = UDim2.new(0,dragPos.x+ghostOffset.x,0,dragPos.y+ghostOffset.y)
  2151.             elseif (clickPos-dragPos).magnitude > 8 then
  2152.                 dragged = true
  2153.                 SetZIndex(dragGhost,9)
  2154.                 dragGhost.IndentFrame.Transparency = 0.25
  2155.                 dragGhost.IndentFrame.EntryText.TextColor3 = GuiColor.TextSelected
  2156.                 dragGhost.Position = UDim2.new(0,dragPos.x+ghostOffset.x,0,dragPos.y+ghostOffset.y)
  2157.                 dragGhost.Parent = GetScreen(listFrame)
  2158.                 parentHighlight.Parent = listFrame
  2159.             end
  2160.         end)
  2161.  
  2162.         function cancelReparentDrag()
  2163.             mouseDrag.Parent = nil
  2164.             conDrag:disconnect()
  2165.             conUp:disconnect()
  2166.             conUp2:disconnect()
  2167.             dragGhost:Destroy()
  2168.             parentHighlight:Destroy()
  2169.             function cancelReparentDrag()end
  2170.         end
  2171.  
  2172.         local wasSelected = Selection.Selected[object]
  2173.         if not wasSelected and Option.Selectable then
  2174.             Selection:Set({object})
  2175.         end
  2176.  
  2177.         conUp = mouseDrag.MouseButton1Up:connect(function()
  2178.             cancelReparentDrag()
  2179.             if dragged then
  2180.                 if parentIndex then
  2181.                     local parentNode = TreeList[parentIndex + scrollBar.ScrollIndex]
  2182.                     if parentNode then
  2183.                         parentNode.Expanded = true
  2184.  
  2185.                         local parentObj = parentNode.Object
  2186.                         local function parent(a,b)
  2187.                             a.Parent = b
  2188.                         end
  2189.                         if Option.Selectable then
  2190.                             local list = Selection.List
  2191.                             for i = 1,#list do
  2192.                                 pcall(parent,list[i],parentObj)
  2193.                             end
  2194.                         else
  2195.                             pcall(parent,object,parentObj)
  2196.                         end
  2197.                     end
  2198.                 end
  2199.             else
  2200.                 -- do selection click
  2201.                 if wasSelected and Option.Selectable then
  2202.                     Selection:Set({})
  2203.                 end
  2204.             end
  2205.         end)
  2206.         conUp2 = mouseDrag.MouseButton2Down:connect(function()
  2207.             cancelReparentDrag()
  2208.         end)
  2209.  
  2210.         mouseDrag.Parent = GetScreen(listFrame)
  2211.     end
  2212.  
  2213.     local entryTemplate = Create('ImageButton',{
  2214.         Name = "Entry";
  2215.         Transparency = 1;
  2216.         AutoButtonColor = false;
  2217.         Position = UDim2.new(0,0,0,0);
  2218.         Size = UDim2.new(1,0,0,ENTRY_SIZE);
  2219.         Create('Frame',{
  2220.             Name = "IndentFrame";
  2221.             BackgroundTransparency = 1;
  2222.             BackgroundColor3 = GuiColor.Selected;
  2223.             BorderColor3 = GuiColor.BorderSelected;
  2224.             Position = UDim2.new(0,0,0,0);
  2225.             Size = UDim2.new(1,0,1,0);
  2226.             Create(Icon('ImageButton',0),{
  2227.                 Name = "Expand";
  2228.                 AutoButtonColor = false;
  2229.                 Position = UDim2.new(0,-GUI_SIZE,0.5,-GUI_SIZE/2);
  2230.                 Size = UDim2.new(0,GUI_SIZE,0,GUI_SIZE);
  2231.             });
  2232.             Create(Icon(nil,0),{
  2233.                 Name = "ExplorerIcon";
  2234.                 Position = UDim2.new(0,2+ENTRY_PADDING,0.5,-GUI_SIZE/2);
  2235.                 Size = UDim2.new(0,GUI_SIZE,0,GUI_SIZE);
  2236.             });
  2237.             Create('TextLabel',{
  2238.                 Name = "EntryText";
  2239.                 BackgroundTransparency = 1;
  2240.                 TextColor3 = GuiColor.Text;
  2241.                 TextXAlignment = 'Left';
  2242.                 TextYAlignment = 'Center';
  2243.                 Font = FONT;
  2244.                 FontSize = FONT_SIZE;
  2245.                 Text = "";
  2246.                 Position = UDim2.new(0,2+ENTRY_SIZE+4,0,0);
  2247.                 Size = UDim2.new(1,-2,1,0);
  2248.             });
  2249.         });
  2250.     })
  2251.  
  2252.     function scrollBar.UpdateCallback(self)
  2253.         for i = 1,self.VisibleSpace do
  2254.             local node = TreeList[i + self.ScrollIndex]
  2255.             if node then
  2256.                 local entry = listEntries[i]
  2257.                 if not entry then
  2258.                     entry = Create(entryTemplate:Clone(),{
  2259.                         Position = UDim2.new(0,2,0,ENTRY_BOUND*(i-1)+2);
  2260.                         Size = UDim2.new(0,nodeWidth,0,ENTRY_SIZE);
  2261.                         ZIndex = listFrame.ZIndex;
  2262.                     })
  2263.                     listEntries[i] = entry
  2264.  
  2265.                     local expand = entry.IndentFrame.Expand
  2266.                     expand.MouseEnter:connect(function()
  2267.                         local node = TreeList[i + self.ScrollIndex]
  2268.                         if #node > 0 then
  2269.                             if node.Expanded then
  2270.                                 Icon(expand,NODE_EXPANDED_OVER)
  2271.                             else
  2272.                                 Icon(expand,NODE_COLLAPSED_OVER)
  2273.                             end
  2274.                         end
  2275.                     end)
  2276.                     expand.MouseLeave:connect(function()
  2277.                         local node = TreeList[i + self.ScrollIndex]
  2278.                         if #node > 0 then
  2279.                             if node.Expanded then
  2280.                                 Icon(expand,NODE_EXPANDED)
  2281.                             else
  2282.                                 Icon(expand,NODE_COLLAPSED)
  2283.                             end
  2284.                         end
  2285.                     end)
  2286.                     expand.MouseButton1Down:connect(function()
  2287.                         local node = TreeList[i + self.ScrollIndex]
  2288.                         if #node > 0 then
  2289.                             node.Expanded = not node.Expanded
  2290.                             -- use raw update so the list updates instantly
  2291.                             rawUpdateList()
  2292.                         end
  2293.                     end)
  2294.  
  2295.                     entry.MouseButton1Down:connect(function(x,y)
  2296.                         local node = TreeList[i + self.ScrollIndex]
  2297.                         DestroyRightClick()
  2298.                         if GetAwaitRemote:Invoke() then
  2299.                             bindSetAwaiting:Fire(node.Object)
  2300.                             return
  2301.                         end
  2302.                        
  2303.                         if not HoldingShift then
  2304.                             lastSelectedNode = i + self.ScrollIndex
  2305.                         end
  2306.                        
  2307.                         if HoldingShift and not filteringWorkspace() then
  2308.                             if lastSelectedNode then
  2309.                                 if i + self.ScrollIndex - lastSelectedNode > 0 then
  2310.                                     Selection:StopUpdates()
  2311.                                     for i2 = 1, i + self.ScrollIndex - lastSelectedNode do
  2312.                                         local newNode = TreeList[lastSelectedNode + i2]
  2313.                                         if newNode then
  2314.                                             Selection:Add(newNode.Object)
  2315.                                         end
  2316.                                     end
  2317.                                     Selection:ResumeUpdates()
  2318.                                 else
  2319.                                     Selection:StopUpdates()
  2320.                                     for i2 = i + self.ScrollIndex - lastSelectedNode, 1 do
  2321.                                         local newNode = TreeList[lastSelectedNode + i2]
  2322.                                         if newNode then
  2323.                                             Selection:Add(newNode.Object)
  2324.                                         end
  2325.                                     end
  2326.                                     Selection:ResumeUpdates()
  2327.                                 end
  2328.                             end
  2329.                             return
  2330.                         end
  2331.                        
  2332.                         if HoldingCtrl then
  2333.                             if Selection.Selected[node.Object] then
  2334.                                 Selection:Remove(node.Object)
  2335.                             else
  2336.                                 Selection:Add(node.Object)
  2337.                             end
  2338.                             return
  2339.                         end
  2340.                         if Option.Modifiable then
  2341.                             local pos = Vector2.new(x,y)
  2342.                             dragReparent(node.Object,entry:Clone(),pos,entry.AbsolutePosition-pos)
  2343.                         elseif Option.Selectable then
  2344.                             if Selection.Selected[node.Object] then
  2345.                                 Selection:Set({})
  2346.                             else
  2347.                                 Selection:Set({node.Object})
  2348.                             end
  2349.                             dragSelect(i+self.ScrollIndex,true,'MouseButton1Up')
  2350.                         end
  2351.                     end)
  2352.  
  2353.                     entry.MouseButton2Down:connect(function()
  2354.                         if not Option.Selectable then return end
  2355.                        
  2356.                         DestroyRightClick()
  2357.                        
  2358.                         curSelect = entry
  2359.                        
  2360.                         local node = TreeList[i + self.ScrollIndex]
  2361.                        
  2362.                         if GetAwaitRemote:Invoke() then
  2363.                             bindSetAwaiting:Fire(node.Object)
  2364.                             return
  2365.                         end
  2366.                        
  2367.                         if not Selection.Selected[node.Object] then
  2368.                             Selection:Set({node.Object})
  2369.                         end
  2370.                     end)
  2371.                    
  2372.                    
  2373.                     entry.MouseButton2Up:connect(function()
  2374.                         if not Option.Selectable then return end
  2375.                        
  2376.                         local node = TreeList[i + self.ScrollIndex]
  2377.                        
  2378.                         if checkMouseInGui(curSelect) then
  2379.                             rightClickMenu(node.Object)
  2380.                         end
  2381.                     end)
  2382.  
  2383.                     entry.Parent = listFrame
  2384.                 end
  2385.  
  2386.                 entry.Visible = true
  2387.  
  2388.                 local object = node.Object
  2389.  
  2390.                 -- update expand icon
  2391.                 if #node == 0 then
  2392.                     entry.IndentFrame.Expand.Visible = false
  2393.                 elseif node.Expanded then
  2394.                     Icon(entry.IndentFrame.Expand,NODE_EXPANDED)
  2395.                     entry.IndentFrame.Expand.Visible = true
  2396.                 else
  2397.                     Icon(entry.IndentFrame.Expand,NODE_COLLAPSED)
  2398.                     entry.IndentFrame.Expand.Visible = true
  2399.                 end
  2400.  
  2401.                 -- update explorer icon
  2402.                 Icon(entry.IndentFrame.ExplorerIcon,ExplorerIndex[object.ClassName] or 0)
  2403.  
  2404.                 -- update indentation
  2405.                 local w = (node.Depth)*(2+ENTRY_PADDING+GUI_SIZE)
  2406.                 entry.IndentFrame.Position = UDim2.new(0,w,0,0)
  2407.                 entry.IndentFrame.Size = UDim2.new(1,-w,1,0)
  2408.  
  2409.                 -- update name change detection
  2410.                 if nameConnLookup[entry] then
  2411.                     nameConnLookup[entry]:disconnect()
  2412.                 end
  2413.                 local text = entry.IndentFrame.EntryText
  2414.                 text.Text = object.Name
  2415.                 nameConnLookup[entry] = node.Object.Changed:connect(function(p)
  2416.                     if p == 'Name' then
  2417.                         text.Text = object.Name
  2418.                     end
  2419.                 end)
  2420.  
  2421.                 -- update selection
  2422.                 entry.IndentFrame.Transparency = node.Selected and 0 or 1
  2423.                 text.TextColor3 = GuiColor[node.Selected and 'TextSelected' or 'Text']
  2424.  
  2425.                 entry.Size = UDim2.new(0,nodeWidth,0,ENTRY_SIZE)
  2426.             elseif listEntries[i] then
  2427.                 listEntries[i].Visible = false
  2428.             end
  2429.         end
  2430.         for i = self.VisibleSpace+1,self.TotalSpace do
  2431.             local entry = listEntries[i]
  2432.             if entry then
  2433.                 listEntries[i] = nil
  2434.                 entry:Destroy()
  2435.             end
  2436.         end
  2437.     end
  2438.  
  2439.     function scrollBarH.UpdateCallback(self)
  2440.         for i = 1,scrollBar.VisibleSpace do
  2441.             local node = TreeList[i + scrollBar.ScrollIndex]
  2442.             if node then
  2443.                 local entry = listEntries[i]
  2444.                 if entry then
  2445.                     entry.Position = UDim2.new(0,2 - scrollBarH.ScrollIndex,0,ENTRY_BOUND*(i-1)+2)
  2446.                 end
  2447.             end
  2448.         end
  2449.     end
  2450.  
  2451.     Connect(listFrame.Changed,function(p)
  2452.         if p == 'AbsoluteSize' then
  2453.             rawUpdateSize()
  2454.         end
  2455.     end)
  2456.  
  2457.     local wheelAmount = 6
  2458.     explorerPanel.MouseWheelForward:connect(function()
  2459.         if scrollBar.VisibleSpace - 1 > wheelAmount then
  2460.             scrollBar:ScrollTo(scrollBar.ScrollIndex - wheelAmount)
  2461.         else
  2462.             scrollBar:ScrollTo(scrollBar.ScrollIndex - scrollBar.VisibleSpace)
  2463.         end
  2464.     end)
  2465.     explorerPanel.MouseWheelBackward:connect(function()
  2466.         if scrollBar.VisibleSpace - 1 > wheelAmount then
  2467.             scrollBar:ScrollTo(scrollBar.ScrollIndex + wheelAmount)
  2468.         else
  2469.             scrollBar:ScrollTo(scrollBar.ScrollIndex + scrollBar.VisibleSpace)
  2470.         end
  2471.     end)
  2472. end
  2473.  
  2474. ----------------------------------------------------------------
  2475. ----------------------------------------------------------------
  2476. ----------------------------------------------------------------
  2477. ----------------------------------------------------------------
  2478. ---- Object detection
  2479.  
  2480. -- Inserts `v` into `t` at `i`. Also sets `Index` field in `v`.
  2481. local function insert(t,i,v)
  2482.     for n = #t,i,-1 do
  2483.         local v = t[n]
  2484.         v.Index = n+1
  2485.         t[n+1] = v
  2486.     end
  2487.     v.Index = i
  2488.     t[i] = v
  2489. end
  2490.  
  2491. -- Removes `i` from `t`. Also sets `Index` field in removed value.
  2492. local function remove(t,i)
  2493.     local v = t[i]
  2494.     for n = i+1,#t do
  2495.         local v = t[n]
  2496.         v.Index = n-1
  2497.         t[n-1] = v
  2498.     end
  2499.     t[#t] = nil
  2500.     v.Index = 0
  2501.     return v
  2502. end
  2503.  
  2504. -- Returns how deep `o` is in the tree.
  2505. local function depth(o)
  2506.     local d = -1
  2507.     while o do
  2508.         o = o.Parent
  2509.         d = d + 1
  2510.     end
  2511.     return d
  2512. end
  2513.  
  2514.  
  2515. local connLookup = {}
  2516.  
  2517. -- Returns whether a node would be present in the tree list
  2518. local function nodeIsVisible(node)
  2519.     local visible = true
  2520.     node = node.Parent
  2521.     while node and visible do
  2522.         visible = visible and node.Expanded
  2523.         node = node.Parent
  2524.     end
  2525.     return visible
  2526. end
  2527.  
  2528. -- Removes an object's tree node. Called when the object stops existing in the
  2529. -- game tree.
  2530. local function removeObject(object)
  2531.     local objectNode = NodeLookup[object]
  2532.     if not objectNode then
  2533.         return
  2534.     end
  2535.  
  2536.     local visible = nodeIsVisible(objectNode)
  2537.  
  2538.     Selection:Remove(object,true)
  2539.  
  2540.     local parent = objectNode.Parent
  2541.     remove(parent,objectNode.Index)
  2542.     NodeLookup[object] = nil
  2543.     connLookup[object]:disconnect()
  2544.     connLookup[object] = nil
  2545.  
  2546.     if visible then
  2547.         updateList()
  2548.     elseif nodeIsVisible(parent) then
  2549.         updateScroll()
  2550.     end
  2551. end
  2552.  
  2553. -- Moves a tree node to a new parent. Called when an existing object's parent
  2554. -- changes.
  2555. local function moveObject(object,parent)
  2556.     local objectNode = NodeLookup[object]
  2557.     if not objectNode then
  2558.         return
  2559.     end
  2560.  
  2561.     local parentNode = NodeLookup[parent]
  2562.     if not parentNode then
  2563.         return
  2564.     end
  2565.  
  2566.     local visible = nodeIsVisible(objectNode)
  2567.  
  2568.     remove(objectNode.Parent,objectNode.Index)
  2569.     objectNode.Parent = parentNode
  2570.  
  2571.     objectNode.Depth = depth(object)
  2572.     local function r(node,d)
  2573.         for i = 1,#node do
  2574.             node[i].Depth = d
  2575.             r(node[i],d+1)
  2576.         end
  2577.     end
  2578.     r(objectNode,objectNode.Depth+1)
  2579.  
  2580.     insert(parentNode,#parentNode+1,objectNode)
  2581.  
  2582.     if visible or nodeIsVisible(objectNode) then
  2583.         updateList()
  2584.     elseif nodeIsVisible(objectNode.Parent) then
  2585.         updateScroll()
  2586.     end
  2587. end
  2588.  
  2589. -- ScriptContext['/Libraries/LibraryRegistration/LibraryRegistration']
  2590. -- This RobloxLocked object lets me index its properties for some reason
  2591.  
  2592. local function check(object)
  2593.     return object.AncestryChanged
  2594. end
  2595.  
  2596. -- Creates a new tree node from an object. Called when an object starts
  2597. -- existing in the game tree.
  2598. local function addObject(object,noupdate)
  2599.     if script then
  2600.         -- protect against naughty RobloxLocked objects
  2601.         local s = pcall(check,object)
  2602.         if not s then
  2603.             return
  2604.         end
  2605.     end
  2606.  
  2607.     local parentNode = NodeLookup[object.Parent]
  2608.     if not parentNode then
  2609.         return
  2610.     end
  2611.  
  2612.     local objectNode = {
  2613.         Object = object;
  2614.         Parent = parentNode;
  2615.         Index = 0;
  2616.         Expanded = false;
  2617.         Selected = false;
  2618.         Depth = depth(object);
  2619.     }
  2620.  
  2621.     connLookup[object] = Connect(object.AncestryChanged,function(c,p)
  2622.         if c == object then
  2623.             if p == nil then
  2624.                 removeObject(c)
  2625.             else
  2626.                 moveObject(c,p)
  2627.             end
  2628.         end
  2629.     end)
  2630.  
  2631.     NodeLookup[object] = objectNode
  2632.     insert(parentNode,#parentNode+1,objectNode)
  2633.  
  2634.     if not noupdate then
  2635.         if nodeIsVisible(objectNode) then
  2636.             updateList()
  2637.         elseif nodeIsVisible(objectNode.Parent) then
  2638.             updateScroll()
  2639.         end
  2640.     end
  2641. end
  2642.  
  2643. do
  2644.     NodeLookup[workspace.Parent] = {
  2645.         Object = workspace.Parent;
  2646.         Parent = nil;
  2647.         Index = 0;
  2648.         Expanded = true;
  2649.     }
  2650.  
  2651.     Connect(game.DescendantAdded,addObject)
  2652.     Connect(game.DescendantRemoving,removeObject)
  2653.  
  2654.     local function get(o)
  2655.         return o:GetChildren()
  2656.     end
  2657.  
  2658.     local function r(o)
  2659.         local s,children = pcall(get,o)
  2660.         if s then
  2661.             for i = 1,#children do
  2662.                 addObject(children[i],true)
  2663.                 r(children[i])
  2664.             end
  2665.         end
  2666.     end
  2667.  
  2668.     r(workspace.Parent)
  2669.  
  2670.     scrollBar.VisibleSpace = math.ceil(listFrame.AbsoluteSize.y/ENTRY_BOUND)
  2671.     updateList()
  2672. end
  2673. local actionButtons do
  2674.     actionButtons = {}
  2675.  
  2676.     local totalActions = (4) + 1
  2677.     local currentActions = totalActions
  2678.     local function makeButton(icon,over,name)
  2679.         local button = Create(Icon('ImageButton',icon),{
  2680.             Name = name .. "Button";
  2681.             Visible = Option.Modifiable and Option.Selectable;
  2682.             Position = UDim2.new(1,-(GUI_SIZE+2)*currentActions+2,0.5,-GUI_SIZE/2);
  2683.             Size = UDim2.new(0,GUI_SIZE,0,GUI_SIZE);
  2684.             Parent = headerFrame;
  2685.         })
  2686.  
  2687.         local tipText = Create('TextLabel',{
  2688.             Name = name .. "Text";
  2689.             Text = name;
  2690.             Visible = false;
  2691.             BackgroundTransparency = 1;
  2692.             TextXAlignment = 'Right';
  2693.             Font = FONT;
  2694.             FontSize = FONT_SIZE;
  2695.             Position = UDim2.new(0,0,0,0);
  2696.             Size = UDim2.new(1,-(GUI_SIZE+2)*totalActions,1,0);
  2697.             Parent = headerFrame;
  2698.         })
  2699.  
  2700.  
  2701.         button.MouseEnter:connect(function()
  2702.             Icon(button,over)
  2703.             tipText.Visible = true
  2704.         end)
  2705.         button.MouseLeave:connect(function()
  2706.             Icon(button,icon)
  2707.             tipText.Visible = false
  2708.         end)
  2709.  
  2710.         currentActions = currentActions - 1
  2711.         actionButtons[#actionButtons+1] = button
  2712.         return button
  2713.     end
  2714.  
  2715.     local clipboard = {}
  2716.     local function delete(o)
  2717.         o.Parent = nil
  2718.     end
  2719.  
  2720.     --[[
  2721.     -- CUT
  2722.     makeButton(ACTION_CUT,ACTION_CUT_OVER,"Cut").MouseButton1Click:connect(function()
  2723.         if not Option.Modifiable then return end
  2724.         clipboard = {}
  2725.         local list = Selection.List
  2726.         local cut = {}
  2727.         for i = 1,#list do
  2728.             local obj = list[i]:Clone()
  2729.             if obj then
  2730.                 table.insert(clipboard,obj)
  2731.                 table.insert(cut,list[i])
  2732.             end
  2733.         end
  2734.         for i = 1,#cut do
  2735.             pcall(delete,cut[i])
  2736.         end
  2737.     end)
  2738.  
  2739.     -- COPY
  2740.     makeButton(ACTION_COPY,ACTION_COPY_OVER,"Copy").MouseButton1Click:connect(function()
  2741.         if not Option.Modifiable then return end
  2742.         clipboard = {}
  2743.         local list = Selection.List
  2744.         for i = 1,#list do
  2745.             table.insert(clipboard,list[i]:Clone())
  2746.         end
  2747.     end)
  2748.  
  2749.     -- PASTE
  2750.     makeButton(ACTION_PASTE,ACTION_PASTE_OVER,"Paste").MouseButton1Click:connect(function()
  2751.         if not Option.Modifiable then return end
  2752.         local parent = Selection.List[1] or workspace
  2753.         for i = 1,#clipboard do
  2754.             clipboard[i]:Clone().Parent = parent
  2755.         end
  2756.     end)
  2757.  
  2758.     -- DELETE
  2759.     makeButton(ACTION_DELETE,ACTION_DELETE_OVER,"Delete").MouseButton1Click:connect(function()
  2760.         if not Option.Modifiable then return end
  2761.         local list = Selection:Get()
  2762.         for i = 1,#list do
  2763.             pcall(delete,list[i])
  2764.         end
  2765.         Selection:Set({})
  2766.     end)
  2767.     ]]--
  2768.  
  2769.     -- SORT
  2770.     -- local actionSort = makeButton(ACTION_SORT,ACTION_SORT_OVER,"Sort")
  2771. end
  2772.  
  2773. ----------------------------------------------------------------
  2774. ----------------------------------------------------------------
  2775. ----------------------------------------------------------------
  2776. ----------------------------------------------------------------
  2777. ---- Option Bindables
  2778.  
  2779. do
  2780.     local optionCallback = {
  2781.         Modifiable = function(value)
  2782.             for i = 1,#actionButtons do
  2783.                 actionButtons[i].Visible = value and Option.Selectable
  2784.             end
  2785.             cancelReparentDrag()
  2786.         end;
  2787.         Selectable = function(value)
  2788.             for i = 1,#actionButtons do
  2789.                 actionButtons[i].Visible = value and Option.Modifiable
  2790.             end
  2791.             cancelSelectDrag()
  2792.             Selection:Set({})
  2793.         end;
  2794.     }
  2795.  
  2796.     local bindSetOption = explorerPanel:FindFirstChild("SetOption")
  2797.     if not bindSetOption then
  2798.         bindSetOption = Create('BindableFunction',{Name = "SetOption"})
  2799.         bindSetOption.Parent = explorerPanel
  2800.     end
  2801.  
  2802.     bindSetOption.OnInvoke = function(optionName,value)
  2803.         if optionCallback[optionName] then
  2804.             Option[optionName] = value
  2805.             optionCallback[optionName](value)
  2806.         end
  2807.     end
  2808.  
  2809.     local bindGetOption = explorerPanel:FindFirstChild("GetOption")
  2810.     if not bindGetOption then
  2811.         bindGetOption = Create('BindableFunction',{Name = "GetOption"})
  2812.         bindGetOption.Parent = explorerPanel
  2813.     end
  2814.  
  2815.     bindGetOption.OnInvoke = function(optionName)
  2816.         if optionName then
  2817.             return Option[optionName]
  2818.         else
  2819.             local options = {}
  2820.             for k,v in pairs(Option) do
  2821.                 options[k] = v
  2822.             end
  2823.             return options
  2824.         end
  2825.     end
  2826. end
  2827.  
  2828. function SelectionVar()
  2829.     return Selection
  2830. end
  2831.  
  2832. Input.InputBegan:connect(function(key)
  2833.     if key.KeyCode == Enum.KeyCode.LeftControl then
  2834.         HoldingCtrl = true
  2835.     end
  2836.     if key.KeyCode == Enum.KeyCode.LeftShift then
  2837.         HoldingShift = true
  2838.     end
  2839. end)
  2840.  
  2841. Input.InputEnded:connect(function(key)
  2842.     if key.KeyCode == Enum.KeyCode.LeftControl then
  2843.         HoldingCtrl = false
  2844.     end
  2845.     if key.KeyCode == Enum.KeyCode.LeftShift then
  2846.         HoldingShift = false
  2847.     end
  2848. end)
  2849.  
  2850. while RbxApi == nil do
  2851.     RbxApi = GetApiRemote:Invoke()
  2852.     wait()
  2853. end
  2854.  
  2855. explorerFilter.Changed:connect(function(prop)
  2856.     if prop == "Text" then
  2857.         rawUpdateList()
  2858.     end
  2859. end)
  2860.  
  2861. CurrentInsertObjectWindow = CreateInsertObjectMenu(
  2862.     GetClasses(),
  2863.     "",
  2864.     false,
  2865.     function(option)
  2866.         CurrentInsertObjectWindow.Visible = false
  2867.         local list = SelectionVar():Get()
  2868.         for i = 1,#list do
  2869.             pcall(function() Instance.new(option,list[i]) end)
  2870.         end
  2871.         DestroyRightClick()
  2872.     end
  2873. )
Add Comment
Please, Sign In to add comment