Advertisement
TigerManGamingYT

Simple Console

Jun 9th, 2020
1,243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.48 KB | None | 0 0
  1. -- I should probably note that this does NOT work with exploits at the moment, i need to fix it.
  2. --[[
  3.     Simple Console
  4.     --------------
  5.     API:
  6.  
  7.     Get the module:
  8.  
  9.     Module = loadstring(game:HttpGet('https://pastebin.com/raw/qWETb4MR'),true)()
  10.  
  11.     Create a console object:
  12.  
  13.     local MyConsole = Module:new(string Name,bool KeySounds) -- Keystroke sounds will be played if true.
  14.  
  15.     Print to the console:
  16.  
  17.     MyConsole:write(...) -- Writes whatever you put in it to the console. Overflow is NOT implemented yet, so long strings wont work.
  18.  
  19.     Allow for (a/ the next) command to be entered:
  20.  
  21.     MyConsole:newLine() -- This will return to an input.
  22.  
  23.     Receive input:
  24.  
  25.     MyConsole.OnInput.Event:Connect(function(string Text) -- This BindableEvent will return results when the input box is returned.
  26.         **
  27.     end)
  28.  
  29.     Terminate the console session:
  30.  
  31.     MyConsole:terminate() -- This closes the terminal.
  32.  
  33.     Receive termination event:
  34.  
  35.     MyConsole.OnTerminate.Event:Connect(function() -- This BindableEvent will return when the console is terminated (button or func)
  36.         **
  37.     end)
  38.  
  39.  ]]
  40. local module = {}
  41.  
  42. local TextService = game:GetService("TextService")
  43.  
  44. local _HOST = Instance.new("ScreenGui")
  45. _HOST.Name = "HostUI"
  46. _HOST.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  47.  
  48. function module:new(Name,SoundEnabled)
  49.     local MainFrame = Instance.new("Frame")
  50.     local Topbar = Instance.new("Frame")
  51.     local TitleText = Instance.new("TextLabel")
  52.     local CloseButton = Instance.new("TextButton")
  53.     local Topoutline = Instance.new("Frame")
  54.     local ConsoleHolder = Instance.new("ScrollingFrame")
  55.    
  56.     local Self = {}
  57.    
  58.     local _NAME = Name
  59.     local _SOUND = SoundEnabled
  60.     Self.OnInput = Instance.new("BindableEvent")
  61.     Self.OnTerminate = Instance.new("BindableEvent")
  62.     Self.OnInput.Parent = MainFrame
  63.     Self.OnTerminate.Parent = MainFrame
  64.     local _PATH = "-$"
  65.     local _CURRENTLINE = nil
  66.    
  67.     local KeySounds = {}
  68.     for i = 1,5 do
  69.         local sid = {5154051249,5154065184,5154065838,5154066806,5154067267}
  70.         local Sound = Instance.new("Sound")
  71.         Sound.Name = "Sound"..tostring(i)
  72.         Sound.SoundId = "rbxassetid://"..tostring(sid[i])
  73.         Sound.Parent = MainFrame
  74.         table.insert(KeySounds,Sound)
  75.     end
  76.    
  77.  
  78.     MainFrame.Name = _NAME
  79.     MainFrame.Parent = _HOST
  80.     MainFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  81.     MainFrame.BackgroundTransparency = 0.200
  82.     MainFrame.BorderColor3 = Color3.fromRGB(211, 123, 0)
  83.     MainFrame.Position = UDim2.new(0.234869838, 0, 0.158716679, 0)
  84.     MainFrame.Size = UDim2.new(0, 855, 0, 530)
  85.  
  86.     Topbar.Name = "Topbar"
  87.     Topbar.Parent = MainFrame
  88.     Topbar.BackgroundColor3 = Color3.fromRGB(33, 33, 33)
  89.     Topbar.BorderSizePixel = 0
  90.     Topbar.Size = UDim2.new(0, 855, 0, 30)
  91.  
  92.     TitleText.Name = "TitleText"
  93.     TitleText.Parent = Topbar
  94.     TitleText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  95.     TitleText.BackgroundTransparency = 1.000
  96.     TitleText.BorderSizePixel = 0
  97.     TitleText.Position = UDim2.new(0.0116959065, 0, 0.181818187, 0)
  98.     TitleText.Size = UDim2.new(0, 120, 0, 20)
  99.     TitleText.Font = Enum.Font.Code
  100.     TitleText.Text = _NAME
  101.     TitleText.TextColor3 = Color3.fromRGB(230, 230, 230)
  102.     TitleText.TextSize = 14.000
  103.     TitleText.TextXAlignment = Enum.TextXAlignment.Left
  104.    
  105.     CloseButton.Name = "CloseButton"
  106.     CloseButton.Parent = Topbar
  107.     CloseButton.BackgroundColor3 = Color3.fromRGB(255, 85, 0)
  108.     CloseButton.BorderSizePixel = 0
  109.     CloseButton.Position = UDim2.new(0.96725142, 0, 0.181818008, 0)
  110.     CloseButton.Size = UDim2.new(0, 20, 0, 20)
  111.     CloseButton.Font = Enum.Font.SourceSansBold
  112.     CloseButton.Text = "X"
  113.     CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  114.     CloseButton.TextSize = 14.000
  115.    
  116.     Topoutline.Name = "Topoutline"
  117.     Topoutline.Parent = MainFrame
  118.     Topoutline.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  119.     Topoutline.BorderSizePixel = 0
  120.     Topoutline.Position = UDim2.new(0, 0, 0.0622641519, 0)
  121.     Topoutline.Size = UDim2.new(0, 855, 0, 1)
  122.    
  123.     ConsoleHolder.Name = "ConsoleHolder"
  124.     ConsoleHolder.Parent = MainFrame
  125.     ConsoleHolder.Active = true
  126.     ConsoleHolder.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  127.     ConsoleHolder.BackgroundTransparency = 1.000
  128.     ConsoleHolder.BorderSizePixel = 0
  129.     ConsoleHolder.Position = UDim2.new(0, 0, 0.0622641519, 0)
  130.     ConsoleHolder.Size = UDim2.new(0, 855, 0, 497)
  131.     ConsoleHolder.CanvasSize = UDim2.new(0, 0, 0, 0)
  132.     ConsoleHolder.ScrollBarImageColor3 = Color3.fromRGB(255,140,0)
  133.     ConsoleHolder.ScrollBarThickness = 20
  134.     ConsoleHolder.VerticalScrollBarInset = Enum.ScrollBarInset.Always
  135.    
  136.     local Lines = 5
  137.    
  138.     function Self:write(...)
  139.        
  140.         Lines = Lines + 20
  141.        
  142.         local Result = ""
  143.         local arg = {...}
  144.         for _,v in ipairs(arg) do
  145.             Result = Result .. tostring(v) .. "\t"
  146.         end
  147.         local PathLabel = Instance.new("TextLabel")
  148.         local PathLength = (5*#Result+2)
  149.         local PathSize = TextService:GetTextSize(Result,14,Enum.Font.Code,Vector2.new(0,PathLength,0,20))
  150.         PathLabel.Name = "PathLabel"
  151.         PathLabel.Parent = ConsoleHolder
  152.         PathLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  153.         PathLabel.BackgroundTransparency = 1.000
  154.         PathLabel.BorderSizePixel = 0
  155.         PathLabel.Position = UDim2.new(0, 10, 0, Lines)
  156.         PathLabel.Size = UDim2.new(0, PathSize.X, 0, 20)
  157.         PathLabel.Font = Enum.Font.Code
  158.         PathLabel.Text = Result
  159.         PathLabel.TextColor3 = Color3.fromRGB(58, 176, 86)
  160.         PathLabel.TextSize = 14.000
  161.         PathLabel.TextXAlignment = Enum.TextXAlignment.Left
  162.         if _CURRENTLINE then
  163.             if _CURRENTLINE[2] then
  164.                 _CURRENTLINE[2].TextEditable = false
  165.             end
  166.         end
  167.         ConsoleHolder.CanvasSize = UDim2.new(0,0,0,Lines+PathLabel.TextBounds.Y+4)
  168.         ConsoleHolder.CanvasPosition = Vector2.new(0,ConsoleHolder.CanvasPosition.Y+PathLabel.TextBounds.Y+50)
  169.     end
  170.    
  171.     function Self:newLine()
  172.         local InputLabel = Instance.new("TextBox")
  173.         local PathLabel = Instance.new("TextLabel")
  174.        
  175.         local TextPath = _PATH.." >"
  176.         local PathLength = (5*#_PATH+2)
  177.         local PathSize = TextService:GetTextSize(TextPath,14,Enum.Font.Code,Vector2.new(0,PathLength,0,20))
  178.        
  179.         Lines = Lines + 20
  180.        
  181.         PathLabel.Name = "PathLabel"
  182.         PathLabel.Parent = ConsoleHolder
  183.         PathLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  184.         PathLabel.BackgroundTransparency = 1.000
  185.         PathLabel.BorderSizePixel = 0
  186.         PathLabel.Position = UDim2.new(0, 10, 0, Lines)
  187.         PathLabel.Size = UDim2.new(0, PathSize.X, 0, 20)
  188.         PathLabel.Font = Enum.Font.Code
  189.         PathLabel.Text = TextPath
  190.         PathLabel.TextColor3 = Color3.fromRGB(58, 176, 86)
  191.         PathLabel.TextSize = 14.000
  192.         PathLabel.TextXAlignment = Enum.TextXAlignment.Left
  193.        
  194.         InputLabel.Name = "InputLabel"
  195.         InputLabel.Parent = ConsoleHolder
  196.         InputLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  197.         InputLabel.BackgroundTransparency = 1.000
  198.         InputLabel.BorderSizePixel = 0
  199.         InputLabel.Position = UDim2.new(0, (PathSize.X+17), 0, Lines)
  200.         InputLabel.Selectable = false
  201.         InputLabel.Size = UDim2.new(0, (855-(PathSize.X+17)), 0, 20)
  202.         InputLabel.Font = Enum.Font.Code
  203.         InputLabel.ShowNativeInput = false
  204.         InputLabel.Text = ""
  205.         InputLabel.TextColor3 = Color3.fromRGB(58, 176, 86)
  206.         InputLabel.TextSize = 14.000
  207.         InputLabel.TextXAlignment = Enum.TextXAlignment.Left
  208.        
  209.         ConsoleHolder.CanvasSize = UDim2.new(0,0,0,Lines+InputLabel.TextBounds.Y+4)
  210.         ConsoleHolder.CanvasPosition = Vector2.new(0,ConsoleHolder.CanvasPosition.Y+InputLabel.TextBounds.Y+50)
  211.        
  212.         InputLabel:CaptureFocus()
  213.  
  214.         InputLabel.FocusLost:Connect(function(IsReturn)
  215.             if IsReturn then
  216.                 if InputLabel.TextEditable then
  217.                     Self.OnInput:Fire(InputLabel.Text)
  218.                     InputLabel.TextEditable = false
  219.                 end
  220.             end
  221.         end)
  222.        
  223.         InputLabel.Focused:Connect(function()
  224.             if not InputLabel.TextEditable then
  225.                 InputLabel:ReleaseFocus()
  226.                 if _CURRENTLINE then
  227.                     if _CURRENTLINE[2] then
  228.                         _CURRENTLINE[2]:CaptureFocus()
  229.                     end
  230.                 end
  231.             end
  232.         end)
  233.        
  234.         if _SOUND then
  235.             coroutine.resume(coroutine.create(function()
  236.                 local Last = InputLabel.Text
  237.                 while InputLabel.TextEditable do
  238.                     if InputLabel.Text ~= Last then
  239.                         if InputLabel.Text < Last then
  240.                             KeySounds[math.random(1,3)]:Play()
  241.                         elseif InputLabel.Text > Last then
  242.                             KeySounds[math.random(1,#KeySounds)]:Play()
  243.                         end
  244.                         Last = InputLabel.Text
  245.                     end
  246.                     wait()
  247.                 end
  248.             end))
  249.         end
  250.        
  251.         _CURRENTLINE = {PathLabel,InputLabel}
  252.     end
  253.    
  254.      function Self:clear()
  255.         for _,v in pairs(ConsoleHolder:GetChildren()) do
  256.             v:Destroy()
  257.             Self:newLine()
  258.         end
  259.     end
  260.    
  261.     function Self:getPath()
  262.         return _PATH
  263.     end
  264.    
  265.     function Self:setPath(Path)
  266.         _PATH = Path
  267.     end
  268.    
  269.     function Self:terminate()
  270.         Self.OnTerminate:Fire()
  271.         MainFrame:Destroy()
  272.     end
  273.    
  274.     CloseButton.MouseButton1Click:Connect(function()
  275.         Self:terminate()
  276.     end)
  277.    
  278.     return Self
  279. end
  280.  
  281.  
  282.  
  283.  
  284.  
  285. return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement