Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- I should probably note that this does NOT work with exploits at the moment, i need to fix it.
- --[[
- Simple Console
- --------------
- API:
- Get the module:
- Module = loadstring(game:HttpGet('https://pastebin.com/raw/qWETb4MR'),true)()
- Create a console object:
- local MyConsole = Module:new(string Name,bool KeySounds) -- Keystroke sounds will be played if true.
- Print to the console:
- MyConsole:write(...) -- Writes whatever you put in it to the console. Overflow is NOT implemented yet, so long strings wont work.
- Allow for (a/ the next) command to be entered:
- MyConsole:newLine() -- This will return to an input.
- Receive input:
- MyConsole.OnInput.Event:Connect(function(string Text) -- This BindableEvent will return results when the input box is returned.
- **
- end)
- Terminate the console session:
- MyConsole:terminate() -- This closes the terminal.
- Receive termination event:
- MyConsole.OnTerminate.Event:Connect(function() -- This BindableEvent will return when the console is terminated (button or func)
- **
- end)
- ]]
- local module = {}
- local TextService = game:GetService("TextService")
- local _HOST = Instance.new("ScreenGui")
- _HOST.Name = "HostUI"
- _HOST.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- function module:new(Name,SoundEnabled)
- local MainFrame = Instance.new("Frame")
- local Topbar = Instance.new("Frame")
- local TitleText = Instance.new("TextLabel")
- local CloseButton = Instance.new("TextButton")
- local Topoutline = Instance.new("Frame")
- local ConsoleHolder = Instance.new("ScrollingFrame")
- local Self = {}
- local _NAME = Name
- local _SOUND = SoundEnabled
- Self.OnInput = Instance.new("BindableEvent")
- Self.OnTerminate = Instance.new("BindableEvent")
- Self.OnInput.Parent = MainFrame
- Self.OnTerminate.Parent = MainFrame
- local _PATH = "-$"
- local _CURRENTLINE = nil
- local KeySounds = {}
- for i = 1,5 do
- local sid = {5154051249,5154065184,5154065838,5154066806,5154067267}
- local Sound = Instance.new("Sound")
- Sound.Name = "Sound"..tostring(i)
- Sound.SoundId = "rbxassetid://"..tostring(sid[i])
- Sound.Parent = MainFrame
- table.insert(KeySounds,Sound)
- end
- MainFrame.Name = _NAME
- MainFrame.Parent = _HOST
- MainFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- MainFrame.BackgroundTransparency = 0.200
- MainFrame.BorderColor3 = Color3.fromRGB(211, 123, 0)
- MainFrame.Position = UDim2.new(0.234869838, 0, 0.158716679, 0)
- MainFrame.Size = UDim2.new(0, 855, 0, 530)
- Topbar.Name = "Topbar"
- Topbar.Parent = MainFrame
- Topbar.BackgroundColor3 = Color3.fromRGB(33, 33, 33)
- Topbar.BorderSizePixel = 0
- Topbar.Size = UDim2.new(0, 855, 0, 30)
- TitleText.Name = "TitleText"
- TitleText.Parent = Topbar
- TitleText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- TitleText.BackgroundTransparency = 1.000
- TitleText.BorderSizePixel = 0
- TitleText.Position = UDim2.new(0.0116959065, 0, 0.181818187, 0)
- TitleText.Size = UDim2.new(0, 120, 0, 20)
- TitleText.Font = Enum.Font.Code
- TitleText.Text = _NAME
- TitleText.TextColor3 = Color3.fromRGB(230, 230, 230)
- TitleText.TextSize = 14.000
- TitleText.TextXAlignment = Enum.TextXAlignment.Left
- CloseButton.Name = "CloseButton"
- CloseButton.Parent = Topbar
- CloseButton.BackgroundColor3 = Color3.fromRGB(255, 85, 0)
- CloseButton.BorderSizePixel = 0
- CloseButton.Position = UDim2.new(0.96725142, 0, 0.181818008, 0)
- CloseButton.Size = UDim2.new(0, 20, 0, 20)
- CloseButton.Font = Enum.Font.SourceSansBold
- CloseButton.Text = "X"
- CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- CloseButton.TextSize = 14.000
- Topoutline.Name = "Topoutline"
- Topoutline.Parent = MainFrame
- Topoutline.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Topoutline.BorderSizePixel = 0
- Topoutline.Position = UDim2.new(0, 0, 0.0622641519, 0)
- Topoutline.Size = UDim2.new(0, 855, 0, 1)
- ConsoleHolder.Name = "ConsoleHolder"
- ConsoleHolder.Parent = MainFrame
- ConsoleHolder.Active = true
- ConsoleHolder.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- ConsoleHolder.BackgroundTransparency = 1.000
- ConsoleHolder.BorderSizePixel = 0
- ConsoleHolder.Position = UDim2.new(0, 0, 0.0622641519, 0)
- ConsoleHolder.Size = UDim2.new(0, 855, 0, 497)
- ConsoleHolder.CanvasSize = UDim2.new(0, 0, 0, 0)
- ConsoleHolder.ScrollBarImageColor3 = Color3.fromRGB(255,140,0)
- ConsoleHolder.ScrollBarThickness = 20
- ConsoleHolder.VerticalScrollBarInset = Enum.ScrollBarInset.Always
- local Lines = 5
- function Self:write(...)
- Lines = Lines + 20
- local Result = ""
- local arg = {...}
- for _,v in ipairs(arg) do
- Result = Result .. tostring(v) .. "\t"
- end
- local PathLabel = Instance.new("TextLabel")
- local PathLength = (5*#Result+2)
- local PathSize = TextService:GetTextSize(Result,14,Enum.Font.Code,Vector2.new(0,PathLength,0,20))
- PathLabel.Name = "PathLabel"
- PathLabel.Parent = ConsoleHolder
- PathLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- PathLabel.BackgroundTransparency = 1.000
- PathLabel.BorderSizePixel = 0
- PathLabel.Position = UDim2.new(0, 10, 0, Lines)
- PathLabel.Size = UDim2.new(0, PathSize.X, 0, 20)
- PathLabel.Font = Enum.Font.Code
- PathLabel.Text = Result
- PathLabel.TextColor3 = Color3.fromRGB(58, 176, 86)
- PathLabel.TextSize = 14.000
- PathLabel.TextXAlignment = Enum.TextXAlignment.Left
- if _CURRENTLINE then
- if _CURRENTLINE[2] then
- _CURRENTLINE[2].TextEditable = false
- end
- end
- ConsoleHolder.CanvasSize = UDim2.new(0,0,0,Lines+PathLabel.TextBounds.Y+4)
- ConsoleHolder.CanvasPosition = Vector2.new(0,ConsoleHolder.CanvasPosition.Y+PathLabel.TextBounds.Y+50)
- end
- function Self:newLine()
- local InputLabel = Instance.new("TextBox")
- local PathLabel = Instance.new("TextLabel")
- local TextPath = _PATH.." >"
- local PathLength = (5*#_PATH+2)
- local PathSize = TextService:GetTextSize(TextPath,14,Enum.Font.Code,Vector2.new(0,PathLength,0,20))
- Lines = Lines + 20
- PathLabel.Name = "PathLabel"
- PathLabel.Parent = ConsoleHolder
- PathLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- PathLabel.BackgroundTransparency = 1.000
- PathLabel.BorderSizePixel = 0
- PathLabel.Position = UDim2.new(0, 10, 0, Lines)
- PathLabel.Size = UDim2.new(0, PathSize.X, 0, 20)
- PathLabel.Font = Enum.Font.Code
- PathLabel.Text = TextPath
- PathLabel.TextColor3 = Color3.fromRGB(58, 176, 86)
- PathLabel.TextSize = 14.000
- PathLabel.TextXAlignment = Enum.TextXAlignment.Left
- InputLabel.Name = "InputLabel"
- InputLabel.Parent = ConsoleHolder
- InputLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- InputLabel.BackgroundTransparency = 1.000
- InputLabel.BorderSizePixel = 0
- InputLabel.Position = UDim2.new(0, (PathSize.X+17), 0, Lines)
- InputLabel.Selectable = false
- InputLabel.Size = UDim2.new(0, (855-(PathSize.X+17)), 0, 20)
- InputLabel.Font = Enum.Font.Code
- InputLabel.ShowNativeInput = false
- InputLabel.Text = ""
- InputLabel.TextColor3 = Color3.fromRGB(58, 176, 86)
- InputLabel.TextSize = 14.000
- InputLabel.TextXAlignment = Enum.TextXAlignment.Left
- ConsoleHolder.CanvasSize = UDim2.new(0,0,0,Lines+InputLabel.TextBounds.Y+4)
- ConsoleHolder.CanvasPosition = Vector2.new(0,ConsoleHolder.CanvasPosition.Y+InputLabel.TextBounds.Y+50)
- InputLabel:CaptureFocus()
- InputLabel.FocusLost:Connect(function(IsReturn)
- if IsReturn then
- if InputLabel.TextEditable then
- Self.OnInput:Fire(InputLabel.Text)
- InputLabel.TextEditable = false
- end
- end
- end)
- InputLabel.Focused:Connect(function()
- if not InputLabel.TextEditable then
- InputLabel:ReleaseFocus()
- if _CURRENTLINE then
- if _CURRENTLINE[2] then
- _CURRENTLINE[2]:CaptureFocus()
- end
- end
- end
- end)
- if _SOUND then
- coroutine.resume(coroutine.create(function()
- local Last = InputLabel.Text
- while InputLabel.TextEditable do
- if InputLabel.Text ~= Last then
- if InputLabel.Text < Last then
- KeySounds[math.random(1,3)]:Play()
- elseif InputLabel.Text > Last then
- KeySounds[math.random(1,#KeySounds)]:Play()
- end
- Last = InputLabel.Text
- end
- wait()
- end
- end))
- end
- _CURRENTLINE = {PathLabel,InputLabel}
- end
- function Self:clear()
- for _,v in pairs(ConsoleHolder:GetChildren()) do
- v:Destroy()
- Self:newLine()
- end
- end
- function Self:getPath()
- return _PATH
- end
- function Self:setPath(Path)
- _PATH = Path
- end
- function Self:terminate()
- Self.OnTerminate:Fire()
- MainFrame:Destroy()
- end
- CloseButton.MouseButton1Click:Connect(function()
- Self:terminate()
- end)
- return Self
- end
- return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement