Advertisement
VoidScripteay72

lua enter

Feb 28th, 2023
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. -- Create the SurfaceGui
  2. local Console = Instance.new("SurfaceGui")
  3. Console.Parent = game.Workspace.CurrentCamera
  4.  
  5. -- Create the input box
  6. local Input = Instance.new("TextBox")
  7. Input.Name = "Input"
  8. Input.Size = UDim2.new(0.8, 0, 0.1, 0)
  9. Input.Position = UDim2.new(0.1, 0, 0.1, 0)
  10. Input.ClearTextOnFocus = true
  11. Input.Parent = Console
  12.  
  13. -- Create the output box
  14. local Output = Instance.new("TextLabel")
  15. Output.Name = "Output"
  16. Output.Size = UDim2.new(0.8, 0, 0.8, 0)
  17. Output.Position = UDim2.new(0.1, 0, 0.2, 0)
  18. Output.BackgroundTransparency = 0.8
  19. Output.BackgroundColor3 = Color3.new(0, 0, 0)
  20. Output.TextColor3 = Color3.new(1, 1, 1)
  21. Output.TextWrapped = true
  22. Output.TextXAlignment = Enum.TextXAlignment.Left
  23. Output.TextYAlignment = Enum.TextYAlignment.Top
  24. Output.Font = Enum.Font.SourceSans
  25. Output.TextSize = 18
  26. Output.Text = ""
  27. Output.Parent = Console
  28.  
  29. -- Connect the input box's FocusLost event to execute the command
  30. Input.FocusLost:Connect(function(enterPressed)
  31. if enterPressed then
  32. local command = Input.Text
  33. Input.Text = ""
  34.  
  35. -- Execute the command and output the result
  36. local success, result = pcall(function()
  37. return loadstring(command)()
  38. end)
  39.  
  40. if success then
  41. Output.Text = tostring(result)
  42. else
  43. Output.Text = "Error: " .. tostring(result)
  44. end
  45. end
  46. end)
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement