Advertisement
VoidScripteay72

e

Feb 28th, 2023
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. -- Create the SurfaceGui
  2. local ConsoleGui = Instance.new("SurfaceGui")
  3. ConsoleGui.Name = "ConsoleGui"
  4. ConsoleGui.Enabled = true
  5. ConsoleGui.Face = Enum.NormalId.Back
  6. ConsoleGui.Parent = game:GetService("Workspace")
  7.  
  8. -- Create the Frame for the Console
  9. local ConsoleFrame = Instance.new("Frame")
  10. ConsoleFrame.Name = "ConsoleFrame"
  11. ConsoleFrame.Size = UDim2.new(0, 250, 0, 150)
  12. ConsoleFrame.Position = UDim2.new(0.5, -125, 0.5, -75)
  13. ConsoleFrame.AnchorPoint = Vector2.new(0.5, 0.5)
  14. ConsoleFrame.BackgroundTransparency = 0.5
  15. ConsoleFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  16. ConsoleFrame.Parent = ConsoleGui
  17.  
  18. -- Create the output box
  19. local Output = Instance.new("TextLabel")
  20. Output.Name = "Output"
  21. Output.Size = UDim2.new(1, 0, 0.8, 0)
  22. Output.Position = UDim2.new(0, 0, 0.2, 0)
  23. Output.BackgroundTransparency = 0.8
  24. Output.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  25. Output.TextColor3 = Color3.fromRGB(255, 255, 255)
  26. Output.TextWrapped = true
  27. Output.TextXAlignment = Enum.TextXAlignment.Left
  28. Output.TextYAlignment = Enum.TextYAlignment.Top
  29. Output.Font = Enum.Font.SourceSans
  30. Output.TextSize = 18
  31. Output.Text = ""
  32. Output.Parent = ConsoleFrame
  33.  
  34. -- Create the input box
  35. local Input = Instance.new("TextBox")
  36. Input.Name = "Input"
  37. Input.Size = UDim2.new(1, 0, 0.2, 0)
  38. Input.Position = UDim2.new(0, 0, 0.8, 0)
  39. Input.ClearTextOnFocus = true
  40. Input.Parent = ConsoleFrame
  41.  
  42. -- Connect the input box's FocusLost event to execute the command
  43. Input.FocusLost:Connect(function(enterPressed)
  44. if enterPressed then
  45. local command = Input.Text
  46. Input.Text = ""
  47.  
  48. -- Execute the command and output the result
  49. local success, result = pcall(function()
  50. return loadstring(command)()
  51. end)
  52.  
  53. if success then
  54. Output.Text = tostring(result)
  55. else
  56. Output.Text = "Error: " .. tostring(result)
  57. end
  58. end
  59. end)
  60.  
  61. -- Create the Tool
  62. local ConsoleTool = {}
  63.  
  64. function ConsoleTool:Activate()
  65. -- Show the SurfaceGui
  66. ConsoleGui.Enabled = true
  67. end
  68.  
  69. function ConsoleTool:Deactivate()
  70. -- Hide the SurfaceGui
  71. ConsoleGui.Enabled = false
  72. end
  73.  
  74. return ConsoleTool
  75.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement