Advertisement
okban

test

Jan 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 82.60 KB | None | 0 0
  1. function sandbox(var,func)
  2. local env = getfenv(func)
  3. local newenv = setmetatable({},{
  4. __index = function(self,k)
  5. if k=="script" then
  6. return var
  7. else
  8. return env[k]
  9. end
  10. end,
  11. })
  12. setfenv(func,newenv)
  13. return func
  14. end
  15. cors = {}
  16. mas = Instance.new("Model",game:GetService("Lighting"))
  17. ScreenGui0 = Instance.new("ScreenGui")
  18. Frame1 = Instance.new("Frame")
  19. Frame2 = Instance.new("Frame")
  20. TextLabel3 = Instance.new("TextLabel")
  21. Frame4 = Instance.new("Frame")
  22. ImageButton5 = Instance.new("ImageButton")
  23. Frame6 = Instance.new("Frame")
  24. Frame7 = Instance.new("Frame")
  25. Frame8 = Instance.new("Frame")
  26. Frame9 = Instance.new("Frame")
  27. Frame10 = Instance.new("Frame")
  28. ImageButton11 = Instance.new("ImageButton")
  29. Frame12 = Instance.new("Frame")
  30. Frame13 = Instance.new("Frame")
  31. Frame14 = Instance.new("Frame")
  32. Frame15 = Instance.new("Frame")
  33. Frame16 = Instance.new("Frame")
  34. ImageButton17 = Instance.new("ImageButton")
  35. ImageButton18 = Instance.new("ImageButton")
  36. Frame19 = Instance.new("Frame")
  37. Frame20 = Instance.new("Frame")
  38. Frame21 = Instance.new("Frame")
  39. Frame22 = Instance.new("Frame")
  40. LocalScript23 = Instance.new("LocalScript")
  41. Frame24 = Instance.new("Frame")
  42. TextLabel25 = Instance.new("TextLabel")
  43. Frame26 = Instance.new("Frame")
  44. Frame27 = Instance.new("Frame")
  45. TextLabel28 = Instance.new("TextLabel")
  46. TextLabel29 = Instance.new("TextLabel")
  47. Frame30 = Instance.new("Frame")
  48. Frame31 = Instance.new("Frame")
  49. TextLabel32 = Instance.new("TextLabel")
  50. TextBox33 = Instance.new("TextBox")
  51. ImageButton34 = Instance.new("ImageButton")
  52. Frame35 = Instance.new("Frame")
  53. LocalScript36 = Instance.new("LocalScript")
  54. BindableEvent37 = Instance.new("BindableEvent")
  55. BindableFunction38 = Instance.new("BindableFunction")
  56. BindableFunction39 = Instance.new("BindableFunction")
  57. BindableFunction40 = Instance.new("BindableFunction")
  58. BindableFunction41 = Instance.new("BindableFunction")
  59. TextLabel42 = Instance.new("TextLabel")
  60. TextLabel43 = Instance.new("TextLabel")
  61. Frame44 = Instance.new("Frame")
  62. ScreenGui0.Parent = mas
  63. Frame1.Name = "PropertiesPanel"
  64. Frame1.Parent = ScreenGui0
  65. Frame1.Transparency = 0.10000000149012
  66. Frame1.Size = UDim2.new(0, 300, 0.5, -50)
  67. Frame1.Position = UDim2.new(1, -615, 0, 200)
  68. Frame1.Active = true
  69. Frame1.BackgroundColor3 = Color3.new(1, 1, 1)
  70. Frame1.BackgroundTransparency = 0.10000000149012
  71. Frame1.BorderColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  72. Frame1.Draggable = true
  73. Frame2.Name = "List"
  74. Frame2.Parent = Frame1
  75. Frame2.Transparency = 1
  76. Frame2.Size = UDim2.new(1, -16, 1, -18)
  77. Frame2.Position = UDim2.new(0, 0, 0, 18)
  78. Frame2.BackgroundTransparency = 1
  79. Frame2.ClipsDescendants = true
  80. TextLabel3.Name = "TextWidth"
  81. TextLabel3.Parent = Frame1
  82. TextLabel3.Size = UDim2.new(1, 0, 1, 0)
  83. TextLabel3.Text = "TweenService"
  84. TextLabel3.Visible = false
  85. TextLabel3.Font = Enum.Font.SourceSans
  86. TextLabel3.FontSize = Enum.FontSize.Size14
  87. TextLabel3.TextXAlignment = Enum.TextXAlignment.Left
  88. Frame4.Name = "ScrollFrame"
  89. Frame4.Parent = Frame1
  90. Frame4.Transparency = 1
  91. Frame4.Size = UDim2.new(0, 16, 1, -18)
  92. Frame4.Position = UDim2.new(1, -16, 0, 18)
  93. Frame4.BackgroundTransparency = 1
  94. ImageButton5.Name = "ScrollDown"
  95. ImageButton5.Parent = Frame4
  96. ImageButton5.Size = UDim2.new(0, 16, 0, 16)
  97. ImageButton5.Position = UDim2.new(0, 0, 1, -16)
  98. ImageButton5.BackgroundColor3 = Color3.new(0.866667, 0.866667, 0.866667)
  99. ImageButton5.BorderColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  100. Frame6.Name = "Arrow Graphic"
  101. Frame6.Parent = ImageButton5
  102. Frame6.Transparency = 1
  103. Frame6.Size = UDim2.new(0, 8, 0, 8)
  104. Frame6.Position = UDim2.new(0.5, -4, 0.5, -4)
  105. Frame6.BackgroundTransparency = 1
  106. Frame6.BorderSizePixel = 0
  107. Frame7.Name = "Graphic"
  108. Frame7.Parent = Frame6
  109. Frame7.Size = UDim2.new(0.25, 0, 0.125, 0)
  110. Frame7.Position = UDim2.new(0.375, 0, 0.625, 0)
  111. Frame7.BackgroundColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  112. Frame7.BorderSizePixel = 0
  113. Frame8.Name = "Graphic"
  114. Frame8.Parent = Frame6
  115. Frame8.Size = UDim2.new(0.5, 0, 0.125, 0)
  116. Frame8.Position = UDim2.new(0.25, 0, 0.5, 0)
  117. Frame8.BackgroundColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  118. Frame8.BorderSizePixel = 0
  119. Frame9.Name = "Graphic"
  120. Frame9.Parent = Frame6
  121. Frame9.Size = UDim2.new(0.75, 0, 0.125, 0)
  122. Frame9.Position = UDim2.new(0.125, 0, 0.375, 0)
  123. Frame9.BackgroundColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  124. Frame9.BorderSizePixel = 0
  125. Frame10.Name = "Graphic"
  126. Frame10.Parent = Frame6
  127. Frame10.Size = UDim2.new(1, 0, 0.125, 0)
  128. Frame10.Position = UDim2.new(0, 0, 0.25, 0)
  129. Frame10.BackgroundColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  130. Frame10.BorderSizePixel = 0
  131. ImageButton11.Name = "ScrollUp"
  132. ImageButton11.Parent = Frame4
  133. ImageButton11.Size = UDim2.new(0, 16, 0, 16)
  134. ImageButton11.Active = false
  135. ImageButton11.BackgroundColor3 = Color3.new(0.866667, 0.866667, 0.866667)
  136. ImageButton11.BorderColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  137. ImageButton11.AutoButtonColor = false
  138. Frame12.Name = "Arrow Graphic"
  139. Frame12.Parent = ImageButton11
  140. Frame12.Transparency = 1
  141. Frame12.Size = UDim2.new(0, 8, 0, 8)
  142. Frame12.Position = UDim2.new(0.5, -4, 0.5, -4)
  143. Frame12.BackgroundTransparency = 1
  144. Frame12.BorderSizePixel = 0
  145. Frame13.Name = "Graphic"
  146. Frame13.Parent = Frame12
  147. Frame13.Transparency = 0.69999998807907
  148. Frame13.Size = UDim2.new(0.25, 0, 0.125, 0)
  149. Frame13.Position = UDim2.new(0.375, 0, 0.25, 0)
  150. Frame13.BackgroundColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  151. Frame13.BackgroundTransparency = 0.69999998807907
  152. Frame13.BorderSizePixel = 0
  153. Frame14.Name = "Graphic"
  154. Frame14.Parent = Frame12
  155. Frame14.Transparency = 0.69999998807907
  156. Frame14.Size = UDim2.new(0.5, 0, 0.125, 0)
  157. Frame14.Position = UDim2.new(0.25, 0, 0.375, 0)
  158. Frame14.BackgroundColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  159. Frame14.BackgroundTransparency = 0.69999998807907
  160. Frame14.BorderSizePixel = 0
  161. Frame15.Name = "Graphic"
  162. Frame15.Parent = Frame12
  163. Frame15.Transparency = 0.69999998807907
  164. Frame15.Size = UDim2.new(0.75, 0, 0.125, 0)
  165. Frame15.Position = UDim2.new(0.125, 0, 0.5, 0)
  166. Frame15.BackgroundColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  167. Frame15.BackgroundTransparency = 0.69999998807907
  168. Frame15.BorderSizePixel = 0
  169. Frame16.Name = "Graphic"
  170. Frame16.Parent = Frame12
  171. Frame16.Transparency = 0.69999998807907
  172. Frame16.Size = UDim2.new(1, 0, 0.125, 0)
  173. Frame16.Position = UDim2.new(0, 0, 0.625, 0)
  174. Frame16.BackgroundColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  175. Frame16.BackgroundTransparency = 0.69999998807907
  176. Frame16.BorderSizePixel = 0
  177. ImageButton17.Name = "ScrollBar"
  178. ImageButton17.Parent = Frame4
  179. ImageButton17.Size = UDim2.new(1, 0, 1, -32)
  180. ImageButton17.Position = UDim2.new(0, 0, 0, 16)
  181. ImageButton17.BackgroundColor3 = Color3.new(0.94902, 0.94902, 0.94902)
  182. ImageButton17.BorderColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  183. ImageButton17.AutoButtonColor = false
  184. ImageButton18.Name = "ScrollThumb"
  185. ImageButton18.Parent = ImageButton17
  186. ImageButton18.Size = UDim2.new(0, 16, 0, 75)
  187. ImageButton18.BackgroundColor3 = Color3.new(0.866667, 0.866667, 0.866667)
  188. ImageButton18.BorderColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  189. ImageButton18.Draggable = true
  190. ImageButton18.AutoButtonColor = false
  191. Frame19.Name = "Grip Graphic"
  192. Frame19.Parent = ImageButton18
  193. Frame19.Transparency = 1
  194. Frame19.Size = UDim2.new(0, 6, 0, 6)
  195. Frame19.Position = UDim2.new(0.5, -3, 0.5, -3)
  196. Frame19.BackgroundTransparency = 1
  197. Frame19.BorderSizePixel = 0
  198. Frame20.Parent = Frame19
  199. Frame20.Size = UDim2.new(1, 0, 0.166666672, 0)
  200. Frame20.BorderSizePixel = 0
  201. Frame21.Parent = Frame19
  202. Frame21.Size = UDim2.new(1, 0, 0.166666672, 0)
  203. Frame21.Position = UDim2.new(0, 0, 0.333333343, 0)
  204. Frame21.BorderSizePixel = 0
  205. Frame22.Parent = Frame19
  206. Frame22.Size = UDim2.new(1, 0, 0.166666672, 0)
  207. Frame22.Position = UDim2.new(0, 0, 0.666666687, 0)
  208. Frame22.BorderSizePixel = 0
  209. LocalScript23.Name = "Properties"
  210. LocalScript23.Parent = Frame1
  211. table.insert(cors,sandbox(LocalScript23,function()
  212. local Explorer = script.Parent.Parent:WaitForChild("ExplorerPanel")
  213. Explorer:WaitForChild("List")
  214. Explorer:WaitForChild("SelectionChanged")
  215. local Properties = script.Parent
  216. local Studio = script.Parent.Parent
  217.  
  218. function Recursive(Parent,Do)
  219. for _,v in pairs(Parent:GetChildren())do
  220. Do(v)
  221. Recursive(v,Do)
  222. end
  223. end
  224.  
  225. Recursive(Studio,function(child)
  226. if child:IsA("GuiObject") then
  227. child.ZIndex = 10
  228. end
  229. end)
  230. Studio.ChildAdded:connect(function(child)
  231. if child:IsA("GuiObject") then
  232. child.ZIndex = 10
  233. end
  234. end)
  235. Studio.DescendantAdded:connect(function(child) -- same as above? idk
  236. if child:IsA("GuiObject") then
  237. child.ZIndex = 10
  238. end
  239. end)
  240.  
  241. wait(2)
  242.  
  243. local Alphabet = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
  244.  
  245. local Properties_TBL = {"AbsolutePosition","AbsoluteSize","AccountAge","AccountAgeReplicate",
  246. "Active","Adornee","AllowAmbientOcclusion","AllowTeamChangeOnTouch","AluminumQuality",
  247. "AlwaysOnTop","Ambient","AmbientReverb","Anchored","Angularvelocity","AnimationId",
  248. "Archivable","AreHingesDetected","AttachmentForward","AttachmentPoint","AttachmentPos",
  249. "AttachmentRight","AttachmentUp","AutoAssignable","AutoButtonColor","AutoColorCharacters",
  250. "AvailablePhysicalMemory","Axes","BackgroundColor","BackgroundColor3","BackgroundTransparency",
  251. "BaseTextureId","BaseUrl","Bevel","Roundness","BinType","BlastPressure","BlastRadius",
  252. "BodyColor","BodyPart","BorderColor","BorderColor3","BorderSizePixel","BrickColor",
  253. "Brightness","Browsable","BubbleChat","BubbleChatLifetime","BubbleChatMaxBubbles",
  254. "Bulge","Button1DownConnectionCount","Button1UpConnectionCount","Button2DownConnectionCount",
  255. "Button2UpConnectionCount","C0","C1","CameraMode","CameraSubject","CameraType",
  256. "CanBeDropped","CanCollide","CartoonFactor","CastShadows","CelestialBodiesShown",
  257. "CFrame","Cframe","Character","CharacterAppearance","CharacterAutoLoads","ChatScrollLength",
  258. "ClassicChat","ClassName","ClearTextOnFocus","ClipsDescendants","CollisionSoundEnabled",
  259. "CollisionSoundVolume","Color","Bottom","Top","ConstrainedValue","ControllingHumanoid",
  260. "ControlMode","ConversationDistance","CoordinateFrame","CorrodedMetalQuality","CPU",
  261. "CpuCount","CpuSpeed","CreatorId","CreatorType","CurrentAngle","CurrentCamera",
  262. "CycleOffset","D","DataCap","DataComplexity","DataComplexityLimit","DataCost",
  263. "DataReady","Deprecated","DeselectedConnectionCount","DesiredAngle","DiamondPlateQuality",
  264. "Disabled","DistanceFactor","DistributedGameTime","DopplerScale","Draggable","DraggingV1",
  265. "Duration","EditorFont","EditorFontSize","EditorTabWidth","ElapsedTime","Elasticity",
  266. "Enabled","ExplosionType","ExtentsOffset","F0","F1","F2","F3","Face","FaceId","Faces",
  267. "FieldOfView","Focus","FogColor","FogEnd","FogStart","Font","FontSize","Force","FormFactor",
  268. "Friction","From","GearGenreSetting","Genre","GeographicLatitude","GfxCard","Graphic",
  269. "GrassQuality","Grip","GripForward","GripPos","GripRight","GripUp","Guest","HeadsUpDisplay",
  270. "Health","Heat","Hit","Humanoid","IceQuality","Icon","IdleConnectionCount","Image",
  271. "InitialPrompt","InOut","InUse","IsPaused","IsPlaying","JobId","Jump","KeyDownConnectionCount",
  272. "KeyUpConnectionCount","LeftLeg","LeftRight","LinkedSource","LocalPlayer","Location",
  273. "Locked","LODX","LODY","Looped","Material","MaxActivationDistance","MaxCollisionSounds",
  274. "MaxExtents","MaxForce","MaxHealth","MaxItems","MaxPlayers","MaxSpeed","MaxThrust",
  275. "MaxTorque","MaxValue","MaxVelocity","MembershipType","MembershipTypeReplicate","MeshId",
  276. "MeshType","MinValue","Modal","MouseButton1ClickConnectionCount","MouseButton1DownConnectionCount",
  277. "MouseButton1UpConnectionCount","MouseButton2ClickConnectionCount","MouseButton2DownConnectionCount",
  278. "MouseButton2UpConnectionCount","MouseDelta","MouseDragConnectionCount","MouseEnterConnectionCount",
  279. "MouseHit","MouseLeaveConnectionCount","MouseLock","MouseMovedConnectionCount","MouseTarget",
  280. "MouseTargetFilter","MouseTargetSurface","MoveConnectionCount","MoveState","MultiLine","Name",
  281. "NameOcclusion","NetworkOwner","Neutral","NumPlayers","Offset","Opacity","Origin","OsPlatform",
  282. "OsVer","OverlayTextureId","P","PantsTemplate","ParamA","ParamB","Parent","Part","Part0",
  283. "Part1","Pitch","PixelShaderModel","PlaceId","PlasticQuality","PlatformStand","PlayCount",
  284. "PlayerToHideFrom","PlayOnRemove","Point","Port","Position","Preliminary","PrimaryPart",
  285. "PrivateWorkingSetBytes","Purpose","RAM","Reflectance","ReplicatedSelectedConnectionCount",
  286. "ResizeableFaces","ResizeIncrement","Resolution","ResponseDialog","RightLeg","RiseVelocity",
  287. "RobloxLocked","RobloxVersion","RolloffScale","RotVelocity","Scale","Score","ScriptsDisabled",
  288. "SecondaryColor","Selected","ShadowColor","Shape","Shiny","ShirtTemplate","ShowDeprecatedObjects",
  289. "ShowDevelopmentGui","ShowPreliminaryObjects","Sides","Sit","Size","SizeConstraint",
  290. "SizeOffset","SkinColor","SkyboxBk","SkyboxDn","SkyboxFt","SkyboxLf","SkyboxRt","SkyboxUp",
  291. "SlateQuality","SoundId","Source","SparkleColor","Specular","StarCount",
  292. "Steer","StickyWheels","StudsBetweenTextures","StudsOffset","StudsPerTileU","StudsPerTileV",
  293. "Style","Summary","SuperSafeChatReplicate","Surface","Surface0",
  294. "Surface1","SurfaceInput","Target","TargetFilter","TargetOffset","TargetPoint",
  295. "TargetRadius","TargetSurface","TeamColor","Terrain","Text","TextBounds","TextColor","TextColor3",
  296. "TextFits","TextScaled","TextStrokeColor3","TextStrokeTransparency","TextTransparency","Texture",
  297. "TextureId","TextureSize","TextWrap","TextWrapped","TextXAlignment","TextYAlignment","Throttle",
  298. "ThrustD","ThrustP","Ticket","Time","TimeOfDay","To","Tone","ToolTip","TopBottom","Torque","Torso",
  299. "Transparency","TrussDetail","TurnD","TurnP","TurnSpeed","UnitRay","UserDialog","UserId","Value",
  300. "Version","VertexColor","VideoCaptureEnabled","VideoMemory","VideoQuality",
  301. "ViewSizeX","ViewSizeY","Visible","Volume","WalkDirection","WalkSpeed","WalkToPart","WalkToPoint",
  302. "WheelBackwardConnectionCount","WheelForwardConnectionCount","WindowSize","WireRadius","WoodQuality",
  303. "X","Y","Size","Radius"}
  304.  
  305. local LockedProperties = { -- cant be edited
  306. "ClassName",
  307. "Parent",
  308. "userId",
  309. "MembershipType",
  310. "CameraSubject",
  311. "FilteringEnabled",
  312. }
  313.  
  314. local LockedItems = { -- cant be edited
  315.  
  316. }
  317.  
  318. function GetProperties(obj)
  319. assert(pcall(function() assert(game.IsA(obj,"Instance")) end),"Should be ROBLOX instance")
  320. local objProper = {}
  321. for i = 1,#Properties_TBL do
  322. local v = Properties_TBL[i]
  323. if pcall(function() return obj[v] end) and ( not obj:FindFirstChild(v)) then
  324. objProper[#objProper+1] = v
  325. end
  326. end
  327. return objProper
  328. end
  329.  
  330. local Player = game:service"Players".LocalPlayer
  331. local Mouse = Player:GetMouse()
  332. local guis_enabled = {}
  333. if game:service"StarterGui":GetCoreGuiEnabled(0) then
  334. guis_enabled[0] = true
  335. end
  336. if game:service"StarterGui":GetCoreGuiEnabled(1) then
  337. guis_enabled[1] = true
  338. end
  339. if game:service"StarterGui":GetCoreGuiEnabled(2) then
  340. guis_enabled[2] = true
  341. end
  342. if game:service"StarterGui":GetCoreGuiEnabled(3) then
  343. guis_enabled[3] = true
  344. end
  345. Mouse.KeyDown:connect(function(k)
  346. if string.byte(k) == 30 then
  347. Properties.Visible = not Properties.Visible
  348. Explorer.Visible = Properties.Visible
  349. Command.Visible = Properties.Visible
  350. Output.Visible = Properties.Visible
  351. if Properties.Visible then
  352. game:service"StarterGui":SetCoreGuiEnabled(4,false)
  353. else
  354. for _,v in pairs(guis_enabled) do
  355. game:service"StarterGui":SetCoreGuiEnabled(_,true)
  356. end
  357. end
  358. end
  359. end)
  360.  
  361.  
  362. -- generik scroll:
  363. local scroll = Properties:WaitForChild("ScrollFrame")
  364. scroll:WaitForChild("ScrollBar"):WaitForChild("ScrollThumb")
  365. local down,up
  366. scroll.ScrollBar.MouseButton1Click:connect(function()
  367. scroll.ScrollBar.ScrollThumb.Position = UDim2.new(0,0,0,scroll.ScrollBar.AbsolutePosition.Y-Mouse.Y)
  368. end)
  369. scroll.ScrollBar.ScrollThumb.Changed:connect(function()
  370. scroll.ScrollBar.ScrollThumb.Position = UDim2.new(0,0,0,scroll.ScrollBar.ScrollThumb.Position.Y.Offset)
  371. local p = scroll.ScrollBar.ScrollThumb.Position
  372. if p.Y.Offset < 0 then
  373. scroll.ScrollBar.ScrollThumb.Position = UDim2.new(0,0,0,0)
  374. end
  375. if p.Y.Offset > scroll.ScrollBar.AbsoluteSize.Y-scroll.ScrollBar.ScrollThumb.Size.Y.Offset then
  376. scroll.ScrollBar.ScrollThumb.Position = UDim2.new(0,0,0,scroll.ScrollBar.AbsoluteSize.Y-scroll.ScrollBar.ScrollThumb.Size.Y.Offset)
  377. end
  378. if p.Y.Offset > (23*#Properties.List:GetChildren())-(scroll.ScrollBar.ScrollThumb.Size.Y.Offset/2) then
  379. scroll.ScrollBar.ScrollThumb.Position = UDim2.new(0,0,0,(23*#Properties.List:GetChildren())-(scroll.ScrollBar.ScrollThumb.Size.Y.Offset/2))
  380. end
  381. for _,v in pairs(Properties.List:GetChildren())do
  382. v.Position = UDim2.new(0,0,0,v.BasePosition.Value)-UDim2.new(0,0,0,4*scroll.ScrollBar.ScrollThumb.Position.Y.Offset)
  383. end
  384. end)
  385. scroll.ScrollDown.MouseButton1Down:connect(function()
  386. down = true
  387. repeat wait(.001) for _,v in pairs(Properties.List:GetChildren())do v.Position = v.Position - UDim2.new(0,0,0,1) end until not down
  388. end)
  389. scroll.ScrollDown.MouseButton1Up:connect(function()
  390. down = false
  391. end)
  392. scroll.ScrollDown.MouseLeave:connect(function()
  393. down = false
  394. end)
  395. scroll.ScrollUp.MouseButton1Down:connect(function()
  396. up = true
  397. repeat wait(.001) for _,v in pairs(Properties.List:GetChildren())do v.Position = v.Position + UDim2.new(0,0,0,1) end until not up
  398. end)
  399. scroll.ScrollUp.MouseButton1Up:connect(function()
  400. up = false
  401. end)
  402. scroll.ScrollUp.MouseLeave:connect(function()
  403. up = false
  404. end)
  405.  
  406. function findInTable(tbl,f)
  407. for _,v in pairs(tbl)do
  408. if v == f then
  409. return true
  410. end
  411. end
  412. return false
  413. end
  414.  
  415. function GetPropertyType(prop,obj)
  416. local propv = obj[prop]
  417. if type(propv) == "userdata" then
  418. local type = "instance"
  419. pcall(function() -- Detect Vector3
  420. local x,y,z,lv = propv.X,propv.Y,propv.Z,propv.unit.Z
  421. if x and y and z and lv then
  422. type = "vector3"
  423. end
  424. end)
  425. pcall(function() -- Detect CFrame
  426. local x,y,z,lv,p = propv.X,propv.Y,propv.Z,propv.lookVector,propv.p
  427. if x and y and z and lv and p then
  428. type = "cframe"
  429. end
  430. end)
  431. pcall(function() -- Detect UDim2
  432. local x,y,o1,o2 = propv.X.Offset,propv.Y.Offset,propv.X.Scale,propv.Y.Scale
  433. if x and y and o1 and o2 then
  434. type = "udim2"
  435. end
  436. end)
  437. pcall(function() -- Detect BrickColor
  438. local r,g,b,n,c = propv.r,propv.g,propv.b,propv.Name,propv.Color
  439. if r and g and b and n and c then
  440. type = "brickcolor"
  441. end
  442. end)
  443. pcall(function() -- Detect Color3
  444. local r,g,b = propv.r,propv.g,propv.b
  445. if r and g and b and not type == "brickcolor" then
  446. type = "color3"
  447. end
  448. end)
  449. pcall(function() -- Detect enum
  450. if tostring(propv):sub(1,#"Enum.") == "Enum." then
  451. type = "enum"
  452. end
  453. end)
  454. return type
  455. elseif type(propv) == "number" then
  456. return "number"
  457. elseif type(propv) == "string" then
  458. return "string"
  459. elseif type(propv) == "boolean" then
  460. return "boolean"
  461. end
  462. return "string" -- hm...
  463. end
  464.  
  465. local Object
  466. local Events = {}
  467. local color = Color3.new(237/255, 237/255, 238/255)
  468. local ocolor = color
  469. Explorer.SelectionChanged.Event:connect(function()
  470. Object = Explorer.GetSelection:Invoke()[1]
  471.  
  472. for _,v in pairs(Events)do v:disconnect() end
  473.  
  474. Properties.List:ClearAllChildren()
  475.  
  476. if Object then
  477. local Properties_list = GetProperties(Object)
  478. for i=1,#Properties_list do
  479. local _ = Properties_list[i]
  480. if color ~= ocolor then
  481. color = ocolor
  482. else
  483. color = Color3.new(221/255, 221/255, 222/255)
  484. end
  485. local ui = Properties.property:Clone()
  486. ui.Visible = true
  487. ui.BackgroundColor3 = color
  488. ui.Parent = Properties.List
  489. ui.Position = UDim2.new(0,0,0,(22*(#Properties.List:GetChildren()-1))+(1*(#Properties.List:GetChildren()-1)))
  490. ui.name.locked.Text = _
  491. ui.name.unlocked.Text = _
  492. local bp = Instance.new("NumberValue",ui)
  493. bp.Name = "BasePosition"
  494. bp.Value = ui.Position.Y.Offset
  495. if findInTable(LockedProperties,_) then
  496. ui.name.locked.Visible = true
  497. else
  498. ui.name.unlocked.Visible = true
  499. end
  500. local type = GetPropertyType(_,Object)
  501. local propv = Object[_]
  502. local img_checked = "http://www.roblox.com/asset/?id=48138491"
  503. local img_unchecked = "http://www.roblox.com/asset/?id=48138474"
  504. if findInTable(LockedProperties,_) then
  505. ui.edit.locked.Visible = true
  506. ui.edit.locked.Text = tostring(propv)
  507. elseif type == "number" or type == "string" then
  508. ui.edit.box.Visible = true
  509. ui.edit.box.Text = tostring(propv)
  510. ui.edit.box.FocusLost:connect(function()
  511. if type == "number" then
  512. Object[_] = tonumber(ui.edit.box.Text)
  513. else
  514. Object[_] = ui.edit.box.Text
  515. end
  516. end)
  517. elseif type == "boolean" then
  518. ui.edit.check.Visible = true
  519. if propv then
  520. ui.edit.check.Image = img_checked
  521. else
  522. ui.edit.check.Image = img_unchecked
  523. end
  524. ui.edit.check.MouseButton1Click:connect(function()
  525. Object[_] = not Object[_]
  526. propv = Object[_]
  527. if propv then
  528. ui.edit.check.Image = img_checked
  529. else
  530. ui.edit.check.Image = img_unchecked
  531. end
  532. end)
  533. elseif type == "instance" then
  534. ui.edit.locked.Visible = true
  535. ui.edit.locked.Text = tostring(propv)
  536. elseif type == "vector3" then
  537. ui.edit.box.Visible = true
  538. ui.edit.box.Text = propv.X..", "..propv.Y..", "..propv.Z
  539. local origit = ui.edit.box.Text
  540. ui.edit.box.FocusLost:connect(function()
  541. local x,y,z
  542. local n = 1
  543. for match in ui.edit.box.Text:gsub(" ",""):gmatch("[^,]+") do
  544. if n == 1 then x = tonumber(match) end
  545. if n == 2 then y = tonumber(match) end
  546. if n == 3 then z = tonumber(match) end
  547. n = n + 1
  548. end
  549. x,y,z = tonumber(x),tonumber(y),tonumber(z)
  550. local origi = Object[_] if not pcall(function() Object[_] = Vector3.new(x,y,z) end) then Object[_] = origi ui.edit.box.Text = origit else origit = ui.edit.box.Text end
  551. end)
  552. elseif type == "cframe" then
  553. ui.edit.box.Visible = true
  554. ui.edit.box.Text = propv.p.X..", "..propv.p.Y..", "..propv.p.Z
  555. local origit = ui.edit.box.Text
  556. ui.edit.box.FocusLost:connect(function()
  557. local x,y,z
  558. local n = 1
  559. for match in ui.edit.box.Text:gsub(" ",""):gmatch("[^,]+") do
  560. if n == 1 then x = tonumber(match) end
  561. if n == 2 then y = tonumber(match) end
  562. if n == 3 then z = tonumber(match) end
  563. n = n + 1
  564. end
  565. x,y,z = tonumber(x),tonumber(y),tonumber(z)
  566. local origi = Object[_] if not pcall(function() Object[_] = CFrame.new(x,y,z) end) then Object[_] = origi ui.edit.box.Text = origit else origit = ui.edit.box.Text end
  567. end)
  568. elseif type == "udim2" then
  569. ui.edit.box.Visible = true
  570. ui.edit.box.Text = "{"..propv.X.Scale..", "..propv.X.Offset.."}, {"..propv.Y.Scale..", "..propv.Y.Offset.."}"
  571. local origit = ui.edit.box.Text
  572. ui.edit.box.FocusLost:connect(function()
  573. local xscale,xoffset,yscale,yoffset
  574. local n = 1
  575. for match in ui.edit.box.Text:gsub(" ",""):gsub("}",""):gsub("{",""):gmatch("[^,]+") do
  576. if n == 1 then xscale = tonumber(match) end
  577. if n == 2 then xoffset = tonumber(match) end
  578. if n == 3 then yscale = tonumber(match) end
  579. if n == 4 then yoffset = tonumber(match) end
  580. n = n + 1
  581. end
  582. xscale,xoffset,yscale,yoffset = tonumber(xscale),tonumber(xoffset),tonumber(yscale),tonumber(yoffset)
  583. local origi = Object[_] if not pcall(function() Object[_] = UDim2.new(xscale,xoffset,yscale,yoffset) end) then Object[_] = origi ui.edit.box.Text = origit else origit = ui.edit.box.Text end
  584. end)
  585. elseif type == "color3" then
  586. ui.edit.box.Visible = true
  587. ui.edit.box.Text = propv.r*255 ..", "..propv.g*255 ..", "..propv.b*255
  588. local origit = ui.edit.box.Text
  589. ui.edit.box.FocusLost:connect(function()
  590. local r,g,b
  591. local n = 1
  592. for match in ui.edit.box.Text:gsub(" ",""):gmatch("[^,]+") do
  593. if n == 1 then r = tonumber(match) end
  594. if n == 2 then g = tonumber(match) end
  595. if n == 3 then b = tonumber(match) end
  596. n = n + 1
  597. end
  598. r,g,b = tonumber(r)/255,tonumber(g)/255,tonumber(b)/255
  599. local origi = Object[_] if not pcall(function() Object[_] = Color3.new(r,g,b) end) then Object[_] = origi ui.edit.box.Text = origit else origit = ui.edit.box.Text end
  600. end)
  601. elseif type == "brickcolor" then
  602. ui.edit.box.Visible = true
  603. ui.edit.box.Text = tostring(propv)
  604. local origit = ui.edit.box.Text
  605. ui.edit.box.FocusLost:connect(function()
  606. local origi = Object[_] if not pcall(function() Object[_] = BrickColor.new(ui.edit.box.Text) end) then Object[_] = origi ui.edit.box.Text = origit else origit = ui.edit.box.Text end
  607. end)
  608. elseif type == "enum" then
  609. ui.edit.box.Visible = true
  610. ui.edit.box.Text = tostring(propv)
  611. local origit = ui.edit.box.Text
  612. ui.edit.box.FocusLost:connect(function()
  613. local origi = Object[_] if not pcall(function() Object[_] = loadstring("return "..ui.edit.box.Text)() end) then Object[_] = origi ui.edit.box.Text = origit else origit = ui.edit.box.Text end
  614. end)
  615. end
  616. end
  617. end
  618. end)
  619. end))
  620. Frame24.Name = "Header"
  621. Frame24.Parent = Frame1
  622. Frame24.Size = UDim2.new(1, 0, 0, 18)
  623. Frame24.BackgroundColor3 = Color3.new(0.913726, 0.913726, 0.913726)
  624. Frame24.BorderColor3 = Color3.new(0.584314, 0.584314, 0.584314)
  625. TextLabel25.Parent = Frame24
  626. TextLabel25.Transparency = 1
  627. TextLabel25.Size = UDim2.new(1, -4, 1, 0)
  628. TextLabel25.Text = "Properties"
  629. TextLabel25.Position = UDim2.new(0, 4, 0, 0)
  630. TextLabel25.BackgroundTransparency = 1
  631. TextLabel25.Font = Enum.Font.SourceSans
  632. TextLabel25.FontSize = Enum.FontSize.Size14
  633. TextLabel25.TextColor3 = Color3.new(0, 0, 0)
  634. TextLabel25.TextXAlignment = Enum.TextXAlignment.Left
  635. Frame26.Name = "property"
  636. Frame26.Parent = Frame1
  637. Frame26.Size = UDim2.new(1, 0, 0, 22)
  638. Frame26.Position = UDim2.new(0, 0, 0, 1)
  639. Frame26.Visible = false
  640. Frame26.BackgroundColor3 = Color3.new(0.866667, 0.866667, 0.870588)
  641. Frame26.BorderColor3 = Color3.new(0.686275, 0.686275, 0.686275)
  642. Frame27.Name = "name"
  643. Frame27.Parent = Frame26
  644. Frame27.Transparency = 1
  645. Frame27.Size = UDim2.new(0.5, 0, 1, -1)
  646. Frame27.BackgroundColor3 = Color3.new(0.992157, 0.984314, 1)
  647. Frame27.BackgroundTransparency = 1
  648. TextLabel28.Name = "unlocked"
  649. TextLabel28.Parent = Frame27
  650. TextLabel28.Transparency = 1
  651. TextLabel28.Size = UDim2.new(1, -10, 1, 0)
  652. TextLabel28.Text = ""
  653. TextLabel28.Position = UDim2.new(0, 5, 0, 0)
  654. TextLabel28.Visible = false
  655. TextLabel28.BackgroundTransparency = 1
  656. TextLabel28.Font = Enum.Font.SourceSans
  657. TextLabel28.FontSize = Enum.FontSize.Size14
  658. TextLabel28.TextColor3 = Color3.new(0.0980392, 0.0980392, 0.0980392)
  659. TextLabel28.TextWrapped = true
  660. TextLabel28.TextXAlignment = Enum.TextXAlignment.Left
  661. TextLabel29.Name = "locked"
  662. TextLabel29.Parent = Frame27
  663. TextLabel29.Transparency = 1
  664. TextLabel29.Size = UDim2.new(1, -10, 1, 0)
  665. TextLabel29.Text = ""
  666. TextLabel29.Position = UDim2.new(0, 5, 0, 0)
  667. TextLabel29.Visible = false
  668. TextLabel29.BackgroundTransparency = 1
  669. TextLabel29.Font = Enum.Font.SourceSans
  670. TextLabel29.FontSize = Enum.FontSize.Size14
  671. TextLabel29.TextColor3 = Color3.new(0.580392, 0.580392, 0.580392)
  672. TextLabel29.TextWrapped = true
  673. TextLabel29.TextXAlignment = Enum.TextXAlignment.Left
  674. Frame30.Name = "border"
  675. Frame30.Parent = Frame26
  676. Frame30.Size = UDim2.new(0, 1, 1, 0)
  677. Frame30.Position = UDim2.new(0.5, 0, 0, 0)
  678. Frame30.BackgroundColor3 = Color3.new(0.686275, 0.686275, 0.686275)
  679. Frame30.BorderColor3 = Color3.new(0.686275, 0.686275, 0.686275)
  680. Frame30.BorderSizePixel = 0
  681. Frame31.Name = "edit"
  682. Frame31.Parent = Frame26
  683. Frame31.Transparency = 1
  684. Frame31.Size = UDim2.new(0.5, 0, 1, -1)
  685. Frame31.Position = UDim2.new(0.5, 0, 0, 0)
  686. Frame31.BackgroundColor3 = Color3.new(0.992157, 0.984314, 1)
  687. Frame31.BackgroundTransparency = 1
  688. TextLabel32.Name = "locked"
  689. TextLabel32.Parent = Frame31
  690. TextLabel32.Transparency = 1
  691. TextLabel32.Size = UDim2.new(1, -10, 1, 0)
  692. TextLabel32.Text = ""
  693. TextLabel32.Position = UDim2.new(0, 5, 0, 0)
  694. TextLabel32.Visible = false
  695. TextLabel32.BackgroundTransparency = 1
  696. TextLabel32.Font = Enum.Font.SourceSans
  697. TextLabel32.FontSize = Enum.FontSize.Size14
  698. TextLabel32.TextColor3 = Color3.new(0.580392, 0.580392, 0.580392)
  699. TextLabel32.TextWrapped = true
  700. TextLabel32.TextXAlignment = Enum.TextXAlignment.Left
  701. TextBox33.Name = "box"
  702. TextBox33.Parent = Frame31
  703. TextBox33.Transparency = 1
  704. TextBox33.Size = UDim2.new(1, -10, 1, 0)
  705. TextBox33.Text = ""
  706. TextBox33.Position = UDim2.new(0, 5, 0, 0)
  707. TextBox33.Visible = false
  708. TextBox33.BackgroundTransparency = 1
  709. TextBox33.Font = Enum.Font.SourceSans
  710. TextBox33.FontSize = Enum.FontSize.Size14
  711. TextBox33.TextColor3 = Color3.new(0.0980392, 0.0980392, 0.0980392)
  712. TextBox33.TextWrapped = true
  713. TextBox33.TextXAlignment = Enum.TextXAlignment.Left
  714. ImageButton34.Name = "check"
  715. ImageButton34.Parent = Frame31
  716. ImageButton34.Size = UDim2.new(0, 12, 0, 12)
  717. ImageButton34.Position = UDim2.new(0, 5, 0, 5)
  718. ImageButton34.Visible = false
  719. ImageButton34.BackgroundColor3 = Color3.new(0.866667, 0.866667, 0.870588)
  720. ImageButton34.BorderSizePixel = 0
  721. Frame35.Name = "ExplorerPanel"
  722. Frame35.Parent = ScreenGui0
  723. Frame35.Transparency = 0.10000000149012
  724. Frame35.Size = UDim2.new(0, 300, 1, -210)
  725. Frame35.Position = UDim2.new(1, -308, 0, 190)
  726. Frame35.BackgroundColor3 = Color3.new(1, 1, 1)
  727. Frame35.BackgroundTransparency = 0.10000000149012
  728. Frame35.BorderColor3 = Color3.new(0.74902, 0.74902, 0.74902)
  729. Frame35.Draggable = true
  730. LocalScript36.Parent = Frame35
  731. table.insert(cors,sandbox(LocalScript36,function()
  732. -- initial states
  733. local Option = {
  734. -- can modify objects
  735. Modifiable = true;
  736. -- can select objects
  737. Selectable = true;
  738. }
  739.  
  740. -- general size of GUI objects, in pixels
  741. local GUI_SIZE = 16
  742. -- padding between items within each entry
  743. local ENTRY_PADDING = 1
  744. -- padding between each entry
  745. local ENTRY_MARGIN = 1
  746.  
  747. --[[
  748.  
  749. # Explorer Panel
  750.  
  751. A GUI panel that displays the game hierarchy.
  752.  
  753.  
  754. ## Selection Bindables
  755.  
  756. - `Function GetSelection ( )`
  757.  
  758. Returns an array of objects representing the objects currently
  759. selected in the panel.
  760.  
  761. - `Function SetSelection ( Objects selection )`
  762.  
  763. Sets the objects that are selected in the panel. `selection` is an array
  764. of objects.
  765.  
  766. - `Event SelectionChanged ( )`
  767.  
  768. Fired after the selection changes.
  769.  
  770.  
  771. ## Option Bindables
  772.  
  773. - `Function GetOption ( string optionName )`
  774.  
  775. If `optionName` is given, returns the value of that option. Otherwise,
  776. returns a table of options and their current values.
  777.  
  778. - `Function SetOption ( string optionName, bool value )`
  779.  
  780. Sets `optionName` to `value`.
  781.  
  782. Options:
  783.  
  784. - Modifiable
  785.  
  786. Whether objects can be modified by the panel.
  787.  
  788. Note that modifying objects depends on being able to select them. If
  789. Selectable is false, then Actions will not be available. Reparenting
  790. is still possible, but only for the dragged object.
  791.  
  792. - Selectable
  793.  
  794. Whether objects can be selected.
  795.  
  796. If Modifiable is false, then left-clicking will perform a drag
  797. selection.
  798.  
  799. ## Updates
  800.  
  801. - 2013-09-18
  802. - Fixed explorer icons to match studio explorer.
  803.  
  804. - 2013-09-14
  805. - Added GetOption and SetOption bindables.
  806. - Option: Modifiable; sets whether objects can be modified by the panel.
  807. - Option: Selectable; sets whether objects can be selected.
  808. - Slight modification to left-click selection behavior.
  809. - Improved layout and scaling.
  810.  
  811. - 2013-09-13
  812. - Added drag to reparent objects.
  813. - Left-click to select/deselect object.
  814. - Left-click and drag unselected object to reparent single object.
  815. - Left-click and drag selected object to move reparent entire selection.
  816. - Right-click while dragging to cancel.
  817.  
  818. - 2013-09-11
  819. - Added explorer panel header with actions.
  820. - Added Cut action.
  821. - Added Copy action.
  822. - Added Paste action.
  823. - Added Delete action.
  824. - Added drag selection.
  825. - Left-click: Add to selection on drag.
  826. - Right-click: Add to or remove from selection on drag.
  827. - Ensured SelectionChanged fires only when the selection actually changes.
  828. - Added documentation and change log.
  829. - Fixed thread issue.
  830.  
  831. - 2013-09-09
  832. - Added basic multi-selection.
  833. - Left-click to set selection.
  834. - Right-click to add to or remove from selection.
  835. - Removed "Selection" ObjectValue.
  836. - Added GetSelection BindableFunction.
  837. - Added SetSelection BindableFunction.
  838. - Added SelectionChanged BindableEvent.
  839. - Changed font to SourceSans.
  840.  
  841. - 2013-08-31
  842. - Improved GUI sizing based off of `GUI_SIZE` constant.
  843. - Automatic font size detection.
  844.  
  845. - 2013-08-27
  846. - Initial explorer panel.
  847.  
  848.  
  849. ## Todo
  850.  
  851. - Sorting
  852. - by ExplorerOrder
  853. - by children
  854. - by name
  855. - Drag objects to reparent
  856.  
  857. ]]
  858.  
  859. local ENTRY_SIZE = GUI_SIZE + ENTRY_PADDING*2
  860. local ENTRY_BOUND = ENTRY_SIZE + ENTRY_MARGIN
  861. local HEADER_SIZE = ENTRY_SIZE
  862.  
  863. local FONT = 'SourceSans'
  864. local FONT_SIZE do
  865. local size = {8,9,10,11,12,14,18,24,36,48}
  866. local s
  867. local n = math.huge
  868. for i = 1,#size do
  869. if size[i] <= GUI_SIZE then
  870. FONT_SIZE = i - 1
  871. end
  872. end
  873. end
  874.  
  875. local GuiColor = {
  876. Background = Color3.new(233/255, 233/255, 233/255);
  877. Border = Color3.new(149/255, 149/255, 149/255);
  878. Selected = Color3.new( 96/255, 140/255, 211/255);
  879. BorderSelected = Color3.new( 86/255, 125/255, 188/255);
  880. Text = Color3.new( 0/255, 0/255, 0/255);
  881. TextDisabled = Color3.new(128/255, 128/255, 128/255);
  882. TextSelected = Color3.new(255/255, 255/255, 255/255);
  883. Button = Color3.new(221/255, 221/255, 221/255);
  884. ButtonBorder = Color3.new(149/255, 149/255, 149/255);
  885. ButtonSelected = Color3.new(255/255, 0/255, 0/255);
  886. Field = Color3.new(255/255, 255/255, 255/255);
  887. FieldBorder = Color3.new(191/255, 191/255, 191/255);
  888. TitleBackground = Color3.new(178/255, 178/255, 178/255);
  889. }
  890.  
  891. ----------------------------------------------------------------
  892. ----------------------------------------------------------------
  893. ----------------------------------------------------------------
  894. ----------------------------------------------------------------
  895. ---- Icon map constants
  896.  
  897. local MAP_ID = 129293660
  898.  
  899. -- Indices based on implementation of Icon function.
  900. local ACTION_CUT = 160
  901. local ACTION_COPY = 161
  902. local ACTION_PASTE = 162
  903. local ACTION_DELETE = 163
  904. local ACTION_SORT = 164
  905. local ACTION_CUT_OVER = 174
  906. local ACTION_COPY_OVER = 175
  907. local ACTION_PASTE_OVER = 176
  908. local ACTION_DELETE_OVER = 177
  909. local ACTION_SORT_OVER = 178
  910.  
  911. local NODE_COLLAPSED = 165
  912. local NODE_EXPANDED = 166
  913. local NODE_COLLAPSED_OVER = 179
  914. local NODE_EXPANDED_OVER = 180
  915.  
  916. local ExplorerIndex = {
  917. ["Accoutrement"] = 32;
  918. ["Animation"] = 60;
  919. ["AnimationTrack"] = 60;
  920. ["ArcHandles"] = 56;
  921. ["Backpack"] = 20;
  922. ["BillboardGui"] = 64;
  923. ["BindableEvent"] = 67;
  924. ["BindableFunction"] = 66;
  925. ["BlockMesh"] = 8;
  926. ["BodyAngularVelocity"] = 14;
  927. ["BodyForce"] = 14;
  928. ["BodyGyro"] = 14;
  929. ["BodyPosition"] = 14;
  930. ["BodyThrust"] = 14;
  931. ["BodyVelocity"] = 14;
  932. ["BoolValue"] = 4;
  933. ["BrickColorValue"] = 4;
  934. ["Camera"] = 5;
  935. ["CFrameValue"] = 4;
  936. ["CharacterMesh"] = 60;
  937. ["ClickDetector"] = 41;
  938. ["Color3Value"] = 4;
  939. ["Configuration"] = 58;
  940. ["CoreGui"] = 46;
  941. ["CornerWedgePart"] = 1;
  942. ["CustomEvent"] = 4;
  943. ["CustomEventReceiver"] = 4;
  944. ["CylinderMesh"] = 8;
  945. ["Debris"] = 30;
  946. ["Decal"] = 7;
  947. ["Dialog"] = 62;
  948. ["DialogChoice"] = 63;
  949. ["DoubleConstrainedValue"] = 4;
  950. ["Explosion"] = 36;
  951. ["Fire"] = 61;
  952. ["Flag"] = 38;
  953. ["FlagStand"] = 39;
  954. ["FloorWire"] = 4;
  955. ["ForceField"] = 37;
  956. ["Frame"] = 48;
  957. ["GuiButton"] = 52;
  958. ["GuiMain"] = 47;
  959. ["Handles"] = 53;
  960. ["Hat"] = 45;
  961. ["Hint"] = 33;
  962. ["HopperBin"] = 22;
  963. ["Humanoid"] = 9;
  964. ["ImageButton"] = 52;
  965. ["ImageLabel"] = 49;
  966. ["IntConstrainedValue"] = 4;
  967. ["IntValue"] = 4;
  968. ["JointInstance"] = 34;
  969. ["Keyframe"] = 60;
  970. ["Lighting"] = 13;
  971. ["LocalScript"] = 18;
  972. ["MarketplaceService"] = 46;
  973. ["Message"] = 33;
  974. ["Model"] = 2;
  975. ["NetworkClient"] = 16;
  976. ["NetworkReplicator"] = 29;
  977. ["NetworkServer"] = 15;
  978. ["NumberValue"] = 4;
  979. ["ObjectValue"] = 4;
  980. ["Pants"] = 44;
  981. ["ParallelRampPart"] = 1;
  982. ["Part"] = 1;
  983. ["PartPairLasso"] = 57;
  984. ["Platform"] = 35;
  985. ["Player"] = 12;
  986. ["PlayerGui"] = 46;
  987. ["Players"] = 21;
  988. ["PointLight"] = 13;
  989. ["Pose"] = 60;
  990. ["PrismPart"] = 1;
  991. ["PyramidPart"] = 1;
  992. ["RayValue"] = 4;
  993. ["ReplicatedStorage"] = 0;
  994. ["RightAngleRampPart"] = 1;
  995. ["RocketPropulsion"] = 14;
  996. ["ScreenGui"] = 47;
  997. ["Script"] = 6;
  998. ["Seat"] = 35;
  999. ["SelectionBox"] = 54;
  1000. ["SelectionPartLasso"] = 57;
  1001. ["SelectionPointLasso"] = 57;
  1002. ["ServerScriptService"] = 0;
  1003. ["ServerStorage"] = 0;
  1004. ["Shirt"] = 43;
  1005. ["ShirtGraphic"] = 40;
  1006. ["SkateboardPlatform"] = 35;
  1007. ["Sky"] = 28;
  1008. ["Smoke"] = 59;
  1009. ["Sound"] = 11;
  1010. ["SoundService"] = 31;
  1011. ["Sparkles"] = 42;
  1012. ["SpawnLocation"] = 25;
  1013. ["SpecialMesh"] = 8;
  1014. ["SpotLight"] = 13;
  1015. ["StarterGear"] = 20;
  1016. ["StarterGui"] = 46;
  1017. ["StarterPack"] = 20;
  1018. ["Status"] = 2;
  1019. ["StringValue"] = 4;
  1020. ["SurfaceSelection"] = 55;
  1021. ["Team"] = 24;
  1022. ["Teams"] = 23;
  1023. ["Terrain"] = 65;
  1024. ["TestService"] = 68;
  1025. ["TextBox"] = 51;
  1026. ["TextButton"] = 51;
  1027. ["TextLabel"] = 50;
  1028. ["Texture"] = 10;
  1029. ["TextureTrail"] = 4;
  1030. ["Tool"] = 17;
  1031. ["TouchTransmitter"] = 37;
  1032. ["TrussPart"] = 1;
  1033. ["Vector3Value"] = 4;
  1034. ["VehicleSeat"] = 35;
  1035. ["WedgePart"] = 1;
  1036. ["Weld"] = 34;
  1037. ["Workspace"] = 19;
  1038. }
  1039.  
  1040. ----------------------------------------------------------------
  1041. ----------------------------------------------------------------
  1042. ----------------------------------------------------------------
  1043. ----------------------------------------------------------------
  1044. ----------------------------------------------------------------
  1045.  
  1046. function Create(ty,data)
  1047. local obj
  1048. if type(ty) == 'string' then
  1049. obj = Instance.new(ty)
  1050. else
  1051. obj = ty
  1052. end
  1053. for k, v in pairs(data) do
  1054. if type(k) == 'number' then
  1055. v.Parent = obj
  1056. else
  1057. obj[k] = v
  1058. end
  1059. end
  1060. return obj
  1061. end
  1062.  
  1063. -- Connects a function to an event such that it fires asynchronously
  1064. function Connect(event,func)
  1065. return event:connect(function(...)
  1066. local a = {...}
  1067. Spawn(function() func(unpack(a)) end)
  1068. end)
  1069. end
  1070.  
  1071. -- returns the ascendant ScreenGui of an object
  1072. function GetScreen(screen)
  1073. if screen == nil then return nil end
  1074. while not screen:IsA("ScreenGui") do
  1075. screen = screen.Parent
  1076. if screen == nil then return nil end
  1077. end
  1078. return screen
  1079. end
  1080.  
  1081. do
  1082. local ZIndexLock = {}
  1083. -- Sets the ZIndex of an object and its descendants. Objects are locked so
  1084. -- that SetZIndexOnChanged doesn't spawn multiple threads that set the
  1085. -- ZIndex of the same object.
  1086. function SetZIndex(object,z)
  1087. if not ZIndexLock[object] then
  1088. ZIndexLock[object] = true
  1089. if object:IsA'GuiObject' then
  1090. object.ZIndex = z
  1091. end
  1092. local children = object:GetChildren()
  1093. for i = 1,#children do
  1094. SetZIndex(children[i],z)
  1095. end
  1096. ZIndexLock[object] = nil
  1097. end
  1098. end
  1099.  
  1100. function SetZIndexOnChanged(object)
  1101. return object.Changed:connect(function(p)
  1102. if p == "ZIndex" then
  1103. SetZIndex(object,object.ZIndex)
  1104. end
  1105. end)
  1106. end
  1107. end
  1108.  
  1109. ---- IconMap ----
  1110. -- Image size: 256px x 256px
  1111. -- Icon size: 16px x 16px
  1112. -- Padding between each icon: 2px
  1113. -- Padding around image edge: 1px
  1114. -- Total icons: 14 x 14 (196)
  1115. local Icon do
  1116. local iconMap = 'http://www.roblox.com/asset/?id=' .. MAP_ID
  1117. Game:GetService('ContentProvider'):Preload(iconMap)
  1118. local iconDehash do
  1119. -- 14 x 14, 0-based input, 0-based output
  1120. local f=math.floor
  1121. function iconDehash(h)
  1122. return f(h/14%14),f(h%14)
  1123. end
  1124. end
  1125.  
  1126. function Icon(IconFrame,index)
  1127. local row,col = iconDehash(index)
  1128. local mapSize = Vector2.new(256,256)
  1129. local pad,border = 2,1
  1130. local iconSize = 16
  1131.  
  1132. local class = 'Frame'
  1133. if type(IconFrame) == 'string' then
  1134. class = IconFrame
  1135. IconFrame = nil
  1136. end
  1137.  
  1138. if not IconFrame then
  1139. IconFrame = Create(class,{
  1140. Name = "Icon";
  1141. BackgroundTransparency = 1;
  1142. ClipsDescendants = true;
  1143. Create('ImageLabel',{
  1144. Name = "IconMap";
  1145. Active = false;
  1146. BackgroundTransparency = 1;
  1147. Image = iconMap;
  1148. Size = UDim2.new(mapSize.x/iconSize,0,mapSize.y/iconSize,0);
  1149. });
  1150. })
  1151. end
  1152.  
  1153. IconFrame.IconMap.Position = UDim2.new(-col - (pad*(col+1) + border)/iconSize,0,-row - (pad*(row+1) + border)/iconSize,0)
  1154. return IconFrame
  1155. end
  1156. end
  1157.  
  1158. ----------------------------------------------------------------
  1159. ----------------------------------------------------------------
  1160. ----------------------------------------------------------------
  1161. ----------------------------------------------------------------
  1162. ---- ScrollBar
  1163. do
  1164. -- AutoButtonColor doesn't always reset properly
  1165. local function ResetButtonColor(button)
  1166. local active = button.Active
  1167. button.Active = not active
  1168. button.Active = active
  1169. end
  1170.  
  1171. local function ArrowGraphic(size,dir,scaled,template)
  1172. local Frame = Create('Frame',{
  1173. Name = "Arrow Graphic";
  1174. BorderSizePixel = 0;
  1175. Size = UDim2.new(0,size,0,size);
  1176. Transparency = 1;
  1177. })
  1178. if not template then
  1179. template = Instance.new("Frame")
  1180. template.BorderSizePixel = 0
  1181. end
  1182.  
  1183. local transform
  1184. if dir == nil or dir == 'Up' then
  1185. function transform(p,s) return p,s end
  1186. elseif dir == 'Down' then
  1187. function transform(p,s) return UDim2.new(0,p.X.Offset,0,size-p.Y.Offset-1),s end
  1188. elseif dir == 'Left' then
  1189. 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
  1190. elseif dir == 'Right' then
  1191. 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
  1192. end
  1193.  
  1194. local scale
  1195. if scaled then
  1196. 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
  1197. else
  1198. function scale(p,s) return p,s end
  1199. end
  1200.  
  1201. local o = math.floor(size/4)
  1202. if size%2 == 0 then
  1203. local n = size/2-1
  1204. for i = 0,n do
  1205. local t = template:Clone()
  1206. local p,s = scale(transform(
  1207. UDim2.new(0,n-i,0,o+i),
  1208. UDim2.new(0,(i+1)*2,0,1)
  1209. ))
  1210. t.Position = p
  1211. t.Size = s
  1212. t.Parent = Frame
  1213. end
  1214. else
  1215. local n = (size-1)/2
  1216. for i = 0,n do
  1217. local t = template:Clone()
  1218. local p,s = scale(transform(
  1219. UDim2.new(0,n-i,0,o+i),
  1220. UDim2.new(0,i*2+1,0,1)
  1221. ))
  1222. t.Position = p
  1223. t.Size = s
  1224. t.Parent = Frame
  1225. end
  1226. end
  1227. if size%4 > 1 then
  1228. local t = template:Clone()
  1229. local p,s = scale(transform(
  1230. UDim2.new(0,0,0,size-o-1),
  1231. UDim2.new(0,size,0,1)
  1232. ))
  1233. t.Position = p
  1234. t.Size = s
  1235. t.Parent = Frame
  1236. end
  1237. return Frame
  1238. end
  1239.  
  1240.  
  1241. local function GripGraphic(size,dir,spacing,scaled,template)
  1242. local Frame = Create('Frame',{
  1243. Name = "Grip Graphic";
  1244. BorderSizePixel = 0;
  1245. Size = UDim2.new(0,size.x,0,size.y);
  1246. Transparency = 1;
  1247. })
  1248. if not template then
  1249. template = Instance.new("Frame")
  1250. template.BorderSizePixel = 0
  1251. end
  1252.  
  1253. spacing = spacing or 2
  1254.  
  1255. local scale
  1256. if scaled then
  1257. function scale(p) return UDim2.new(p.X.Offset/size.x,0,p.Y.Offset/size.y,0) end
  1258. else
  1259. function scale(p) return p end
  1260. end
  1261.  
  1262. if dir == 'Vertical' then
  1263. for i=0,size.x-1,spacing do
  1264. local t = template:Clone()
  1265. t.Size = scale(UDim2.new(0,1,0,size.y))
  1266. t.Position = scale(UDim2.new(0,i,0,0))
  1267. t.Parent = Frame
  1268. end
  1269. elseif dir == nil or dir == 'Horizontal' then
  1270. for i=0,size.y-1,spacing do
  1271. local t = template:Clone()
  1272. t.Size = scale(UDim2.new(0,size.x,0,1))
  1273. t.Position = scale(UDim2.new(0,0,0,i))
  1274. t.Parent = Frame
  1275. end
  1276. end
  1277.  
  1278. return Frame
  1279. end
  1280.  
  1281. local mt = {
  1282. __index = {
  1283. GetScrollPercent = function(self)
  1284. return self.ScrollIndex/(self.TotalSpace-self.VisibleSpace)
  1285. end;
  1286. CanScrollDown = function(self)
  1287. return self.ScrollIndex + self.VisibleSpace < self.TotalSpace
  1288. end;
  1289. CanScrollUp = function(self)
  1290. return self.ScrollIndex > 0
  1291. end;
  1292. ScrollDown = function(self)
  1293. self.ScrollIndex = self.ScrollIndex + self.PageIncrement
  1294. self:Update()
  1295. end;
  1296. ScrollUp = function(self)
  1297. self.ScrollIndex = self.ScrollIndex - self.PageIncrement
  1298. self:Update()
  1299. end;
  1300. ScrollTo = function(self,index)
  1301. self.ScrollIndex = index
  1302. self:Update()
  1303. end;
  1304. SetScrollPercent = function(self,percent)
  1305. self.ScrollIndex = math.floor((self.TotalSpace - self.VisibleSpace)*percent + 0.5)
  1306. self:Update()
  1307. end;
  1308. };
  1309. }
  1310. mt.__index.CanScrollRight = mt.__index.CanScrollDown
  1311. mt.__index.CanScrollLeft = mt.__index.CanScrollUp
  1312. mt.__index.ScrollLeft = mt.__index.ScrollUp
  1313. mt.__index.ScrollRight = mt.__index.ScrollDown
  1314.  
  1315. function ScrollBar(horizontal)
  1316. -- create row scroll bar
  1317. local ScrollFrame = Create('Frame',{
  1318. Name = "ScrollFrame";
  1319. Position = horizontal and UDim2.new(0,0,1,-GUI_SIZE) or UDim2.new(1,-GUI_SIZE,0,0);
  1320. Size = horizontal and UDim2.new(1,0,0,GUI_SIZE) or UDim2.new(0,GUI_SIZE,1,0);
  1321. BackgroundTransparency = 1;
  1322. Create('ImageButton',{
  1323. Name = "ScrollDown";
  1324. Position = horizontal and UDim2.new(1,-GUI_SIZE,0,0) or UDim2.new(0,0,1,-GUI_SIZE);
  1325. Size = UDim2.new(0, GUI_SIZE, 0, GUI_SIZE);
  1326. BackgroundColor3 = GuiColor.Button;
  1327. BorderColor3 = GuiColor.Border;
  1328. --BorderSizePixel = 0;
  1329. });
  1330. Create('ImageButton',{
  1331. Name = "ScrollUp";
  1332. Size = UDim2.new(0, GUI_SIZE, 0, GUI_SIZE);
  1333. BackgroundColor3 = GuiColor.Button;
  1334. BorderColor3 = GuiColor.Border;
  1335. --BorderSizePixel = 0;
  1336. });
  1337. Create('ImageButton',{
  1338. Name = "ScrollBar";
  1339. Size = horizontal and UDim2.new(1,-GUI_SIZE*2,1,0) or UDim2.new(1,0,1,-GUI_SIZE*2);
  1340. Position = horizontal and UDim2.new(0,GUI_SIZE,0,0) or UDim2.new(0,0,0,GUI_SIZE);
  1341. AutoButtonColor = false;
  1342. BackgroundColor3 = Color3.new(0.94902, 0.94902, 0.94902);
  1343. BorderColor3 = GuiColor.Border;
  1344. --BorderSizePixel = 0;
  1345. Create('ImageButton',{
  1346. Name = "ScrollThumb";
  1347. AutoButtonColor = false;
  1348. Size = UDim2.new(0, GUI_SIZE, 0, GUI_SIZE);
  1349. BackgroundColor3 = GuiColor.Button;
  1350. BorderColor3 = GuiColor.Border;
  1351. --BorderSizePixel = 0;
  1352. });
  1353. });
  1354. })
  1355.  
  1356. local graphicTemplate = Create('Frame',{
  1357. Name="Graphic";
  1358. BorderSizePixel = 0;
  1359. BackgroundColor3 = GuiColor.Border;
  1360. })
  1361. local graphicSize = GUI_SIZE/2
  1362.  
  1363. local ScrollDownFrame = ScrollFrame.ScrollDown
  1364. local ScrollDownGraphic = ArrowGraphic(graphicSize,horizontal and 'Right' or 'Down',true,graphicTemplate)
  1365. ScrollDownGraphic.Position = UDim2.new(0.5,-graphicSize/2,0.5,-graphicSize/2)
  1366. ScrollDownGraphic.Parent = ScrollDownFrame
  1367. local ScrollUpFrame = ScrollFrame.ScrollUp
  1368. local ScrollUpGraphic = ArrowGraphic(graphicSize,horizontal and 'Left' or 'Up',true,graphicTemplate)
  1369. ScrollUpGraphic.Position = UDim2.new(0.5,-graphicSize/2,0.5,-graphicSize/2)
  1370. ScrollUpGraphic.Parent = ScrollUpFrame
  1371. local ScrollBarFrame = ScrollFrame.ScrollBar
  1372. local ScrollThumbFrame = ScrollBarFrame.ScrollThumb
  1373. do
  1374. local size = GUI_SIZE*3/8
  1375. local Decal = GripGraphic(Vector2.new(size,size),horizontal and 'Vertical' or 'Horizontal',2,graphicTemplate)
  1376. Decal.Position = UDim2.new(0.5,-size/2,0.5,-size/2)
  1377. Decal.Parent = ScrollThumbFrame
  1378. end
  1379.  
  1380. local Class = setmetatable({
  1381. GUI = ScrollFrame;
  1382. ScrollIndex = 0;
  1383. VisibleSpace = 0;
  1384. TotalSpace = 0;
  1385. PageIncrement = 1;
  1386. },mt)
  1387.  
  1388. local UpdateScrollThumb
  1389. if horizontal then
  1390. function UpdateScrollThumb()
  1391. ScrollThumbFrame.Size = UDim2.new(Class.VisibleSpace/Class.TotalSpace,0,0,GUI_SIZE)
  1392. if ScrollThumbFrame.AbsoluteSize.x < GUI_SIZE then
  1393. ScrollThumbFrame.Size = UDim2.new(0,GUI_SIZE,0,GUI_SIZE)
  1394. end
  1395. local barSize = ScrollBarFrame.AbsoluteSize.x
  1396. ScrollThumbFrame.Position = UDim2.new(Class:GetScrollPercent()*(barSize - ScrollThumbFrame.AbsoluteSize.x)/barSize,0,0,0)
  1397. end
  1398. else
  1399. function UpdateScrollThumb()
  1400. ScrollThumbFrame.Size = UDim2.new(0,GUI_SIZE,Class.VisibleSpace/Class.TotalSpace,0)
  1401. if ScrollThumbFrame.AbsoluteSize.y < GUI_SIZE then
  1402. ScrollThumbFrame.Size = UDim2.new(0,GUI_SIZE,0,GUI_SIZE)
  1403. end
  1404. local barSize = ScrollBarFrame.AbsoluteSize.y
  1405. ScrollThumbFrame.Position = UDim2.new(0,0,Class:GetScrollPercent()*(barSize - ScrollThumbFrame.AbsoluteSize.y)/barSize,0)
  1406. end
  1407. end
  1408.  
  1409. local lastDown
  1410. local lastUp
  1411. local scrollStyle = {BackgroundColor3=GuiColor.Border,BackgroundTransparency=0}
  1412. local scrollStyle_ds = {BackgroundColor3=GuiColor.Border,BackgroundTransparency=0.7}
  1413.  
  1414. local function Update()
  1415. local t = Class.TotalSpace
  1416. local v = Class.VisibleSpace
  1417. local s = Class.ScrollIndex
  1418. if v <= t then
  1419. if s > 0 then
  1420. if s + v > t then
  1421. Class.ScrollIndex = t - v
  1422. end
  1423. else
  1424. Class.ScrollIndex = 0
  1425. end
  1426. else
  1427. Class.ScrollIndex = 0
  1428. end
  1429.  
  1430. if Class.UpdateCallback then
  1431. if Class.UpdateCallback(Class) == false then
  1432. return
  1433. end
  1434. end
  1435.  
  1436. local down = Class:CanScrollDown()
  1437. local up = Class:CanScrollUp()
  1438. if down ~= lastDown then
  1439. lastDown = down
  1440. ScrollDownFrame.Active = down
  1441. ScrollDownFrame.AutoButtonColor = down
  1442. local children = ScrollDownGraphic:GetChildren()
  1443. local style = down and scrollStyle or scrollStyle_ds
  1444. for i = 1,#children do
  1445. Create(children[i],style)
  1446. end
  1447. end
  1448. if up ~= lastUp then
  1449. lastUp = up
  1450. ScrollUpFrame.Active = up
  1451. ScrollUpFrame.AutoButtonColor = up
  1452. local children = ScrollUpGraphic:GetChildren()
  1453. local style = up and scrollStyle or scrollStyle_ds
  1454. for i = 1,#children do
  1455. Create(children[i],style)
  1456. end
  1457. end
  1458. ScrollThumbFrame.Visible = down or up
  1459. UpdateScrollThumb()
  1460. end
  1461. Class.Update = Update
  1462.  
  1463. SetZIndexOnChanged(ScrollFrame)
  1464.  
  1465. local MouseDrag = Create('ImageButton',{
  1466. Name = "MouseDrag";
  1467. Position = UDim2.new(-0.25,0,-0.25,0);
  1468. Size = UDim2.new(1.5,0,1.5,0);
  1469. Transparency = 1;
  1470. AutoButtonColor = false;
  1471. Active = true;
  1472. ZIndex = 10;
  1473. })
  1474.  
  1475. local scrollEventID = 0
  1476. ScrollDownFrame.MouseButton1Down:connect(function()
  1477. scrollEventID = tick()
  1478. local current = scrollEventID
  1479. local up_con
  1480. up_con = MouseDrag.MouseButton1Up:connect(function()
  1481. scrollEventID = tick()
  1482. MouseDrag.Parent = nil
  1483. ResetButtonColor(ScrollDownFrame)
  1484. up_con:disconnect(); drag = nil
  1485. end)
  1486. MouseDrag.Parent = GetScreen(ScrollFrame)
  1487. Class:ScrollDown()
  1488. wait(0.2) -- delay before auto scroll
  1489. while scrollEventID == current do
  1490. Class:ScrollDown()
  1491. if not Class:CanScrollDown() then break end
  1492. wait()
  1493. end
  1494. end)
  1495.  
  1496. ScrollDownFrame.MouseButton1Up:connect(function()
  1497. scrollEventID = tick()
  1498. end)
  1499.  
  1500. ScrollUpFrame.MouseButton1Down:connect(function()
  1501. scrollEventID = tick()
  1502. local current = scrollEventID
  1503. local up_con
  1504. up_con = MouseDrag.MouseButton1Up:connect(function()
  1505. scrollEventID = tick()
  1506. MouseDrag.Parent = nil
  1507. ResetButtonColor(ScrollUpFrame)
  1508. up_con:disconnect(); drag = nil
  1509. end)
  1510. MouseDrag.Parent = GetScreen(ScrollFrame)
  1511. Class:ScrollUp()
  1512. wait(0.2)
  1513. while scrollEventID == current do
  1514. Class:ScrollUp()
  1515. if not Class:CanScrollUp() then break end
  1516. wait()
  1517. end
  1518. end)
  1519.  
  1520. ScrollUpFrame.MouseButton1Up:connect(function()
  1521. scrollEventID = tick()
  1522. end)
  1523.  
  1524. if horizontal then
  1525. ScrollBarFrame.MouseButton1Down:connect(function(x,y)
  1526. scrollEventID = tick()
  1527. local current = scrollEventID
  1528. local up_con
  1529. up_con = MouseDrag.MouseButton1Up:connect(function()
  1530. scrollEventID = tick()
  1531. MouseDrag.Parent = nil
  1532. ResetButtonColor(ScrollUpFrame)
  1533. up_con:disconnect(); drag = nil
  1534. end)
  1535. MouseDrag.Parent = GetScreen(ScrollFrame)
  1536. if x > ScrollThumbFrame.AbsolutePosition.x then
  1537. Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
  1538. wait(0.2)
  1539. while scrollEventID == current do
  1540. if x < ScrollThumbFrame.AbsolutePosition.x + ScrollThumbFrame.AbsoluteSize.x then break end
  1541. Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
  1542. wait()
  1543. end
  1544. else
  1545. Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
  1546. wait(0.2)
  1547. while scrollEventID == current do
  1548. if x > ScrollThumbFrame.AbsolutePosition.x then break end
  1549. Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
  1550. wait()
  1551. end
  1552. end
  1553. end)
  1554. else
  1555. ScrollBarFrame.MouseButton1Down:connect(function(x,y)
  1556. scrollEventID = tick()
  1557. local current = scrollEventID
  1558. local up_con
  1559. up_con = MouseDrag.MouseButton1Up:connect(function()
  1560. scrollEventID = tick()
  1561. MouseDrag.Parent = nil
  1562. ResetButtonColor(ScrollUpFrame)
  1563. up_con:disconnect(); drag = nil
  1564. end)
  1565. MouseDrag.Parent = GetScreen(ScrollFrame)
  1566. if y > ScrollThumbFrame.AbsolutePosition.y then
  1567. Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
  1568. wait(0.2)
  1569. while scrollEventID == current do
  1570. if y < ScrollThumbFrame.AbsolutePosition.y + ScrollThumbFrame.AbsoluteSize.y then break end
  1571. Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
  1572. wait()
  1573. end
  1574. else
  1575. Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
  1576. wait(0.2)
  1577. while scrollEventID == current do
  1578. if y > ScrollThumbFrame.AbsolutePosition.y then break end
  1579. Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
  1580. wait()
  1581. end
  1582. end
  1583. end)
  1584. end
  1585.  
  1586. if horizontal then
  1587. ScrollThumbFrame.MouseButton1Down:connect(function(x,y)
  1588. scrollEventID = tick()
  1589. local mouse_offset = x - ScrollThumbFrame.AbsolutePosition.x
  1590. local drag_con
  1591. local up_con
  1592. drag_con = MouseDrag.MouseMoved:connect(function(x,y)
  1593. local bar_abs_pos = ScrollBarFrame.AbsolutePosition.x
  1594. local bar_drag = ScrollBarFrame.AbsoluteSize.x - ScrollThumbFrame.AbsoluteSize.x
  1595. local bar_abs_one = bar_abs_pos + bar_drag
  1596. x = x - mouse_offset
  1597. x = x < bar_abs_pos and bar_abs_pos or x > bar_abs_one and bar_abs_one or x
  1598. x = x - bar_abs_pos
  1599. Class:SetScrollPercent(x/(bar_drag))
  1600. end)
  1601. up_con = MouseDrag.MouseButton1Up:connect(function()
  1602. scrollEventID = tick()
  1603. MouseDrag.Parent = nil
  1604. ResetButtonColor(ScrollThumbFrame)
  1605. drag_con:disconnect(); drag_con = nil
  1606. up_con:disconnect(); drag = nil
  1607. end)
  1608. MouseDrag.Parent = GetScreen(ScrollFrame)
  1609. end)
  1610. else
  1611. ScrollThumbFrame.MouseButton1Down:connect(function(x,y)
  1612. scrollEventID = tick()
  1613. local mouse_offset = y - ScrollThumbFrame.AbsolutePosition.y
  1614. local drag_con
  1615. local up_con
  1616. drag_con = MouseDrag.MouseMoved:connect(function(x,y)
  1617. local bar_abs_pos = ScrollBarFrame.AbsolutePosition.y
  1618. local bar_drag = ScrollBarFrame.AbsoluteSize.y - ScrollThumbFrame.AbsoluteSize.y
  1619. local bar_abs_one = bar_abs_pos + bar_drag
  1620. y = y - mouse_offset
  1621. y = y < bar_abs_pos and bar_abs_pos or y > bar_abs_one and bar_abs_one or y
  1622. y = y - bar_abs_pos
  1623. Class:SetScrollPercent(y/(bar_drag))
  1624. end)
  1625. up_con = MouseDrag.MouseButton1Up:connect(function()
  1626. scrollEventID = tick()
  1627. MouseDrag.Parent = nil
  1628. ResetButtonColor(ScrollThumbFrame)
  1629. drag_con:disconnect(); drag_con = nil
  1630. up_con:disconnect(); drag = nil
  1631. end)
  1632. MouseDrag.Parent = GetScreen(ScrollFrame)
  1633. end)
  1634. end
  1635.  
  1636. function Class:Destroy()
  1637. ScrollFrame:Destroy()
  1638. MouseDrag:Destroy()
  1639. for k in pairs(Class) do
  1640. Class[k] = nil
  1641. end
  1642. setmetatable(Class,nil)
  1643. end
  1644.  
  1645. Update()
  1646.  
  1647. return Class
  1648. end
  1649. end
  1650.  
  1651. ----------------------------------------------------------------
  1652. ----------------------------------------------------------------
  1653. ----------------------------------------------------------------
  1654. ----------------------------------------------------------------
  1655. ---- Explorer panel
  1656.  
  1657. local explorerPanel = script.Parent
  1658. Create(explorerPanel,{
  1659. BackgroundColor3 = GuiColor.Field;
  1660. BorderColor3 = GuiColor.Border;
  1661. Active = true;
  1662. })
  1663.  
  1664. local listFrame = Create('Frame',{
  1665. Name = "List";
  1666. BackgroundTransparency = 1;
  1667. ClipsDescendants = true;
  1668. Position = UDim2.new(0,0,0,HEADER_SIZE);
  1669. Size = UDim2.new(1,-GUI_SIZE,1,-HEADER_SIZE);
  1670. Parent = explorerPanel;
  1671. })
  1672.  
  1673. local scrollBar = ScrollBar(false)
  1674. scrollBar.PageIncrement = 1
  1675. Create(scrollBar.GUI,{
  1676. Position = UDim2.new(1,-GUI_SIZE,0,HEADER_SIZE);
  1677. Size = UDim2.new(0,GUI_SIZE,1,-HEADER_SIZE);
  1678. Parent = explorerPanel;
  1679. })
  1680.  
  1681. local scrollBarH = ScrollBar(true)
  1682. scrollBarH.PageIncrement = GUI_SIZE
  1683. Create(scrollBarH.GUI,{
  1684. Position = UDim2.new(0,0,1,-GUI_SIZE);
  1685. Size = UDim2.new(1,-GUI_SIZE,0,GUI_SIZE);
  1686. Visible = false;
  1687. Parent = explorerPanel;
  1688. })
  1689.  
  1690. local headerFrame = Create('Frame',{
  1691. Name = "Header";
  1692. BackgroundColor3 = GuiColor.Background;
  1693. BorderColor3 = GuiColor.Border;
  1694. Position = UDim2.new(0,0,0,0);
  1695. Size = UDim2.new(1,0,0,HEADER_SIZE);
  1696. Parent = explorerPanel;
  1697. Create('TextLabel',{
  1698. Text = "Explorer";
  1699. BackgroundTransparency = 1;
  1700. TextColor3 = GuiColor.Text;
  1701. TextXAlignment = 'Left';
  1702. Font = FONT;
  1703. FontSize = FONT_SIZE;
  1704. Position = UDim2.new(0,4,0,0);
  1705. Size = UDim2.new(1,-4,1,0);
  1706. });
  1707. })
  1708.  
  1709. SetZIndexOnChanged(explorerPanel)
  1710.  
  1711. local getTextWidth do
  1712. local text = Create('TextLabel',{
  1713. Name = "TextWidth";
  1714. TextXAlignment = 'Left';
  1715. TextYAlignment = 'Center';
  1716. Font = FONT;
  1717. FontSize = FONT_SIZE;
  1718. Text = "";
  1719. Position = UDim2.new(0,0,0,0);
  1720. Size = UDim2.new(1,0,1,0);
  1721. Visible = false;
  1722. Parent = explorerPanel;
  1723. })
  1724. function getTextWidth(s)
  1725. text.Text = s
  1726. return text.TextBounds.x
  1727. end
  1728. end
  1729.  
  1730. -- Holds the game tree converted to a list.
  1731. local TreeList = {}
  1732. -- Matches objects to their tree node representation.
  1733. local NodeLookup = {}
  1734.  
  1735. local nodeWidth = 0
  1736.  
  1737. local updateList,rawUpdateList,updateScroll,rawUpdateSize do
  1738. local function r(t)
  1739. for i = 1,#t do
  1740. TreeList[#TreeList+1] = t[i]
  1741.  
  1742. local w = (t[i].Depth)*(2+ENTRY_PADDING+GUI_SIZE) + 2 + ENTRY_SIZE + 4 + getTextWidth(t[i].Object.Name) + 4
  1743. if w > nodeWidth then
  1744. nodeWidth = w
  1745. end
  1746. if t[i].Expanded then
  1747. r(t[i])
  1748. end
  1749. end
  1750. end
  1751.  
  1752. function rawUpdateSize()
  1753. scrollBarH.TotalSpace = nodeWidth
  1754. scrollBarH.VisibleSpace = listFrame.AbsoluteSize.x
  1755. scrollBarH:Update()
  1756. local visible = scrollBarH:CanScrollDown() or scrollBarH:CanScrollUp()
  1757. scrollBarH.GUI.Visible = visible
  1758.  
  1759. listFrame.Size = UDim2.new(1,-GUI_SIZE,1,-GUI_SIZE*(visible and 1 or 0) - HEADER_SIZE)
  1760.  
  1761. scrollBar.VisibleSpace = math.ceil(listFrame.AbsoluteSize.y/ENTRY_BOUND)
  1762. scrollBar.GUI.Size = UDim2.new(0,GUI_SIZE,1,-GUI_SIZE*(visible and 1 or 0) - HEADER_SIZE)
  1763.  
  1764. scrollBar.TotalSpace = #TreeList+1
  1765. scrollBar:Update()
  1766. end
  1767.  
  1768. function rawUpdateList()
  1769. -- Clear then repopulate the entire list. It appears to be fast enough.
  1770. TreeList = {}
  1771. nodeWidth = 0
  1772. r(NodeLookup[Game])
  1773. rawUpdateSize()
  1774. end
  1775.  
  1776. -- Adding or removing large models will cause many updates to occur. We
  1777. -- can reduce the number of updates by creating a delay, then dropping any
  1778. -- updates that occur during the delay.
  1779. local updatingList = false
  1780. function updateList()
  1781. if updatingList then return end
  1782. updatingList = true
  1783. wait(0.25)
  1784. updatingList = false
  1785. rawUpdateList()
  1786. end
  1787.  
  1788. local updatingScroll = false
  1789. function updateScroll()
  1790. if updatingScroll then return end
  1791. updatingScroll = true
  1792. wait(0.25)
  1793. updatingScroll = false
  1794. scrollBar:Update()
  1795. end
  1796. end
  1797.  
  1798. local Selection do
  1799. local bindGetSelection = script.Parent:FindFirstChild("GetSelection")
  1800. if not bindGetSelection then
  1801. bindGetSelection = Create('BindableFunction',{Name = "GetSelection"})
  1802. bindGetSelection.Parent = script.Parent
  1803. end
  1804.  
  1805. local bindSetSelection = script.Parent:FindFirstChild("SetSelection")
  1806. if not bindSetSelection then
  1807. bindSetSelection = Create('BindableFunction',{Name = "SetSelection"})
  1808. bindSetSelection.Parent = script.Parent
  1809. end
  1810.  
  1811. local bindSelectionChanged = script.Parent:FindFirstChild("SelectionChanged")
  1812. if not bindSelectionChanged then
  1813. bindSelectionChanged = Create('BindableEvent',{Name = "SelectionChanged"})
  1814. bindSelectionChanged.Parent = script.Parent
  1815. end
  1816.  
  1817. local SelectionList = {}
  1818. local SelectionSet = {}
  1819. Selection = {
  1820. Selected = SelectionSet;
  1821. List = SelectionList;
  1822. }
  1823.  
  1824. local function addObject(object)
  1825. -- list update
  1826. local lupdate = false
  1827. -- scroll update
  1828. local supdate = false
  1829.  
  1830. if not SelectionSet[object] then
  1831. local node = NodeLookup[object]
  1832. if node then
  1833. table.insert(SelectionList,object)
  1834. SelectionSet[object] = true
  1835. node.Selected = true
  1836.  
  1837. -- expand all ancestors so that selected node becomes visible
  1838. node = node.Parent
  1839. while node do
  1840. if not node.Expanded then
  1841. node.Expanded = true
  1842. lupdate = true
  1843. end
  1844. node = node.Parent
  1845. end
  1846. supdate = true
  1847. end
  1848. end
  1849. return lupdate,supdate
  1850. end
  1851.  
  1852. function Selection:Set(objects)
  1853. local lupdate = false
  1854. local supdate = false
  1855.  
  1856. if #SelectionList > 0 then
  1857. for i = 1,#SelectionList do
  1858. local object = SelectionList[i]
  1859. local node = NodeLookup[object]
  1860. if node then
  1861. node.Selected = false
  1862. SelectionSet[object] = nil
  1863. end
  1864. end
  1865.  
  1866. SelectionList = {}
  1867. Selection.List = SelectionList
  1868. supdate = true
  1869. end
  1870.  
  1871. for i = 1,#objects do
  1872. local l,s = addObject(objects[i])
  1873. lupdate = l or lupdate
  1874. supdate = s or supdate
  1875. end
  1876.  
  1877. if lupdate then
  1878. rawUpdateList()
  1879. supdate = true
  1880. elseif supdate then
  1881. scrollBar:Update()
  1882. end
  1883.  
  1884. if supdate then
  1885. bindSelectionChanged:Fire()
  1886. end
  1887. end
  1888.  
  1889. function Selection:Add(object)
  1890. local l,s = addObject(object)
  1891. if l then
  1892. rawUpdateList()
  1893. bindSelectionChanged:Fire()
  1894. elseif s then
  1895. scrollBar:Update()
  1896. bindSelectionChanged:Fire()
  1897. end
  1898. end
  1899.  
  1900. function Selection:Remove(object,noupdate)
  1901. if SelectionSet[object] then
  1902. local node = NodeLookup[object]
  1903. if node then
  1904. node.Selected = false
  1905. SelectionSet[object] = nil
  1906. for i = 1,#SelectionList do
  1907. if SelectionList[i] == object then
  1908. table.remove(SelectionList,i)
  1909. break
  1910. end
  1911. end
  1912.  
  1913. if not noupdate then
  1914. scrollBar:Update()
  1915. end
  1916. bindSelectionChanged:Fire()
  1917. end
  1918. end
  1919. end
  1920.  
  1921. function Selection:Get()
  1922. local list = {}
  1923. for i = 1,#SelectionList do
  1924. list[i] = SelectionList[i]
  1925. end
  1926. return list
  1927. end
  1928.  
  1929. bindSetSelection.OnInvoke = function(...)
  1930. Selection:Set(...)
  1931. end
  1932.  
  1933. bindGetSelection.OnInvoke = function()
  1934. return Selection:Get()
  1935. end
  1936. end
  1937.  
  1938. local function cancelReparentDrag()end
  1939. local function cancelSelectDrag()end
  1940. do
  1941. local listEntries = {}
  1942. local nameConnLookup = {}
  1943.  
  1944. local mouseDrag = Create('ImageButton',{
  1945. Name = "MouseDrag";
  1946. Position = UDim2.new(-0.25,0,-0.25,0);
  1947. Size = UDim2.new(1.5,0,1.5,0);
  1948. Transparency = 1;
  1949. AutoButtonColor = false;
  1950. Active = true;
  1951. ZIndex = 10;
  1952. })
  1953. local function dragSelect(last,add,button)
  1954. local connDrag
  1955. local conUp
  1956.  
  1957. conDrag = mouseDrag.MouseMoved:connect(function(x,y)
  1958. local pos = Vector2.new(x,y) - listFrame.AbsolutePosition
  1959. local size = listFrame.AbsoluteSize
  1960. if pos.x < 0 or pos.x > size.x or pos.y < 0 or pos.y > size.y then return end
  1961.  
  1962. local i = math.ceil(pos.y/ENTRY_BOUND) + scrollBar.ScrollIndex
  1963. -- Mouse may have made a large step, so interpolate between the
  1964. -- last index and the current.
  1965. for n = i<last and i or last, i>last and i or last do
  1966. local node = TreeList[n]
  1967. if node then
  1968. if add then
  1969. Selection:Add(node.Object)
  1970. else
  1971. Selection:Remove(node.Object)
  1972. end
  1973. end
  1974. end
  1975. last = i
  1976. end)
  1977.  
  1978. function cancelSelectDrag()
  1979. mouseDrag.Parent = nil
  1980. conDrag:disconnect()
  1981. conUp:disconnect()
  1982. function cancelSelectDrag()end
  1983. end
  1984.  
  1985. conUp = mouseDrag[button]:connect(cancelSelectDrag)
  1986.  
  1987. mouseDrag.Parent = GetScreen(listFrame)
  1988. end
  1989.  
  1990. local function dragReparent(object,dragGhost,clickPos,ghostOffset)
  1991. local connDrag
  1992. local conUp
  1993. local conUp2
  1994.  
  1995. local parentIndex = nil
  1996. local dragged = false
  1997.  
  1998. local parentHighlight = Create('Frame',{
  1999. Transparency = 1;
  2000. Visible = false;
  2001. Create('Frame',{
  2002. BorderSizePixel = 0;
  2003. BackgroundColor3 = Color3.new(0,0,0);
  2004. BackgroundTransparency = 0.1;
  2005. Position = UDim2.new(0,0,0,0);
  2006. Size = UDim2.new(1,0,0,1);
  2007. });
  2008. Create('Frame',{
  2009. BorderSizePixel = 0;
  2010. BackgroundColor3 = Color3.new(0,0,0);
  2011. BackgroundTransparency = 0.1;
  2012. Position = UDim2.new(1,0,0,0);
  2013. Size = UDim2.new(0,1,1,0);
  2014. });
  2015. Create('Frame',{
  2016. BorderSizePixel = 0;
  2017. BackgroundColor3 = Color3.new(0,0,0);
  2018. BackgroundTransparency = 0.1;
  2019. Position = UDim2.new(0,0,1,0);
  2020. Size = UDim2.new(1,0,0,1);
  2021. });
  2022. Create('Frame',{
  2023. BorderSizePixel = 0;
  2024. BackgroundColor3 = Color3.new(0,0,0);
  2025. BackgroundTransparency = 0.1;
  2026. Position = UDim2.new(0,0,0,0);
  2027. Size = UDim2.new(0,1,1,0);
  2028. });
  2029. })
  2030. SetZIndex(parentHighlight,9)
  2031.  
  2032. conDrag = mouseDrag.MouseMoved:connect(function(x,y)
  2033. local dragPos = Vector2.new(x,y)
  2034. if dragged then
  2035. local pos = dragPos - listFrame.AbsolutePosition
  2036. local size = listFrame.AbsoluteSize
  2037.  
  2038. parentIndex = nil
  2039. parentHighlight.Visible = false
  2040. if pos.x >= 0 and pos.x <= size.x and pos.y >= 0 and pos.y <= size.y then
  2041. local i = math.ceil(pos.y/ENTRY_BOUND)
  2042. local node = TreeList[i + scrollBar.ScrollIndex]
  2043. if node and node.Object ~= object and not object:IsAncestorOf(node.Object) then
  2044. parentIndex = i
  2045. local entry = listEntries[i]
  2046. if entry then
  2047. parentHighlight.Visible = true
  2048. parentHighlight.Position = UDim2.new(0,1,0,entry.AbsolutePosition.y-listFrame.AbsolutePosition.y)
  2049. parentHighlight.Size = UDim2.new(0,size.x-4,0,entry.AbsoluteSize.y)
  2050. end
  2051. end
  2052. end
  2053.  
  2054. dragGhost.Position = UDim2.new(0,dragPos.x+ghostOffset.x,0,dragPos.y+ghostOffset.y)
  2055. elseif (clickPos-dragPos).magnitude > 8 then
  2056. dragged = true
  2057. SetZIndex(dragGhost,9)
  2058. dragGhost.IndentFrame.Transparency = 0.25
  2059. dragGhost.IndentFrame.EntryText.TextColor3 = GuiColor.TextSelected
  2060. dragGhost.Position = UDim2.new(0,dragPos.x+ghostOffset.x,0,dragPos.y+ghostOffset.y)
  2061. dragGhost.Parent = GetScreen(listFrame)
  2062. parentHighlight.Parent = listFrame
  2063. end
  2064. end)
  2065.  
  2066. function cancelReparentDrag()
  2067. mouseDrag.Parent = nil
  2068. conDrag:disconnect()
  2069. conUp:disconnect()
  2070. conUp2:disconnect()
  2071. dragGhost:Destroy()
  2072. parentHighlight:Destroy()
  2073. function cancelReparentDrag()end
  2074. end
  2075.  
  2076. local wasSelected = Selection.Selected[object]
  2077. if not wasSelected and Option.Selectable then
  2078. Selection:Set({object})
  2079. end
  2080.  
  2081. conUp = mouseDrag.MouseButton1Up:connect(function()
  2082. cancelReparentDrag()
  2083. if dragged then
  2084. if parentIndex then
  2085. local parentNode = TreeList[parentIndex + scrollBar.ScrollIndex]
  2086. if parentNode then
  2087. parentNode.Expanded = true
  2088.  
  2089. local parentObj = parentNode.Object
  2090. local function parent(a,b)
  2091. a.Parent = b
  2092. end
  2093. if Option.Selectable then
  2094. local list = Selection.List
  2095. for i = 1,#list do
  2096. pcall(parent,list[i],parentObj)
  2097. end
  2098. else
  2099. pcall(parent,object,parentObj)
  2100. end
  2101. end
  2102. end
  2103. else
  2104. -- do selection click
  2105. if wasSelected and Option.Selectable then
  2106. Selection:Set({})
  2107. end
  2108. end
  2109. end)
  2110. conUp2 = mouseDrag.MouseButton2Down:connect(function()
  2111. cancelReparentDrag()
  2112. end)
  2113.  
  2114. mouseDrag.Parent = GetScreen(listFrame)
  2115. end
  2116.  
  2117. local entryTemplate = Create('ImageButton',{
  2118. Name = "Entry";
  2119. Transparency = 1;
  2120. AutoButtonColor = false;
  2121. Position = UDim2.new(0,0,0,0);
  2122. Size = UDim2.new(1,0,0,ENTRY_SIZE);
  2123. Create('Frame',{
  2124. Name = "IndentFrame";
  2125. BackgroundTransparency = 1;
  2126. BackgroundColor3 = GuiColor.Selected;
  2127. BorderColor3 = GuiColor.BorderSelected;
  2128. Position = UDim2.new(0,0,0,0);
  2129. Size = UDim2.new(1,0,1,0);
  2130. Create(Icon('ImageButton',0),{
  2131. Name = "Expand";
  2132. AutoButtonColor = false;
  2133. Position = UDim2.new(0,-GUI_SIZE,0.5,-GUI_SIZE/2);
  2134. Size = UDim2.new(0,GUI_SIZE,0,GUI_SIZE);
  2135. });
  2136. Create(Icon(nil,0),{
  2137. Name = "ExplorerIcon";
  2138. Position = UDim2.new(0,2+ENTRY_PADDING,0.5,-GUI_SIZE/2);
  2139. Size = UDim2.new(0,GUI_SIZE,0,GUI_SIZE);
  2140. });
  2141. Create('TextLabel',{
  2142. Name = "EntryText";
  2143. BackgroundTransparency = 1;
  2144. TextColor3 = GuiColor.Text;
  2145. TextXAlignment = 'Left';
  2146. TextYAlignment = 'Center';
  2147. Font = FONT;
  2148. FontSize = FONT_SIZE;
  2149. Text = "";
  2150. Position = UDim2.new(0,2+ENTRY_SIZE+4,0,0);
  2151. Size = UDim2.new(1,-2,1,0);
  2152. });
  2153. });
  2154. })
  2155.  
  2156. function scrollBar.UpdateCallback(self)
  2157. for i = 1,self.VisibleSpace do
  2158. local node = TreeList[i + self.ScrollIndex]
  2159. if node then
  2160. local entry = listEntries[i]
  2161. if not entry then
  2162. entry = Create(entryTemplate:Clone(),{
  2163. Position = UDim2.new(0,2,0,ENTRY_BOUND*(i-1)+2);
  2164. Size = UDim2.new(0,nodeWidth,0,ENTRY_SIZE);
  2165. ZIndex = listFrame.ZIndex;
  2166. })
  2167. listEntries[i] = entry
  2168.  
  2169. local expand = entry.IndentFrame.Expand
  2170. expand.MouseEnter:connect(function()
  2171. local node = TreeList[i + self.ScrollIndex]
  2172. if #node > 0 then
  2173. if node.Expanded then
  2174. Icon(expand,NODE_EXPANDED_OVER)
  2175. else
  2176. Icon(expand,NODE_COLLAPSED_OVER)
  2177. end
  2178. end
  2179. end)
  2180. expand.MouseLeave:connect(function()
  2181. local node = TreeList[i + self.ScrollIndex]
  2182. if #node > 0 then
  2183. if node.Expanded then
  2184. Icon(expand,NODE_EXPANDED)
  2185. else
  2186. Icon(expand,NODE_COLLAPSED)
  2187. end
  2188. end
  2189. end)
  2190. expand.MouseButton1Down:connect(function()
  2191. local node = TreeList[i + self.ScrollIndex]
  2192. if #node > 0 then
  2193. node.Expanded = not node.Expanded
  2194. -- use raw update so the list updates instantly
  2195. rawUpdateList()
  2196. end
  2197. end)
  2198.  
  2199. entry.MouseButton1Down:connect(function(x,y)
  2200. local node = TreeList[i + self.ScrollIndex]
  2201. if Option.Modifiable then
  2202. local pos = Vector2.new(x,y)
  2203. dragReparent(node.Object,entry:Clone(),pos,entry.AbsolutePosition-pos)
  2204. elseif Option.Selectable then
  2205. if Selection.Selected[node.Object] then
  2206. Selection:Set({})
  2207. else
  2208. Selection:Set({node.Object})
  2209. end
  2210. dragSelect(i+self.ScrollIndex,true,'MouseButton1Up')
  2211. end
  2212. end)
  2213.  
  2214. entry.MouseButton2Down:connect(function()
  2215. if not Option.Selectable then return end
  2216.  
  2217. local node = TreeList[i + self.ScrollIndex]
  2218. if Selection.Selected[node.Object] then
  2219. Selection:Remove(node.Object)
  2220. dragSelect(i+self.ScrollIndex,false,'MouseButton2Up')
  2221. else
  2222. Selection:Add(node.Object)
  2223. dragSelect(i+self.ScrollIndex,true,'MouseButton2Up')
  2224. end
  2225. end)
  2226.  
  2227. entry.Parent = listFrame
  2228. end
  2229.  
  2230. entry.Visible = true
  2231.  
  2232. local object = node.Object
  2233.  
  2234. -- update expand icon
  2235. if #node == 0 then
  2236. entry.IndentFrame.Expand.Visible = false
  2237. elseif node.Expanded then
  2238. Icon(entry.IndentFrame.Expand,NODE_EXPANDED)
  2239. entry.IndentFrame.Expand.Visible = true
  2240. else
  2241. Icon(entry.IndentFrame.Expand,NODE_COLLAPSED)
  2242. entry.IndentFrame.Expand.Visible = true
  2243. end
  2244.  
  2245. -- update explorer icon
  2246. Icon(entry.IndentFrame.ExplorerIcon,ExplorerIndex[object.ClassName] or 0)
  2247.  
  2248. -- update indentation
  2249. local w = (node.Depth)*(2+ENTRY_PADDING+GUI_SIZE)
  2250. entry.IndentFrame.Position = UDim2.new(0,w,0,0)
  2251. entry.IndentFrame.Size = UDim2.new(1,-w,1,0)
  2252.  
  2253. -- update name change detection
  2254. if nameConnLookup[entry] then
  2255. nameConnLookup[entry]:disconnect()
  2256. end
  2257. local text = entry.IndentFrame.EntryText
  2258. text.Text = object.Name
  2259. nameConnLookup[entry] = node.Object.Changed:connect(function(p)
  2260. if p == 'Name' then
  2261. text.Text = object.Name
  2262. end
  2263. end)
  2264.  
  2265. -- update selection
  2266. entry.IndentFrame.Transparency = node.Selected and 0 or 1
  2267. text.TextColor3 = GuiColor[node.Selected and 'TextSelected' or 'Text']
  2268.  
  2269. entry.Size = UDim2.new(0,nodeWidth,0,ENTRY_SIZE)
  2270. elseif listEntries[i] then
  2271. listEntries[i].Visible = false
  2272. end
  2273. end
  2274. for i = self.VisibleSpace+1,self.TotalSpace do
  2275. local entry = listEntries[i]
  2276. if entry then
  2277. listEntries[i] = nil
  2278. entry:Destroy()
  2279. end
  2280. end
  2281. end
  2282.  
  2283. function scrollBarH.UpdateCallback(self)
  2284. for i = 1,scrollBar.VisibleSpace do
  2285. local node = TreeList[i + scrollBar.ScrollIndex]
  2286. if node then
  2287. local entry = listEntries[i]
  2288. if entry then
  2289. entry.Position = UDim2.new(0,2 - scrollBarH.ScrollIndex,0,ENTRY_BOUND*(i-1)+2)
  2290. end
  2291. end
  2292. end
  2293. end
  2294.  
  2295. Connect(listFrame.Changed,function(p)
  2296. if p == 'AbsoluteSize' then
  2297. rawUpdateSize()
  2298. end
  2299. end)
  2300.  
  2301. local wheelAmount = 6
  2302. explorerPanel.MouseWheelForward:connect(function()
  2303. if scrollBar.VisibleSpace - 1 > wheelAmount then
  2304. scrollBar:ScrollTo(scrollBar.ScrollIndex - wheelAmount)
  2305. else
  2306. scrollBar:ScrollTo(scrollBar.ScrollIndex - scrollBar.VisibleSpace)
  2307. end
  2308. end)
  2309. explorerPanel.MouseWheelBackward:connect(function()
  2310. if scrollBar.VisibleSpace - 1 > wheelAmount then
  2311. scrollBar:ScrollTo(scrollBar.ScrollIndex + wheelAmount)
  2312. else
  2313. scrollBar:ScrollTo(scrollBar.ScrollIndex + scrollBar.VisibleSpace)
  2314. end
  2315. end)
  2316. end
  2317.  
  2318. ----------------------------------------------------------------
  2319. ----------------------------------------------------------------
  2320. ----------------------------------------------------------------
  2321. ----------------------------------------------------------------
  2322. ---- Object detection
  2323.  
  2324. -- Inserts `v` into `t` at `i`. Also sets `Index` field in `v`.
  2325. local function insert(t,i,v)
  2326. for n = #t,i,-1 do
  2327. local v = t[n]
  2328. v.Index = n+1
  2329. t[n+1] = v
  2330. end
  2331. v.Index = i
  2332. t[i] = v
  2333. end
  2334.  
  2335. -- Removes `i` from `t`. Also sets `Index` field in removed value.
  2336. local function remove(t,i)
  2337. local v = t[i]
  2338. for n = i+1,#t do
  2339. local v = t[n]
  2340. v.Index = n-1
  2341. t[n-1] = v
  2342. end
  2343. t[#t] = nil
  2344. v.Index = 0
  2345. return v
  2346. end
  2347.  
  2348. -- Returns how deep `o` is in the tree.
  2349. local function depth(o)
  2350. local d = -1
  2351. while o do
  2352. o = o.Parent
  2353. d = d + 1
  2354. end
  2355. return d
  2356. end
  2357.  
  2358.  
  2359. local connLookup = {}
  2360.  
  2361. -- Returns whether a node would be present in the tree list
  2362. local function nodeIsVisible(node)
  2363. local visible = true
  2364. node = node.Parent
  2365. while node and visible do
  2366. visible = visible and node.Expanded
  2367. node = node.Parent
  2368. end
  2369. return visible
  2370. end
  2371.  
  2372. -- Removes an object's tree node. Called when the object stops existing in the
  2373. -- game tree.
  2374. local function removeObject(object)
  2375. local objectNode = NodeLookup[object]
  2376. if not objectNode then
  2377. return
  2378. end
  2379.  
  2380. local visible = nodeIsVisible(objectNode)
  2381.  
  2382. Selection:Remove(object,true)
  2383.  
  2384. local parent = objectNode.Parent
  2385. remove(parent,objectNode.Index)
  2386. NodeLookup[object] = nil
  2387. connLookup[object]:disconnect()
  2388. connLookup[object] = nil
  2389.  
  2390. if visible then
  2391. updateList()
  2392. elseif nodeIsVisible(parent) then
  2393. updateScroll()
  2394. end
  2395. end
  2396.  
  2397. -- Moves a tree node to a new parent. Called when an existing object's parent
  2398. -- changes.
  2399. local function moveObject(object,parent)
  2400. local objectNode = NodeLookup[object]
  2401. if not objectNode then
  2402. return
  2403. end
  2404.  
  2405. local parentNode = NodeLookup[parent]
  2406. if not parentNode then
  2407. return
  2408. end
  2409.  
  2410. local visible = nodeIsVisible(objectNode)
  2411.  
  2412. remove(objectNode.Parent,objectNode.Index)
  2413. objectNode.Parent = parentNode
  2414.  
  2415. objectNode.Depth = depth(object)
  2416. local function r(node,d)
  2417. for i = 1,#node do
  2418. node[i].Depth = d
  2419. r(node[i],d+1)
  2420. end
  2421. end
  2422. r(objectNode,objectNode.Depth+1)
  2423.  
  2424. insert(parentNode,#parentNode+1,objectNode)
  2425.  
  2426. if visible or nodeIsVisible(objectNode) then
  2427. updateList()
  2428. elseif nodeIsVisible(objectNode.Parent) then
  2429. updateScroll()
  2430. end
  2431. end
  2432.  
  2433. -- ScriptContext['/Libraries/LibraryRegistration/LibraryRegistration']
  2434. -- This RobloxLocked object lets me index its properties for some reason
  2435.  
  2436. local function check(object)
  2437. return object.AncestryChanged
  2438. end
  2439.  
  2440. -- Creates a new tree node from an object. Called when an object starts
  2441. -- existing in the game tree.
  2442. local function addObject(object,noupdate)
  2443. if script then
  2444. -- protect against naughty RobloxLocked objects
  2445. local s = pcall(check,object)
  2446. if not s then
  2447. return
  2448. end
  2449. end
  2450.  
  2451. local parentNode = NodeLookup[object.Parent]
  2452. if not parentNode then
  2453. return
  2454. end
  2455.  
  2456. local objectNode = {
  2457. Object = object;
  2458. Parent = parentNode;
  2459. Index = 0;
  2460. Expanded = false;
  2461. Selected = false;
  2462. Depth = depth(object);
  2463. }
  2464.  
  2465. connLookup[object] = Connect(object.AncestryChanged,function(c,p)
  2466. if c == object then
  2467. if p == nil then
  2468. removeObject(c)
  2469. else
  2470. moveObject(c,p)
  2471. end
  2472. end
  2473. end)
  2474.  
  2475. NodeLookup[object] = objectNode
  2476. insert(parentNode,#parentNode+1,objectNode)
  2477.  
  2478. if not noupdate then
  2479. if nodeIsVisible(objectNode) then
  2480. updateList()
  2481. elseif nodeIsVisible(objectNode.Parent) then
  2482. updateScroll()
  2483. end
  2484. end
  2485. end
  2486.  
  2487. do
  2488. NodeLookup[Game] = {
  2489. Object = Game;
  2490. Parent = nil;
  2491. Index = 0;
  2492. Expanded = true;
  2493. }
  2494.  
  2495. Connect(Game.DescendantAdded,addObject)
  2496. Connect(Game.DescendantRemoving,removeObject)
  2497.  
  2498. local function get(o)
  2499. return o:GetChildren()
  2500. end
  2501.  
  2502. local function r(o)
  2503. local s,children = pcall(get,o)
  2504. if s then
  2505. for i = 1,#children do
  2506. addObject(children[i],true)
  2507. r(children[i])
  2508. end
  2509. end
  2510. end
  2511.  
  2512. r(Game)
  2513.  
  2514. scrollBar.VisibleSpace = math.ceil(listFrame.AbsoluteSize.y/ENTRY_BOUND)
  2515. updateList()
  2516. end
  2517.  
  2518. ----------------------------------------------------------------
  2519. ----------------------------------------------------------------
  2520. ----------------------------------------------------------------
  2521. ----------------------------------------------------------------
  2522. ---- Actions
  2523.  
  2524. local actionButtons do
  2525. actionButtons = {}
  2526.  
  2527. local totalActions = (4) + 1
  2528. local currentActions = totalActions
  2529. local function makeButton(icon,over,name)
  2530. local button = Create(Icon('ImageButton',icon),{
  2531. Name = name .. "Button";
  2532. Visible = Option.Modifiable and Option.Selectable;
  2533. Position = UDim2.new(1,-(GUI_SIZE+2)*currentActions+2,0.5,-GUI_SIZE/2);
  2534. Size = UDim2.new(0,GUI_SIZE,0,GUI_SIZE);
  2535. Parent = headerFrame;
  2536. })
  2537.  
  2538. local tipText = Create('TextLabel',{
  2539. Name = name .. "Text";
  2540. Text = name;
  2541. Visible = false;
  2542. BackgroundTransparency = 1;
  2543. TextXAlignment = 'Right';
  2544. Font = FONT;
  2545. FontSize = FONT_SIZE;
  2546. Position = UDim2.new(0,0,0,0);
  2547. Size = UDim2.new(1,-(GUI_SIZE+2)*totalActions,1,0);
  2548. Parent = headerFrame;
  2549. })
  2550.  
  2551.  
  2552. button.MouseEnter:connect(function()
  2553. Icon(button,over)
  2554. tipText.Visible = true
  2555. end)
  2556. button.MouseLeave:connect(function()
  2557. Icon(button,icon)
  2558. tipText.Visible = false
  2559. end)
  2560.  
  2561. currentActions = currentActions - 1
  2562. actionButtons[#actionButtons+1] = button
  2563. return button
  2564. end
  2565.  
  2566. local clipboard = {}
  2567. local function delete(o)
  2568. o.Parent = nil
  2569. end
  2570.  
  2571. -- CUT
  2572. makeButton(ACTION_CUT,ACTION_CUT_OVER,"Cut").MouseButton1Click:connect(function()
  2573. if not Option.Modifiable then return end
  2574. clipboard = {}
  2575. local list = Selection.List
  2576. local cut = {}
  2577. for i = 1,#list do
  2578. local obj = list[i]:Clone()
  2579. if obj then
  2580. table.insert(clipboard,obj)
  2581. table.insert(cut,list[i])
  2582. end
  2583. end
  2584. for i = 1,#cut do
  2585. pcall(delete,cut[i])
  2586. end
  2587. end)
  2588.  
  2589. -- COPY
  2590. makeButton(ACTION_COPY,ACTION_COPY_OVER,"Copy").MouseButton1Click:connect(function()
  2591. if not Option.Modifiable then return end
  2592. clipboard = {}
  2593. local list = Selection.List
  2594. for i = 1,#list do
  2595. table.insert(clipboard,list[i]:Clone())
  2596. end
  2597. end)
  2598.  
  2599. -- PASTE
  2600. makeButton(ACTION_PASTE,ACTION_PASTE_OVER,"Paste").MouseButton1Click:connect(function()
  2601. if not Option.Modifiable then return end
  2602. local parent = Selection.List[1] or Workspace
  2603. for i = 1,#clipboard do
  2604. clipboard[i]:Clone().Parent = parent
  2605. end
  2606. end)
  2607.  
  2608. -- DELETE
  2609. makeButton(ACTION_DELETE,ACTION_DELETE_OVER,"Delete").MouseButton1Click:connect(function()
  2610. if not Option.Modifiable then return end
  2611. local list = Selection:Get()
  2612. for i = 1,#list do
  2613. pcall(delete,list[i])
  2614. end
  2615. Selection:Set({})
  2616. end)
  2617.  
  2618. -- SORT
  2619. -- local actionSort = makeButton(ACTION_SORT,ACTION_SORT_OVER,"Sort")
  2620. end
  2621.  
  2622. ----------------------------------------------------------------
  2623. ----------------------------------------------------------------
  2624. ----------------------------------------------------------------
  2625. ----------------------------------------------------------------
  2626. ---- Option Bindables
  2627.  
  2628. do
  2629. local optionCallback = {
  2630. Modifiable = function(value)
  2631. for i = 1,#actionButtons do
  2632. actionButtons[i].Visible = value and Option.Selectable
  2633. end
  2634. cancelReparentDrag()
  2635. end;
  2636. Selectable = function(value)
  2637. for i = 1,#actionButtons do
  2638. actionButtons[i].Visible = value and Option.Modifiable
  2639. end
  2640. cancelSelectDrag()
  2641. Selection:Set({})
  2642. end;
  2643. }
  2644.  
  2645. local bindSetOption = script.Parent:FindFirstChild("SetOption")
  2646. if not bindSetOption then
  2647. bindSetOption = Create('BindableFunction',{Name = "SetOption"})
  2648. bindSetOption.Parent = script.Parent
  2649. end
  2650.  
  2651. bindSetOption.OnInvoke = function(optionName,value)
  2652. if optionCallback[optionName] then
  2653. Option[optionName] = value
  2654. optionCallback[optionName](value)
  2655. end
  2656. end
  2657.  
  2658. local bindGetOption = script.Parent:FindFirstChild("GetOption")
  2659. if not bindGetOption then
  2660. bindGetOption = Create('BindableFunction',{Name = "GetOption"})
  2661. bindGetOption.Parent = script.Parent
  2662. end
  2663.  
  2664. bindGetOption.OnInvoke = function(optionName)
  2665. if optionName then
  2666. return Option[optionName]
  2667. else
  2668. local options = {}
  2669. for k,v in pairs(Option) do
  2670. options[k] = v
  2671. end
  2672. return options
  2673. end
  2674. end
  2675. end
  2676.  
  2677. end))
  2678. BindableEvent37.Name = "SelectionChanged"
  2679. BindableEvent37.Parent = Frame35
  2680. BindableFunction38.Name = "SetOption"
  2681. BindableFunction38.Parent = Frame35
  2682. BindableFunction39.Name = "SetSelection"
  2683. BindableFunction39.Parent = Frame35
  2684. BindableFunction40.Name = "GetOption"
  2685. BindableFunction40.Parent = Frame35
  2686. BindableFunction41.Name = "GetSelection"
  2687. BindableFunction41.Parent = Frame35
  2688. TextLabel42.Name = "rrr"
  2689. TextLabel42.Parent = ScreenGui0
  2690. TextLabel42.Size = UDim2.new(0, 30, 0, 40)
  2691. TextLabel42.Text = ">"
  2692. TextLabel42.Position = UDim2.new(0, 163, 0, 330)
  2693. TextLabel42.Active = true
  2694. TextLabel42.Visible = false
  2695. TextLabel42.BackgroundColor3 = Color3.new(0, 0, 0)
  2696. TextLabel42.BorderSizePixel = 0
  2697. TextLabel42.Font = Enum.Font.SourceSansBold
  2698. TextLabel42.FontSize = Enum.FontSize.Size36
  2699. TextLabel42.TextColor3 = Color3.new(0, 0, 0)
  2700. TextLabel42.TextStrokeColor3 = Color3.new(1, 1, 1)
  2701. TextLabel42.TextStrokeTransparency = 0
  2702. TextLabel43.Name = "lll"
  2703. TextLabel43.Parent = ScreenGui0
  2704. TextLabel43.Size = UDim2.new(0, 30, 0, 40)
  2705. TextLabel43.Text = ">"
  2706. TextLabel43.Position = UDim2.new(0, 15, 0, 330)
  2707. TextLabel43.Active = true
  2708. TextLabel43.Visible = false
  2709. TextLabel43.BackgroundColor3 = Color3.new(0, 0, 0)
  2710. TextLabel43.BorderSizePixel = 0
  2711. TextLabel43.Font = Enum.Font.SourceSansBold
  2712. TextLabel43.FontSize = Enum.FontSize.Size36
  2713. TextLabel43.TextColor3 = Color3.new(0, 0, 0)
  2714. TextLabel43.TextStrokeColor3 = Color3.new(1, 1, 1)
  2715. TextLabel43.TextStrokeTransparency = 0
  2716. Frame44.Name = "Tools"
  2717. Frame44.Parent = ScreenGui0
  2718. Frame44.Transparency = 1
  2719. Frame44.Size = UDim2.new(0, 100, 0, 100)
  2720. Frame44.Active = true
  2721. Frame44.Visible = false
  2722. Frame44.BackgroundColor3 = Color3.new(1, 1, 1)
  2723. Frame44.BackgroundTransparency = 1
  2724. Frame44.BorderSizePixel = 0
  2725. for i,v in pairs(mas:GetChildren()) do
  2726. v.Parent = game:GetService("Players").LocalPlayer.PlayerGui
  2727. pcall(function() v:MakeJoints() end)
  2728. end
  2729. mas:Destroy()
  2730. for i,v in pairs(cors) do
  2731. spawn(function()
  2732. pcall(v)
  2733. end)
  2734. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement