Advertisement
LikeRampage

CHATGPT Executor Roblox Script in Roblox Studio

Aug 12th, 2023
1,543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.08 KB | None | 0 0
  1. --StarterGui LocalScript
  2. -- Create a ScreenGui and a TextBox for input
  3. local gui = Instance.new("ScreenGui")
  4. gui.Parent = game.Players.LocalPlayer.PlayerGui
  5.  
  6. local textBox = Instance.new("TextBox")
  7. textBox.Size = UDim2.new(0, 200, 0, 50)
  8. textBox.Position = UDim2.new(0.5, -100, 0.3, -25)
  9. textBox.PlaceholderText = "Enter code"
  10. textBox.Font = Enum.Font.SourceSans
  11. textBox.TextSize = 18
  12. textBox.Parent = gui
  13.  
  14. -- Create a TextButton for the execute button
  15. local button = Instance.new("TextButton")
  16. button.Size = UDim2.new(0, 200, 0, 50)
  17. button.Position = UDim2.new(0.5, -100, 0.4, -25)
  18. button.Text = "Execute"
  19. button.Font = Enum.Font.SourceSansBold
  20. button.TextSize = 18
  21. button.Parent = gui
  22.  
  23. -- Function to execute the code
  24. local function executeCode()
  25.     local code = textBox.Text
  26.  
  27.     -- Execute the code using loadstring
  28.     local success, result = pcall(loadstring(code))
  29.  
  30.     -- Display the result or error message
  31.     if success then
  32.         print("Code executed successfully!")
  33.     else
  34.         print("Error executing code: " .. tostring(result))
  35.     end
  36.  
  37.     -- Clear the input textbox
  38.     textBox.Text = ""
  39. end
  40.  
  41. -- Bind the executeCode function to the button click event
  42. button.MouseButton1Click:Connect(executeCode)
  43.  
  44. -- Function to clear the input textbox
  45. local function clearInput()
  46.     textBox.Text = ""
  47. end
  48.  
  49. -- Bind the clearInput function to the button double-click event
  50. button.MouseButton2Click:Connect(clearInput)
  51.  
  52. -- Create a TextButton for the destroy button
  53. local destroyButton = Instance.new("TextButton")
  54. destroyButton.Size = UDim2.new(0, 200, 0, 50)
  55. destroyButton.Position = UDim2.new(0.5, -100, 0.5, -25)
  56. destroyButton.Text = "Destroy GUI"
  57. destroyButton.Font = Enum.Font.SourceSans
  58. destroyButton.TextSize = 18
  59. destroyButton.Parent = gui
  60.  
  61. -- Function to destroy the GUI
  62. local function destroyGui()
  63.     gui:Destroy()
  64. end
  65.  
  66. -- Bind the destroyGui function to the destroy button click event
  67. destroyButton.MouseButton1Click:Connect(destroyGui)
  68.  
  69. -- Call the executeCode function to execute the initial code
  70. executeCode()
  71.  
  72. -- Run the code continuously
  73. while wait(1) do
  74.     executeCode()
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement