Advertisement
Guest User

Roblox Dev Console LUA!!!!!

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