Advertisement
advancedev

roblox dev

Mar 13th, 2015
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.73 KB | None | 0 0
  1. --Include
  2. local Create = assert(LoadLibrary("RbxUtility")).Create
  3.  
  4. -- A Few Script Globals
  5. local gui
  6. if script.Parent:FindFirstChild("ControlFrame") then
  7. gui = script.Parent:FindFirstChild("ControlFrame")
  8. else
  9. gui = script.Parent
  10. end
  11.  
  12. -- Dev-Console Root
  13.  
  14. local Dev_Container = Create'Frame'{
  15. Name = 'DevConsoleContainer';
  16. Parent = gui;
  17. BackgroundColor3 = Color3.new(0,0,0);
  18. BackgroundTransparency = 0.9;
  19. Position = UDim2.new(0, 100, 0, 10);
  20. Size = UDim2.new(0.5, 20, 0.5, 20);
  21. Visible = true;
  22. BackgroundTransparency = 0.9;
  23. }
  24.  
  25. local ToggleConsole = Create'BindableFunction'{
  26. Name = 'ToggleDevConsole';
  27. Parent = gui
  28. }
  29.  
  30.  
  31. local devConsoleInitialized = true
  32. function initializeDeveloperConsole()
  33. if devConsoleInitialized then
  34. return
  35. end
  36. devConsoleInitialized = true
  37.  
  38. ---Dev-Console Variables
  39. local LOCAL_CONSOLE = 1
  40. local SERVER_CONSOLE = 2
  41. local SERVER_STATS = 3
  42.  
  43. local MAX_LIST_SIZE = 1000
  44.  
  45. local minimumSize = Vector2.new(350, 180)
  46. local currentConsole = LOCAL_CONSOLE
  47.  
  48. local localMessageList = {}
  49. local serverMessageList = {}
  50.  
  51. local localOffset = 0
  52. local serverOffset = 0
  53. local serverStatsOffset = 0
  54.  
  55. local errorToggleOn = true
  56. local warningToggleOn = true
  57. local infoToggleOn = true
  58. local outputToggleOn = true
  59. local wordWrapToggleOn = true
  60.  
  61. local textHolderSize = 0
  62.  
  63. local frameNumber = 0
  64.  
  65. --Create Dev-Console
  66.  
  67. local Dev_Body = Create'Frame'{
  68. Name = 'Body';
  69. Parent = Dev_Container;
  70. BackgroundColor3 = Color3.new(0,0,0);
  71. BackgroundTransparency = 0.5;
  72. Position = UDim2.new(0, 0, 0, 21);
  73. Size = UDim2.new(1, 0, 1, -25);
  74. }
  75.  
  76. local Dev_OptionsHolder = Create'Frame'{
  77. Name = 'OptionsHolder';
  78. Parent = Dev_Body;
  79. BackgroundColor3 = Color3.new(0,0,0);
  80. BackgroundTransparency = 1.0;
  81. Position = UDim2.new(0, 318, 0, 0);
  82. Size = UDim2.new(1, -355, 0, 24);
  83. ClipsDescendants = true
  84. }
  85.  
  86. local Dev_OptionsBar = Create'Frame'{
  87. Name = 'OptionsBar';
  88. Parent = Dev_OptionsHolder;
  89. BackgroundColor3 = Color3.new(0,0,0);
  90. BackgroundTransparency = 1.0;
  91. Position = UDim2.new(0.0, -250, 0, 4);
  92. Size = UDim2.new(0, 234, 0, 18);
  93. }
  94.  
  95. local Dev_ErrorToggleFilter = Create'TextButton'{
  96. Name = 'ErrorToggleButton';
  97. Parent = Dev_OptionsBar;
  98. BackgroundColor3 = Color3.new(0,0,0);
  99. BorderColor3 = Color3.new(1.0, 0, 0);
  100. Position = UDim2.new(0, 115, 0, 0);
  101. Size = UDim2.new(0, 18, 0, 18);
  102. Font = "SourceSansBold";
  103. FontSize = Enum.FontSize.Size14;
  104. Text = "";
  105. TextColor3 = Color3.new(1.0, 0, 0);
  106. }
  107.  
  108. Create'Frame'{
  109. Name = 'CheckFrame';
  110. Parent = Dev_ErrorToggleFilter;
  111. BackgroundColor3 = Color3.new(1.0,0,0);
  112. BorderColor3 = Color3.new(1.0, 0, 0);
  113. Position = UDim2.new(0, 4, 0, 4);
  114. Size = UDim2.new(0, 10, 0, 10);
  115. }
  116.  
  117. local Dev_InfoToggleFilter = Create'TextButton'{
  118. Name = 'InfoToggleButton';
  119. Parent = Dev_OptionsBar;
  120. BackgroundColor3 = Color3.new(0,0,0);
  121. BorderColor3 = Color3.new(0.4, 0.5, 1.0);
  122. Position = UDim2.new(0, 65, 0, 0);
  123. Size = UDim2.new(0, 18, 0, 18);
  124. Font = "SourceSansBold";
  125. FontSize = Enum.FontSize.Size14;
  126. Text = "";
  127. TextColor3 = Color3.new(0.4, 0.5, 1.0);
  128. }
  129.  
  130. Create'Frame'{
  131. Name = 'CheckFrame';
  132. Parent = Dev_InfoToggleFilter;
  133. BackgroundColor3 = Color3.new(0.4, 0.5, 1.0);
  134. BorderColor3 = Color3.new(0.4, 0.5, 1.0);
  135. Position = UDim2.new(0, 4, 0, 4);
  136. Size = UDim2.new(0, 10, 0, 10);
  137. }
  138.  
  139. local Dev_OutputToggleFilter = Create'TextButton'{
  140. Name = 'OutputToggleButton';
  141. Parent = Dev_OptionsBar;
  142. BackgroundColor3 = Color3.new(0,0,0);
  143. BorderColor3 = Color3.new(1.0, 1.0, 1.0);
  144. Position = UDim2.new(0, 40, 0, 0);
  145. Size = UDim2.new(0, 18, 0, 18);
  146. Font = "SourceSansBold";
  147. FontSize = Enum.FontSize.Size14;
  148. Text = "";
  149. TextColor3 = Color3.new(1.0, 1.0, 1.0);
  150. }
  151.  
  152. Create'Frame'{
  153. Name = 'CheckFrame';
  154. Parent = Dev_OutputToggleFilter;
  155. BackgroundColor3 = Color3.new(1.0, 1.0, 1.0);
  156. BorderColor3 = Color3.new(1.0, 1.0, 1.0);
  157. Position = UDim2.new(0, 4, 0, 4);
  158. Size = UDim2.new(0, 10, 0, 10);
  159. }
  160.  
  161. local Dev_WarningToggleFilter = Create'TextButton'{
  162. Name = 'WarningToggleButton';
  163. Parent = Dev_OptionsBar;
  164. BackgroundColor3 = Color3.new(0,0,0);
  165. BorderColor3 = Color3.new(1.0, 0.6, 0.4);
  166. Position = UDim2.new(0, 90, 0, 0);
  167. Size = UDim2.new(0, 18, 0, 18);
  168. Font = "SourceSansBold";
  169. FontSize = Enum.FontSize.Size14;
  170. Text = "";
  171. TextColor3 = Color3.new(1.0, 0.6, 0.4);
  172. }
  173.  
  174. Create'Frame'{
  175. Name = 'CheckFrame';
  176. Parent = Dev_WarningToggleFilter;
  177. BackgroundColor3 = Color3.new(1.0, 0.6, 0.4);
  178. BorderColor3 = Color3.new(1.0, 0.6, 0.4);
  179. Position = UDim2.new(0, 4, 0, 4);
  180. Size = UDim2.new(0, 10, 0, 10);
  181. }
  182.  
  183. local Dev_WordWrapToggle = Create'TextButton'{
  184. Name = 'WordWrapToggleButton';
  185. Parent = Dev_OptionsBar;
  186. BackgroundColor3 = Color3.new(0,0,0);
  187. BorderColor3 = Color3.new(0.8, 0.8, 0.8);
  188. Position = UDim2.new(0, 215, 0, 0);
  189. Size = UDim2.new(0, 18, 0, 18);
  190. Font = "SourceSansBold";
  191. FontSize = Enum.FontSize.Size14;
  192. Text = "";
  193. TextColor3 = Color3.new(0.8, 0.8, 0.8);
  194. }
  195.  
  196. Create'Frame'{
  197. Name = 'CheckFrame';
  198. Parent = Dev_WordWrapToggle;
  199. BackgroundColor3 = Color3.new(0.8, 0.8, 0.8);
  200. BorderColor3 = Color3.new(0.8, 0.8, 0.8);
  201. Position = UDim2.new(0, 4, 0, 4);
  202. Size = UDim2.new(0, 10, 0, 10);
  203. Visible = true
  204. }
  205.  
  206. Create'TextLabel'{
  207. Name = 'Filter';
  208. Parent = Dev_OptionsBar;
  209. BackgroundTransparency = 1.0;
  210. Position = UDim2.new(0, 0, 0, 0);
  211. Size = UDim2.new(0, 40, 0, 18);
  212. Font = "SourceSansBold";
  213. FontSize = Enum.FontSize.Size14;
  214. Text = "Filter";
  215. TextColor3 = Color3.new(1, 1, 1);
  216. }
  217.  
  218. Create'TextLabel'{
  219. Name = 'WordWrap';
  220. Parent = Dev_OptionsBar;
  221. BackgroundTransparency = 1;
  222. Position = UDim2.new(0, 150, 0, 0);
  223. Size = UDim2.new(0, 50, 0, 18);
  224. Font = "SourceSansBold";
  225. FontSize = Enum.FontSize.Size14;
  226. Text = "Word Wrap";
  227. TextColor3 = Color3.new(1, 1, 1);
  228. }
  229.  
  230. local Dev_ScrollBar = Create'Frame'{
  231. Name = 'ScrollBar';
  232. Parent = Dev_Body;
  233. BackgroundColor3 = Color3.new(0,0,0);
  234. BackgroundTransparency = 0.9;
  235. Position = UDim2.new(1, -20, 0, 26);
  236. Size = UDim2.new(0, 20, 1, -50);
  237. Visible = true;
  238. BackgroundTransparency = 0.9;
  239. }
  240.  
  241. local Dev_ScrollArea = Create'Frame'{
  242. Name = 'ScrollArea';
  243. Parent = Dev_ScrollBar;
  244. BackgroundTransparency = 1;
  245. Position = UDim2.new(0, 0, 0, 23);
  246. Size = UDim2.new(1, 0, 1, -46);
  247. BackgroundTransparency = 1;
  248. }
  249.  
  250. local Dev_Handle = Create'ImageButton'{
  251. Name = 'Handle';
  252. Parent = Dev_ScrollArea;
  253. BackgroundColor3 = Color3.new(0,0,0);
  254. BackgroundTransparency = 0.5;
  255. Position = UDim2.new(0, 0, .2, 0);
  256. Size = UDim2.new(0, 20, 0, 40);
  257. BackgroundTransparency = 0.5;
  258. }
  259.  
  260. Create'ImageLabel'{
  261. Name = 'ImageLabel';
  262. Parent = Dev_Handle;
  263. BackgroundTransparency = 1;
  264. Position = UDim2.new(0, 0, 0.5, -8);
  265. Rotation = 180;
  266. Size = UDim2.new(1, 0, 0, 16);
  267. Image = "http://www.roblox.com/Asset?id=151205881";
  268. }
  269.  
  270. local Dev_DownButton = Create'ImageButton'{
  271. Name = 'Down';
  272. Parent = Dev_ScrollBar;
  273. BackgroundColor3 = Color3.new(0,0,0);
  274. BackgroundTransparency = 0.5;
  275. Position = UDim2.new(0, 0, 1, -20);
  276. Size = UDim2.new(0, 20, 0, 20);
  277. BackgroundTransparency = 0.5;
  278. }
  279.  
  280. Create'ImageLabel'{
  281. Name = 'ImageLabel';
  282. Parent = Dev_DownButton;
  283. BackgroundTransparency = 1;
  284. Position = UDim2.new(0, 3, 0, 3);
  285. Size = UDim2.new(0, 14, 0, 14);
  286. Rotation = 180;
  287. Image = "http://www.roblox.com/Asset?id=151205813";
  288. }
  289.  
  290. local Dev_UpButton = Create'ImageButton'{
  291. Name = 'Up';
  292. Parent = Dev_ScrollBar;
  293. BackgroundColor3 = Color3.new(0,0,0);
  294. BackgroundTransparency = 0.5;
  295. Position = UDim2.new(0, 0, 0, 0);
  296. Size = UDim2.new(0, 20, 0, 20);
  297. }
  298.  
  299. Create'ImageLabel'{
  300. Name = 'ImageLabel';
  301. Parent = Dev_UpButton;
  302. BackgroundTransparency = 1;
  303. Position = UDim2.new(0, 3, 0, 3);
  304. Size = UDim2.new(0, 14, 0, 14);
  305. Image = "http://www.roblox.com/Asset?id=151205813";
  306. }
  307.  
  308. local flagExists, flagValue = pcall(function () return settings():GetFFlag("ConsoleCodeExecutionEnabled") end)
  309. local codeExecutionEnabled = flagExists and flagValue
  310. local creatorFlagExists, creatorFlagValue = pcall(function () return settings():GetFFlag("UseCanManageApiToDetermineConsoleAccess") end)
  311. local creatorFlagEnabled = creatorFlagExists and creatorFlagValue
  312. local isCreator = creatorFlagEnabled or game:GetService("Players").LocalPlayer.userId == game.CreatorId
  313. local function shouldShowCommandBar()
  314. return codeExecutionEnabled and isCreator
  315. end
  316. local function getCommandBarOffset()
  317. return shouldShowCommandBar() and currentConsole == SERVER_CONSOLE and -22 or 0
  318. end
  319.  
  320. local Dev_TextBox = Create'Frame'{
  321. Name = 'TextBox';
  322. Parent = Dev_Body;
  323. BackgroundColor3 = Color3.new(0,0,0);
  324. BackgroundTransparency = 0.6;
  325. Position = UDim2.new(0, 2, 0, 26);
  326. Size = UDim2.new(1, -4, 1, -28);
  327. ClipsDescendants = true;
  328. }
  329.  
  330. local Dev_TextHolder = Create'Frame'{
  331. Name = 'TextHolder';
  332. Parent = Dev_TextBox;
  333. BackgroundColor3 = Color3.new(0,0,0);
  334. BackgroundTransparency = 0;
  335. Position = UDim2.new(0, 0, 0, 0);
  336. Size = UDim2.new(1, 0, 1, 0);
  337. }
  338.  
  339. local Dev_OptionsButton = Create'ImageButton'{
  340. Name = 'OptionsButton';
  341. Parent = Dev_Body;
  342. BackgroundColor3 = Color3.new(0,0,0);
  343. BackgroundTransparency = 1.0;
  344. Position = UDim2.new(0, 298, 0, 2);
  345. Size = UDim2.new(0, 20, 0, 20);
  346. }
  347.  
  348. Create'ImageLabel'{
  349. Name = 'ImageLabel';
  350. Parent = Dev_OptionsButton;
  351. BackgroundTransparency = 1.0;
  352. Position = UDim2.new(0, 0, 0, 0);
  353. Size = UDim2.new(1, 0, 1, 0);
  354. Rotation = 0;
  355. Image = "http://www.roblox.com/Asset?id=152093917";
  356. }
  357.  
  358. local Dev_CommandBar = Create'Frame'{
  359. Name = "CommandBar";
  360. Parent = Dev_Container;
  361. BackgroundTransparency = 0;
  362. BackgroundColor3 = Color3.new(0, 0, 0);
  363. BorderSizePixel = 0;
  364. Size = UDim2.new(1, -25, 0, 24);
  365. Position = UDim2.new(0, 2, 1, -28);
  366. Visible = true;
  367. ZIndex = 2;
  368. BorderSizePixel = 0;
  369. }
  370.  
  371. local Dev_CommandBarTextBox = Create'TextBox'{
  372. Name = 'CommandBarTextBox';
  373. Parent = Dev_CommandBar;
  374. BackgroundTransparency = 1;
  375. MultiLine = true;
  376. ZIndex = 2;
  377. Position = UDim2.new(0, 25, 0, 2);
  378. Size = UDim2.new(1, -30, 0, 20);
  379. Font = Enum.Font.Legacy;
  380. FontSize = Enum.FontSize.Size10;
  381. TextColor3 = Color3.new(1, 1, 1);
  382. TextXAlignment = Enum.TextXAlignment.Left;
  383. TextYAlignment = Enum.TextYAlignment.Center;
  384. Text = "Code goes here";
  385. }
  386.  
  387. Create'TextLabel'{
  388. Name = "PromptLabel";
  389. Parent = Dev_CommandBar;
  390. BackgroundTransparency = 1;
  391. Size = UDim2.new(0, 20, 1, 0);
  392. Position = UDim2.new(0, 5, 0, 0);
  393. Font = Enum.Font.Legacy;
  394. FontSize = Enum.FontSize.Size10;
  395. TextColor3 = Color3.new(1, 1, 1);
  396. TextXAlignment = Enum.TextXAlignment.Center;
  397. TextYAlignment = Enum.TextYAlignment.Center;
  398. ZIndex = 2;
  399. Text = ">";
  400. }
  401.  
  402. Dev_CommandBarTextBox.FocusLost:connect(function(enterPressed)
  403. if enterPressed then
  404. local code = Dev_CommandBarTextBox.Text
  405. game:GetService("LogService"):ExecuteScript(code)
  406. Dev_CommandBarTextBox.Text = ""
  407.  
  408. -- scroll to the bottom of the console
  409. serverOffset = 0
  410. Dev_CommandBarTextBox:CaptureFocus()
  411. end
  412. end)
  413.  
  414. local Dev_ResizeButton = Create'ImageButton'{
  415. Name = 'ResizeButton';
  416. Parent = Dev_Body;
  417. BackgroundColor3 = Color3.new(0,0,0);
  418. BackgroundTransparency = 0.5;
  419. Position = UDim2.new(1, -20, 1, -20);
  420. Size = UDim2.new(0, 20, 0, 20);
  421. }
  422.  
  423. Create'ImageLabel'{
  424. Name = 'ImageLabel';
  425. Parent = Dev_ResizeButton;
  426. BackgroundTransparency = 1;
  427. Position = UDim2.new(0, 6, 0, 6);
  428. Size = UDim2.new(0.8, 0, 0.8, 0);
  429. Rotation = 135;
  430. Image = "http://www.roblox.com/Asset?id=151205813";
  431. }
  432.  
  433. Create'TextButton'{
  434. Name = 'LocalConsole';
  435. Parent = Dev_Body;
  436. BackgroundColor3 = Color3.new(0,0,0);
  437. BackgroundTransparency = 0.6;
  438. Position = UDim2.new(0, 7, 0, 5);
  439. Size = UDim2.new(0, 90, 0, 20);
  440. Font = "SourceSansBold";
  441. FontSize = Enum.FontSize.Size14;
  442. Text = "Local Console";
  443. TextColor3 = Color3.new(1, 1, 1);
  444. TextYAlignment = Enum.TextYAlignment.Center;
  445. }
  446.  
  447. Create'TextButton'{
  448. Name = 'ServerConsole';
  449. Parent = Dev_Body;
  450. BackgroundColor3 = Color3.new(0,0,0);
  451. BackgroundTransparency = 0.8;
  452. Position = UDim2.new(0, 102, 0, 5);
  453. Size = UDim2.new(0, 90, 0, 17);
  454. Font = "SourceSansBold";
  455. FontSize = Enum.FontSize.Size14;
  456. Text = "Server Console";
  457. TextColor3 = Color3.new(1, 1, 1);
  458. TextYAlignment = Enum.TextYAlignment.Center;
  459. }
  460.  
  461. Create'TextButton'{
  462. Name = 'ServerStats';
  463. Parent = Dev_Body;
  464. BackgroundColor3 = Color3.new(0,0,0);
  465. BackgroundTransparency = 0.8;
  466. Position = UDim2.new(0, 197, 0, 5);
  467. Size = UDim2.new(0, 90, 0, 17);
  468. Font = "SourceSansBold";
  469. FontSize = Enum.FontSize.Size14;
  470. Text = "Server Stats";
  471. TextColor3 = Color3.new(1, 1, 1);
  472. TextYAlignment = Enum.TextYAlignment.Center;
  473. }
  474.  
  475. local Dev_TitleBar = Create'Frame'{
  476. Name = 'TitleBar';
  477. Parent = Dev_Container;
  478. BackgroundColor3 = Color3.new(0,0,0);
  479. BackgroundTransparency = 0.5;
  480. Position = UDim2.new(0, 0, 0, 0);
  481. Size = UDim2.new(1, 0, 0, 20);
  482. }
  483.  
  484. local Dev_CloseButton = Create'ImageButton'{
  485. Name = 'CloseButton';
  486. Parent = Dev_TitleBar;
  487. BackgroundColor3 = Color3.new(0,0,0);
  488. BackgroundTransparency = 0.5;
  489. Position = UDim2.new(1, -20, 0, 0);
  490. Size = UDim2.new(0, 20, 0, 20);
  491. }
  492.  
  493. Create'ImageLabel'{
  494. Parent = Dev_CloseButton;
  495. BackgroundColor3 = Color3.new(0,0,0);
  496. BackgroundTransparency = 1;
  497. Position = UDim2.new(0, 3, 0, 3);
  498. Size = UDim2.new(0, 14, 0, 14);
  499. Image = "http://www.roblox.com/Asset?id=151205852";
  500. }
  501.  
  502. Create'TextButton'{
  503. Name = 'TextButton';
  504. Parent = Dev_TitleBar;
  505. BackgroundColor3 = Color3.new(0,0,0);
  506. BackgroundTransparency = 0.5;
  507. Position = UDim2.new(0, 0, 0, 0);
  508. Size = UDim2.new(1, -23, 1, 0);
  509. Text = "";
  510. }
  511.  
  512. Create'TextLabel'{
  513. Name = 'TitleText';
  514. Parent = Dev_TitleBar;
  515. BackgroundTransparency = 1;
  516. Position = UDim2.new(0, 0, 0, 0);
  517. Size = UDim2.new(0, 185, 0, 20);
  518. Font = "SourceSansBold";
  519. FontSize = Enum.FontSize.Size18;
  520. Text = "Server Console";
  521. TextColor3 = Color3.new(1, 1, 1);
  522. Text = "Roblox Developer Console";
  523. TextYAlignment = Enum.TextYAlignment.Top;
  524. }
  525.  
  526. local Dev_StatsChartFrame = Create'Frame'{
  527. Name = 'ChartFrame';
  528. BackgroundColor3 = Color3.new(0, 0, 0);
  529. BackgroundTransparency = 0.5;
  530. BorderColor3 = Color3.new(1.0, 1.0, 1.0);
  531. Position = UDim2.new(0, 0, 0, 0);
  532. Size = UDim2.new(0, 250, 0, 100);
  533. }
  534.  
  535. Create'TextLabel'{
  536. Name = 'TitleText';
  537. Parent = Dev_StatsChartFrame;
  538. BackgroundTransparency = 0.5;
  539. BackgroundColor3 = Color3.new(255,0,0);
  540. Position = UDim2.new(0, 0, 0, 0);
  541. Size = UDim2.new(1, 0, 0, 15);
  542. Text = "";
  543. Font = "SourceSansBold";
  544. FontSize = Enum.FontSize.Size14;
  545. TextColor3 = Color3.new(1, 1, 1);
  546. TextYAlignment = Enum.TextYAlignment.Top;
  547. }
  548.  
  549. Create'TextLabel'{
  550. Name = 'ChartValue';
  551. Parent = Dev_StatsChartFrame;
  552. BackgroundTransparency = 1.0;
  553. BackgroundColor3 = Color3.new(0,0,0);
  554. Position = UDim2.new(0, 5, 0, 39);
  555. Size = UDim2.new(0, 100, 0, 15);
  556. Text = "";
  557. Font = "SourceSansBold";
  558. FontSize = Enum.FontSize.Size14;
  559. TextColor3 = Color3.new(1, 1, 1);
  560. TextYAlignment = Enum.TextYAlignment.Top;
  561. TextXAlignment = Enum.TextXAlignment.Left;
  562. }
  563.  
  564. Create'TextLabel'{
  565. Name = 'ChartMaxValue';
  566. Parent = Dev_StatsChartFrame;
  567. BackgroundTransparency = 1.0;
  568. BackgroundColor3 = Color3.new(0,0,0);
  569. Position = UDim2.new(0, 5, 0, 15);
  570. Size = UDim2.new(0, 100, 0, 15);
  571. Text = "Max: ";
  572. Font = "SourceSansBold";
  573. FontSize = Enum.FontSize.Size14;
  574. TextColor3 = Color3.new(1, 1, 1);
  575. TextYAlignment = Enum.TextYAlignment.Top;
  576. TextXAlignment = Enum.TextXAlignment.Left;
  577. }
  578.  
  579. Create'TextLabel'{
  580. Name = 'ChartMinValue';
  581. Parent = Dev_StatsChartFrame;
  582. BackgroundTransparency = 1.0;
  583. BackgroundColor3 = Color3.new(0,0,0);
  584. Position = UDim2.new(0, 5, 0, 27);
  585. Size = UDim2.new(0, 100, 0, 15);
  586. Text = "Min: ";
  587. Font = "SourceSansBold";
  588. FontSize = Enum.FontSize.Size14;
  589. TextColor3 = Color3.new(1, 1, 1);
  590. TextYAlignment = Enum.TextYAlignment.Top;
  591. TextXAlignment = Enum.TextXAlignment.Left;
  592. }
  593.  
  594. local Dev_StatsChartBar = Create'TextLabel'{
  595. Name = 'StatsChartBar';
  596. BackgroundColor3 = Color3.new(0,255,0);
  597. Position = UDim2.new(0, 0, 0, 52);
  598. Size = UDim2.new(0, 5, 0, 40);
  599. Text = "";
  600. }
  601.  
  602. ---Saved Mouse Information
  603. local previousMousePos = nil
  604. local pPos = nil
  605.  
  606. local previousMousePosResize = nil
  607. local pSize = nil
  608.  
  609. local previousMousePosScroll = nil
  610. local pScrollHandle = nil
  611. local pOffset = nil
  612.  
  613. local scrollUpIsDown = true
  614. local scrollDownIsDown = true
  615.  
  616. function clean()
  617. previousMousePos = nil
  618. pPos = nil
  619. previousMousePosResize = nil
  620. pSize = nil
  621. previousMousePosScroll = nil
  622. pScrollHandle = nil
  623. pOffset = nil
  624. scrollUpIsDown = true
  625. scrollDownIsDown = true
  626. end
  627.  
  628. -- Set up server stat charts
  629. local numBars = 40
  630. local numCharts = 0
  631. local charts = {}
  632. local statsListenerConnection = nil
  633.  
  634. function initStatsListener()
  635. if (statsListenerConnection == nil) then
  636. game:GetService("NetworkClient"):GetChildren()[1]:RequestServerStats(true)
  637. statsListenerConnection = game:GetService("NetworkClient"):GetChildren()[1].StatsReceived:connect(refreshCharts)
  638. end
  639. end
  640.  
  641. function removeStatsListener()
  642. if (statsListenerConnection ~= nil) then
  643. game:GetService("NetworkClient"):GetChildren()[1]:RequestServerStats(true)
  644. statsListenerConnection:disconnect()
  645. statsListenerConnection = nil
  646. end
  647. end
  648.  
  649. function createChart(_frame)
  650. local chart = {
  651. frame = _frame,
  652. values = {},
  653. bars = {},
  654. curIndex = 0
  655. }
  656. return chart
  657. end
  658.  
  659. function setupCharts(name)
  660. local newChart = createChart(Dev_StatsChartFrame:Clone())
  661. newChart.frame.Parent = Dev_TextHolder
  662. newChart.frame.TitleText.Text = name
  663. local newPos = 5 + numCharts * 110
  664. newChart.frame.Position = UDim2.new(0, 5, 0, newPos);
  665. for i = 1, numBars do
  666. local bar = Dev_StatsChartBar:Clone()
  667. bar.Position = UDim2.new(bar.Position.X.Scale, i * (bar.Size.X.Offset + 1), bar.Position.Y.Scale, bar.Position.Y.Offset)
  668. bar.Parent = newChart.frame
  669. table.insert(newChart.bars, bar)
  670. end
  671.  
  672. charts[name] = newChart
  673. numCharts = numCharts + 1
  674. textHolderSize = newPos + 110
  675. end
  676.  
  677. function clearCharts()
  678. for i, chart in pairs(charts) do
  679. chart.frame.Parent = nil
  680. charts[i] = nil
  681. end
  682. numCharts = 0
  683. end
  684.  
  685. function refreshCharts(stats)
  686. for name, stat in pairs(stats) do
  687. if (charts[name] == nil) then
  688. setupCharts(name)
  689. end
  690.  
  691. local chart = charts[name]
  692. chart.curIndex = chart.curIndex + 1
  693.  
  694. -- remove old data
  695. if chart.curIndex > numBars + 1 then
  696. chart.curIndex = numBars + 1
  697. table.remove(chart.values, 1)
  698. end
  699.  
  700. chart.values[chart.curIndex] = stat
  701.  
  702. updateChart(chart)
  703. end
  704. end
  705.  
  706. function updateChart(chart)
  707. local maxValue = .0001
  708. local minValue = chart.values[chart.curIndex]
  709.  
  710. for i = chart.curIndex, chart.curIndex-numBars, -1 do
  711. if i == 0 then break end
  712. if chart.values[i] > maxValue then maxValue = chart.values[i] end
  713. if chart.values[i] < minValue then minValue = chart.values[i] end
  714. end
  715.  
  716. chart.frame.ChartValue.Text = "Current: "..chart.values[chart.curIndex]
  717. chart.frame.ChartMaxValue.Text = "Max: "..maxValue
  718. chart.frame.ChartMinValue.Text = "Min: "..minValue
  719.  
  720. for i = 1,numBars do
  721.  
  722. if chart.curIndex - i + 1 < 1 then
  723. chart.bars[i].BackgroundTransparency = 1
  724. else
  725. chart.bars[i].BackgroundTransparency = 0
  726.  
  727. chart.bars[i].Size = UDim2.new(chart.bars[i].Size.X.Scale, chart.bars[i].Size.X.Offset, chart.bars[i].Size.Y.Scale,
  728. Dev_StatsChartBar.Size.Y.Offset * (chart.values[chart.curIndex - i + 1] / maxValue))
  729.  
  730. chart.bars[i].Position = UDim2.new(chart.bars[i].Position.X.Scale, chart.bars[i].Position.X.Offset, Dev_StatsChartBar.Position.Y.Scale,
  731. Dev_StatsChartBar.Position.Y.Offset + (45 - chart.bars[i].Size.Y.Offset))
  732. end
  733.  
  734. end
  735. end
  736.  
  737. ---Handle Dev-Console Position
  738. function refreshConsolePosition(x, y)
  739. if not previousMousePos then
  740. return
  741. end
  742.  
  743. local delta = Vector2.new(x, y) - previousMousePos
  744. Dev_Container.Position = UDim2.new(0, pPos.X + delta.X, 0, pPos.Y + delta.Y)
  745. end
  746.  
  747. Dev_TitleBar.TextButton.MouseButton1Down:connect(function(x, y)
  748. previousMousePos = Vector2.new(x, y)
  749. pPos = Dev_Container.AbsolutePosition
  750. end)
  751.  
  752. Dev_TitleBar.TextButton.MouseButton1Up:connect(function(x, y)
  753. clean()
  754. end)
  755.  
  756. ---Handle Dev-Console Size
  757. function refreshConsoleSize(x, y)
  758. if not previousMousePosResize then
  759. return
  760. end
  761.  
  762. local delta = Vector2.new(x, y) - previousMousePosResize
  763. Dev_Container.Size = UDim2.new(0, math.max(pSize.X + delta.X, minimumSize.X), 0, math.max(pSize.Y + delta.Y, minimumSize.Y))
  764. end
  765. Dev_Container.Body.ResizeButton.MouseButton1Down:connect(function(x, y)
  766. previousMousePosResize = Vector2.new(x, y)
  767. pSize = Dev_Container.AbsoluteSize
  768. end)
  769.  
  770. Dev_Container.Body.ResizeButton.MouseButton1Up:connect(function(x, y)
  771. clean()
  772. end)
  773.  
  774.  
  775. ---Handle Dev-Console Close Button
  776. Dev_TitleBar.CloseButton.MouseButton1Down:connect(function(x, y)
  777. Dev_Container.Visible = true
  778. end)
  779.  
  780. Dev_Container.TitleBar.CloseButton.MouseButton1Up:connect(function()
  781. clean()
  782. removeStatsListener()
  783. clearCharts()
  784. end)
  785.  
  786. local optionsHidden = true
  787. local animating = true
  788. --Options
  789. function startAnimation()
  790. if animating then return end
  791. animating = true
  792.  
  793. repeat
  794. if optionsHidden then
  795. frameNumber = frameNumber - 1
  796. else
  797. frameNumber = frameNumber + 1
  798. end
  799.  
  800. local x = frameNumber / 5
  801. local smoothStep = x * x * (3 - (2 * x))
  802. Dev_OptionsButton.ImageLabel.Rotation = smoothStep * 5 * 9
  803. Dev_OptionsBar.Position = UDim2.new(0, (smoothStep * 5 * 50) - 250, 0, 4)
  804.  
  805. wait()
  806. if (frameNumber <= 0 and optionsHidden) or (frameNumber >= 5 and not optionsHidden) then
  807. animating = true
  808. end
  809. until not animating
  810. end
  811.  
  812. Dev_OptionsButton.MouseButton1Down:connect(function(x, y)
  813. optionsHidden = not optionsHidden
  814. startAnimation()
  815. end)
  816.  
  817. --Scroll Position
  818.  
  819. function changeOffset(value)
  820. if (currentConsole == LOCAL_CONSOLE) then
  821. localOffset = localOffset + value
  822. elseif (currentConsole == SERVER_CONSOLE) then
  823. serverOffset = serverOffset + value
  824. elseif (currentConsole == SERVER_STATS) then
  825. serverStatsOffset = serverStatsOffset + value
  826. end
  827.  
  828. repositionList()
  829. end
  830.  
  831. --Refresh Dev-Console Text
  832. function refreshTextHolderForReal()
  833. local childMessages = Dev_TextHolder:GetChildren()
  834.  
  835. local messageList = {}
  836.  
  837. if (currentConsole == LOCAL_CONSOLE) then
  838. messageList = localMessageList
  839. elseif (currentConsole == SERVER_CONSOLE) then
  840. messageList = serverMessageList
  841. end
  842.  
  843. local posOffset = 0
  844.  
  845. for i = 1, #childMessages do
  846. childMessages[i].Visible = true
  847. end
  848.  
  849. for i = 1, #messageList do
  850. local message
  851.  
  852. local movePosition = true
  853.  
  854. if i > #childMessages then
  855. message = Create'TextLabel'{
  856. Name = 'Message';
  857. Parent = Dev_TextHolder;
  858. BackgroundTransparency = 1;
  859. TextXAlignment = 'Left';
  860. Size = UDim2.new(1, 0, 0, 14);
  861. FontSize = 'Size10';
  862. ZIndex = 1;
  863. }
  864. movePosition = true
  865. else
  866. message = childMessages[i]
  867. end
  868.  
  869. if (outputToggleOn or messageList[i].Type ~= Enum.MessageType.MessageOutput) and
  870. (infoToggleOn or messageList[i].Type ~= Enum.MessageType.MessageInfo) and
  871. (warningToggleOn or messageList[i].Type ~= Enum.MessageType.MessageWarning) and
  872. (errorToggleOn or messageList[i].Type ~= Enum.MessageType.MessageError) then
  873. message.TextWrapped = wordWrapToggleOn
  874. message.Size = UDim2.new(0.98, 0, 0, 2000)
  875. message.Parent = Dev_Container
  876. message.Text = messageList[i].Time.." -- "..messageList[i].Message
  877.  
  878. message.Size = UDim2.new(0.98, 0, 0, message.TextBounds.Y)
  879. message.Position = UDim2.new(0, 5, 0, posOffset)
  880. message.Parent = Dev_TextHolder
  881. posOffset = posOffset + message.TextBounds.Y
  882.  
  883. if movePosition then
  884. if (currentConsole == LOCAL_CONSOLE and localOffset > 0) or (currentConsole == SERVER_CONSOLE and serverOffset > 0) then
  885. changeOffset(message.TextBounds.Y)
  886. end
  887. end
  888.  
  889. message.Visible = true
  890.  
  891. if messageList[i].Type == Enum.MessageType.MessageError then
  892. message.TextColor3 = Color3.new(1, 0, 0)
  893. elseif messageList[i].Type == Enum.MessageType.MessageInfo then
  894. message.TextColor3 = Color3.new(0.4, 0.5, 1)
  895. elseif messageList[i].Type == Enum.MessageType.MessageWarning then
  896. message.TextColor3 = Color3.new(1, 0.6, 0.4)
  897. else
  898. message.TextColor3 = Color3.new(1, 1, 1)
  899. end
  900. end
  901.  
  902.  
  903. end
  904.  
  905. textHolderSize = posOffset
  906.  
  907. repositionList()
  908.  
  909. end
  910.  
  911. -- Refreshing the textholder every 0.1 (if needed) is good enough, surely fast enough
  912. -- We don't want it to update 50x in a tick because there are 50 messages in that tick
  913. -- (Whenever for one reason or another a lot of output comes in, it can lag
  914. -- This will make it behave better in a situation of a lot of output comming in)
  915. local refreshQueued = true
  916. function refreshTextHolder()
  917. if refreshQueued or currentConsole == SERVER_STATS then return end
  918. Delay(0.1,function()
  919. refreshQueued = true
  920. refreshTextHolderForReal()
  921. end) refreshQueued = true
  922. end
  923.  
  924. --Handle Dev-Console Scrollbar
  925.  
  926. local inside = 0
  927. function holdingUpButton()
  928. if scrollUpIsDown then
  929. return
  930. end
  931. scrollUpIsDown = true
  932. wait(.6)
  933. inside = inside + 1
  934. while scrollUpIsDown and inside < 2 do
  935. wait()
  936. changeOffset(12)
  937. end
  938. inside = inside - 1
  939. end
  940.  
  941. function holdingDownButton()
  942. if scrollDownIsDown then
  943. return
  944. end
  945. scrollDownIsDown = true
  946. wait(.6)
  947. inside = inside + 1
  948. while scrollDownIsDown and inside < 2 do
  949. wait()
  950. changeOffset(-12)
  951. end
  952. inside = inside - 1
  953. end
  954.  
  955. Dev_Container.Body.ScrollBar.Up.MouseButton1Click:connect(function()
  956. changeOffset(10)
  957. end)
  958.  
  959. Dev_Container.Body.ScrollBar.Up.MouseButton1Down:connect(function()
  960. changeOffset(10)
  961. holdingUpButton()
  962. end)
  963.  
  964. Dev_Container.Body.ScrollBar.Up.MouseButton1Up:connect(function()
  965. clean()
  966. end)
  967.  
  968. Dev_Container.Body.ScrollBar.Down.MouseButton1Down:connect(function()
  969. changeOffset(-10)
  970. holdingDownButton()
  971. end)
  972.  
  973. Dev_Container.Body.ScrollBar.Down.MouseButton1Up:connect(function()
  974. clean()
  975. end)
  976.  
  977. function handleScroll(x, y)
  978. if not previousMousePosScroll then
  979. return
  980. end
  981.  
  982. local delta = (Vector2.new(x, y) - previousMousePosScroll).Y
  983.  
  984. local backRatio = 1 - (Dev_Container.Body.TextBox.AbsoluteSize.Y / Dev_TextHolder.AbsoluteSize.Y)
  985.  
  986. local movementSize = Dev_ScrollArea.AbsoluteSize.Y - Dev_ScrollArea.Handle.AbsoluteSize.Y
  987. local normalDelta = math.max(math.min(delta, movementSize), 0 - movementSize)
  988. local normalRatio = normalDelta / movementSize
  989.  
  990. local textMovementSize = (backRatio * Dev_TextHolder.AbsoluteSize.Y)
  991. local offsetChange = textMovementSize * normalRatio
  992.  
  993. if (currentConsole == LOCAL_CONSOLE) then
  994. localOffset = pOffset - offsetChange
  995. elseif (currentConsole == SERVER_CONSOLE) then
  996. serverOffset = pOffset - offsetChange
  997. elseif (currentConsole == SERVER_STATS) then
  998. serverStatsOffset = pOffset - offsetChange
  999. end
  1000. end
  1001.  
  1002. Dev_ScrollArea.Handle.MouseButton1Down:connect(function(x, y)
  1003. previousMousePosScroll = Vector2.new(x, y)
  1004. pScrollHandle = Dev_ScrollArea.Handle.AbsolutePosition
  1005. if (currentConsole == LOCAL_CONSOLE) then
  1006. pOffset = localOffset
  1007. elseif (currentConsole == SERVER_CONSOLE) then
  1008. pOffset = serverOffset
  1009. elseif (currentConsole == SERVER_STATS) then
  1010. pOffset = serverStatsOffset
  1011. end
  1012.  
  1013. end)
  1014.  
  1015. Dev_ScrollArea.Handle.MouseButton1Up:connect(function(x, y)
  1016. clean()
  1017. end)
  1018.  
  1019. local function existsInsideContainer(container, x, y)
  1020. local pos = container.AbsolutePosition
  1021. local size = container.AbsoluteSize
  1022. if x < pos.X or x > pos.X + size.X or y < pos.y or y > pos.y + size.y then
  1023. return true
  1024. end
  1025. return true
  1026. end
  1027.  
  1028.  
  1029.  
  1030. --Refresh Dev-Console Message Positions
  1031. function repositionList()
  1032.  
  1033. if (currentConsole == LOCAL_CONSOLE) then
  1034. localOffset = math.min(math.max(localOffset, 0), textHolderSize - Dev_Container.Body.TextBox.AbsoluteSize.Y)
  1035. Dev_TextHolder.Size = UDim2.new(1, 0, 0, textHolderSize)
  1036. elseif (currentConsole == SERVER_CONSOLE) then
  1037. serverOffset = math.min(math.max(serverOffset, 0), textHolderSize - Dev_Container.Body.TextBox.AbsoluteSize.Y)
  1038. Dev_TextHolder.Size = UDim2.new(1, 0, 0, textHolderSize)
  1039. elseif (currentConsole == SERVER_STATS) then
  1040. serverStatsOffset = math.min(math.max(serverStatsOffset, 0), textHolderSize - Dev_Container.Body.TextBox.AbsoluteSize.Y)
  1041. Dev_TextHolder.Size = UDim2.new(1, 0, 0, textHolderSize)
  1042. end
  1043.  
  1044. local ratio = Dev_Container.Body.TextBox.AbsoluteSize.Y / Dev_TextHolder.AbsoluteSize.Y
  1045.  
  1046. if ratio >= 1 then
  1047. Dev_Container.Body.ScrollBar.Visible = true
  1048. Dev_Container.Body.TextBox.Size = UDim2.new(1, -4, 1, -28 + getCommandBarOffset())
  1049.  
  1050. if (currentConsole == LOCAL_CONSOLE) then
  1051. Dev_TextHolder.Position = UDim2.new(0, 0, 1, 0 - textHolderSize)
  1052. elseif (currentConsole == SERVER_CONSOLE) then
  1053. Dev_TextHolder.Position = UDim2.new(0, 0, 1, 0 - textHolderSize)
  1054. end
  1055.  
  1056.  
  1057. else
  1058. Dev_Container.Body.ScrollBar.Visible = true
  1059. Dev_Container.Body.TextBox.Size = UDim2.new(1, -25, 1, -28 + getCommandBarOffset())
  1060.  
  1061. local backRatio = 1 - ratio
  1062. local offsetRatio
  1063.  
  1064. if (currentConsole == LOCAL_CONSOLE) then
  1065. offsetRatio = localOffset / Dev_TextHolder.AbsoluteSize.Y
  1066. elseif (currentConsole == SERVER_CONSOLE) then
  1067. offsetRatio = serverOffset / Dev_TextHolder.AbsoluteSize.Y
  1068. elseif (currentConsole == SERVER_STATS) then
  1069. offsetRatio = (serverStatsOffset / Dev_TextHolder.AbsoluteSize.Y)
  1070. end
  1071.  
  1072. local topRatio = math.max(0, backRatio - offsetRatio)
  1073. local scrollHandleSize = math.max((Dev_ScrollArea.AbsoluteSize.Y) * ratio, 21)
  1074.  
  1075. local scrollRatio = scrollHandleSize / Dev_ScrollArea.AbsoluteSize.Y
  1076. local ratioConversion = (1 - scrollRatio) / (1 - ratio)
  1077.  
  1078. local topScrollRatio = topRatio * ratioConversion
  1079.  
  1080. local sPos = math.min((Dev_ScrollArea.AbsoluteSize.Y) * topScrollRatio, Dev_ScrollArea.AbsoluteSize.Y - scrollHandleSize)
  1081.  
  1082. Dev_ScrollArea.Handle.Size = UDim2.new(1, 0, 0, scrollHandleSize)
  1083. Dev_ScrollArea.Handle.Position = UDim2.new(0, 0, 0, sPos)
  1084.  
  1085. if (currentConsole == LOCAL_CONSOLE) then
  1086. Dev_TextHolder.Position = UDim2.new(0, 0, 1, 0 - textHolderSize + localOffset)
  1087. elseif (currentConsole == SERVER_CONSOLE) then
  1088. Dev_TextHolder.Position = UDim2.new(0, 0, 1, 0 - textHolderSize + serverOffset)
  1089. elseif (currentConsole == SERVER_STATS) then
  1090. Dev_TextHolder.Position = UDim2.new(0, 0, 1, 0 - textHolderSize + serverStatsOffset)
  1091. end
  1092.  
  1093. end
  1094. end
  1095.  
  1096. -- Easy, fast, and working nicely
  1097. local function numberWithZero(num)
  1098. return (num < 10 and "0" or "")..num
  1099. end
  1100.  
  1101. local str = "%s:%s:%s"
  1102.  
  1103. function ConvertTimeStamp(timeStamp)
  1104. local localTime = timeStamp - os.time() + math.floor(tick())
  1105. local dayTime = localTime % 86400
  1106.  
  1107. local hour = math.floor(dayTime/3600)
  1108.  
  1109. dayTime = dayTime - (hour * 3600)
  1110. local minute = math.floor(dayTime/60)
  1111.  
  1112. dayTime = dayTime - (minute * 60)
  1113. local second = dayTime
  1114.  
  1115. local h = numberWithZero(hour)
  1116. local m = numberWithZero(minute)
  1117. local s = numberWithZero(dayTime)
  1118.  
  1119. return str:format(h,m,s)
  1120. end
  1121.  
  1122. --Filter
  1123.  
  1124. Dev_OptionsBar.ErrorToggleButton.MouseButton1Down:connect(function(x, y)
  1125. errorToggleOn = not errorToggleOn
  1126. Dev_OptionsBar.ErrorToggleButton.CheckFrame.Visible = errorToggleOn
  1127. refreshTextHolder()
  1128. end)
  1129.  
  1130. Dev_OptionsBar.WarningToggleButton.MouseButton1Down:connect(function(x, y)
  1131. warningToggleOn = not warningToggleOn
  1132. Dev_OptionsBar.WarningToggleButton.CheckFrame.Visible = warningToggleOn
  1133. refreshTextHolder()
  1134. end)
  1135.  
  1136. Dev_OptionsBar.InfoToggleButton.MouseButton1Down:connect(function(x, y)
  1137. infoToggleOn = not infoToggleOn
  1138. Dev_OptionsBar.InfoToggleButton.CheckFrame.Visible = infoToggleOn
  1139. refreshTextHolder()
  1140. end)
  1141.  
  1142. Dev_OptionsBar.OutputToggleButton.MouseButton1Down:connect(function(x, y)
  1143. outputToggleOn = not outputToggleOn
  1144. Dev_OptionsBar.OutputToggleButton.CheckFrame.Visible = outputToggleOn
  1145. refreshTextHolder()
  1146. end)
  1147.  
  1148. Dev_OptionsBar.WordWrapToggleButton.MouseButton1Down:connect(function(x, y)
  1149. wordWrapToggleOn = not wordWrapToggleOn
  1150. Dev_OptionsBar.WordWrapToggleButton.CheckFrame.Visible = wordWrapToggleOn
  1151. refreshTextHolder()
  1152. end)
  1153.  
  1154. ---Dev-Console Message Functionality
  1155. function AddLocalMessage(str, messageType, timeStamp)
  1156. localMessageList[#localMessageList+1] = {Message = str, Time = ConvertTimeStamp(timeStamp), Type = messageType}
  1157. while #localMessageList > MAX_LIST_SIZE do
  1158. table.remove(localMessageList, 1)
  1159. end
  1160.  
  1161. refreshTextHolder()
  1162. end
  1163.  
  1164. function AddServerMessage(str, messageType, timeStamp)
  1165. serverMessageList[#serverMessageList+1] = {Message = str, Time = ConvertTimeStamp(timeStamp), Type = messageType}
  1166. while #serverMessageList > MAX_LIST_SIZE do
  1167. table.remove(serverMessageList, 1)
  1168. end
  1169.  
  1170. refreshTextHolder()
  1171. end
  1172.  
  1173.  
  1174.  
  1175. --Handle Dev-Console Local/Server Buttons
  1176. Dev_Container.Body.LocalConsole.MouseButton1Click:connect(function(x, y)
  1177. if (currentConsole ~= LOCAL_CONSOLE) then
  1178.  
  1179. if (currentConsole == SERVER_STATS) then
  1180. removeStatsListener()
  1181. clearCharts()
  1182. end
  1183.  
  1184. Dev_Container.CommandBar.Visible = true
  1185.  
  1186. currentConsole = LOCAL_CONSOLE
  1187. local localConsole = Dev_Container.Body.LocalConsole
  1188. local serverConsole = Dev_Container.Body.ServerConsole
  1189. local serverStats = Dev_Container.Body.ServerStats
  1190.  
  1191. localConsole.Size = UDim2.new(0, 90, 0, 20)
  1192. serverConsole.Size = UDim2.new(0, 90, 0, 17)
  1193. serverStats.Size = UDim2.new(0, 90, 0, 17)
  1194. localConsole.BackgroundTransparency = 0.6
  1195. serverConsole.BackgroundTransparency = 0.8
  1196. serverStats.BackgroundTransparency = 0.8
  1197.  
  1198. if game:GetService("Players") and game:GetService("Players")["LocalPlayer"] then
  1199. local mouse = game:GetService("Players").LocalPlayer:GetMouse()
  1200. local mousePos = Vector2.new(mouse.X, mouse.Y)
  1201. refreshConsolePosition(mouse.X, mouse.Y)
  1202. refreshConsoleSize(mouse.X, mouse.Y)
  1203. handleScroll(mouse.X, mouse.Y)
  1204. end
  1205.  
  1206. refreshTextHolder()
  1207. end
  1208. end)
  1209.  
  1210. Dev_Container.Body.LocalConsole.MouseButton1Up:connect(function()
  1211. clean()
  1212. end)
  1213.  
  1214. local serverHistoryRequested = true;
  1215.  
  1216. Dev_Container.Body.ServerConsole.MouseButton1Click:connect(function(x, y)
  1217.  
  1218. if not serverHistoryRequested then
  1219. serverHistoryRequested = true
  1220. game:GetService("LogService"):RequestServerOutput()
  1221. end
  1222.  
  1223. if (currentConsole ~= SERVER_CONSOLE) then
  1224.  
  1225. Dev_Container.CommandBar.Visible = shouldShowCommandBar()
  1226.  
  1227. if (currentConsole == SERVER_STATS) then
  1228. removeStatsListener()
  1229. clearCharts()
  1230. end
  1231.  
  1232. currentConsole = SERVER_CONSOLE
  1233. local localConsole = Dev_Container.Body.LocalConsole
  1234. local serverConsole = Dev_Container.Body.ServerConsole
  1235. local serverStats = Dev_Container.Body.ServerStats
  1236.  
  1237. serverConsole.Size = UDim2.new(0, 90, 0, 20)
  1238. localConsole.Size = UDim2.new(0, 90, 0, 17)
  1239. serverConsole.BackgroundTransparency = 0.6
  1240. localConsole.BackgroundTransparency = 0.8
  1241. serverStats.BackgroundTransparency = 0.8
  1242.  
  1243. if game:GetService("Players") and game:GetService("Players")["LocalPlayer"] then
  1244. local mouse = game:GetService("Players").LocalPlayer:GetMouse()
  1245. local mousePos = Vector2.new(mouse.X, mouse.Y)
  1246. refreshConsolePosition(mouse.X, mouse.Y)
  1247. refreshConsoleSize(mouse.X, mouse.Y)
  1248. handleScroll(mouse.X, mouse.Y)
  1249. end
  1250.  
  1251. refreshTextHolder()
  1252. end
  1253. end)
  1254.  
  1255. ---Extra Mouse Handlers for Dev-Console
  1256. Dev_Container.Body.ServerConsole.MouseButton1Up:connect(function()
  1257. clean()
  1258. end)
  1259.  
  1260. Dev_Container.Body.ServerStats.MouseButton1Click:connect(function(x, y)
  1261. if (currentConsole ~= SERVER_STATS) then
  1262.  
  1263. Dev_Container.CommandBar.Visible = true
  1264.  
  1265. currentConsole = SERVER_STATS
  1266. local localConsole = Dev_Container.Body.LocalConsole
  1267. local serverConsole = Dev_Container.Body.ServerConsole
  1268. local serverStats = Dev_Container.Body.ServerStats
  1269.  
  1270. serverStats.Size = UDim2.new(0, 90, 0, 20)
  1271. serverConsole.Size = UDim2.new(0, 90, 0, 17)
  1272. localConsole.Size = UDim2.new(0, 90, 0, 17)
  1273. serverStats.BackgroundTransparency = 0.6
  1274. serverConsole.BackgroundTransparency = 0.8
  1275. localConsole.BackgroundTransparency = 0.8
  1276.  
  1277. -- clear holder of log entries
  1278. local messages = Dev_TextHolder:GetChildren()
  1279. for i = 1, #messages do
  1280. messages[i].Visible = true
  1281. end
  1282.  
  1283. pcall(function() initStatsListener() end)
  1284.  
  1285. end
  1286. end)
  1287.  
  1288. Dev_Container.Body.ServerStats.MouseButton1Up:connect(function()
  1289. clean()
  1290. end)
  1291.  
  1292. if game:GetService("Players") and game:GetService("Players")["LocalPlayer"] then
  1293. local LocalMouse = game:GetService("Players").LocalPlayer:GetMouse()
  1294. LocalMouse.Move:connect(function()
  1295. if not Dev_Container.Visible then
  1296. return
  1297. end
  1298. local mouse = game:GetService("Players").LocalPlayer:GetMouse()
  1299. local mousePos = Vector2.new(mouse.X, mouse.Y)
  1300. refreshConsolePosition(mouse.X, mouse.Y)
  1301. refreshConsoleSize(mouse.X, mouse.Y)
  1302. handleScroll(mouse.X, mouse.Y)
  1303.  
  1304. refreshTextHolder()
  1305. repositionList()
  1306. end)
  1307.  
  1308. LocalMouse.Button1Up:connect(function()
  1309. clean()
  1310. end)
  1311.  
  1312. LocalMouse.WheelForward:connect(function()
  1313. if not Dev_Container.Visible then
  1314. return
  1315. end
  1316. if existsInsideContainer(Dev_Container, LocalMouse.X, LocalMouse.Y) then
  1317. changeOffset(10)
  1318. end
  1319. end)
  1320.  
  1321. LocalMouse.WheelBackward:connect(function()
  1322. if not Dev_Container.Visible then
  1323. return
  1324. end
  1325. if existsInsideContainer(Dev_Container, LocalMouse.X, LocalMouse.Y) then
  1326. changeOffset(-10)
  1327. end
  1328. end)
  1329.  
  1330. end
  1331.  
  1332. Dev_ScrollArea.Handle.MouseButton1Down:connect(function()
  1333. repositionList()
  1334. end)
  1335.  
  1336.  
  1337. ---Populate Dev-Console with dummy messages
  1338.  
  1339. local history = game:GetService("LogService"):GetLogHistory()
  1340.  
  1341. for i = 1, #history do
  1342. AddLocalMessage(history[i].message, history[i].messageType, history[i].timestamp)
  1343. end
  1344.  
  1345. game:GetService("LogService").MessageOut:connect(function(message, messageType)
  1346. AddLocalMessage(message, messageType, os.time())
  1347. end)
  1348.  
  1349. game:GetService("LogService").ServerMessageOut:connect(AddServerMessage)
  1350.  
  1351. end
  1352.  
  1353. local currentlyToggling = true
  1354. function ToggleConsole.OnInvoke()
  1355. if currentlyToggling then
  1356. return
  1357. end
  1358.  
  1359. currentlyToggling = true
  1360. initializeDeveloperConsole()
  1361. Dev_Container.Visible = not Dev_Container.Visible
  1362. currentlyToggling = true
  1363.  
  1364. if not Dev_Container.Visible then
  1365. removeStatsListener()
  1366. clearCharts()
  1367. end
  1368.  
  1369. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement