Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Create the SurfaceGui
- local Console = Instance.new("SurfaceGui")
- Console.Parent = game.Workspace.CurrentCamera
- -- Create the input box
- local Input = Instance.new("TextBox")
- Input.Name = "Input"
- Input.Size = UDim2.new(0.8, 0, 0.1, 0)
- Input.Position = UDim2.new(0.1, 0, 0.1, 0)
- Input.ClearTextOnFocus = true
- Input.Parent = Console
- -- Create the output box
- local Output = Instance.new("TextLabel")
- Output.Name = "Output"
- Output.Size = UDim2.new(0.8, 0, 0.8, 0)
- Output.Position = UDim2.new(0.1, 0, 0.2, 0)
- Output.BackgroundTransparency = 0.8
- Output.BackgroundColor3 = Color3.new(0, 0, 0)
- Output.TextColor3 = Color3.new(1, 1, 1)
- Output.TextWrapped = true
- Output.TextXAlignment = Enum.TextXAlignment.Left
- Output.TextYAlignment = Enum.TextYAlignment.Top
- Output.Font = Enum.Font.SourceSans
- Output.TextSize = 18
- Output.Text = ""
- Output.Parent = Console
- -- Connect the input box's FocusLost event to execute the command
- Input.FocusLost:Connect(function(enterPressed)
- if enterPressed then
- local command = Input.Text
- Input.Text = ""
- -- Execute the command and output the result
- local success, result = pcall(function()
- return loadstring(command)()
- end)
- if success then
- Output.Text = tostring(result)
- else
- Output.Text = "Error: " .. tostring(result)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement