Advertisement
VoidScripteay72

Untitled

Feb 28th, 2023
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. -- Listen for chat messages
  2. game:GetService("Players").Chat:Connect(function(msg)
  3. -- Check if message starts with "/execute"
  4. if msg:sub(1, 8) == "/execute" then
  5. -- Get the Lua code after "/execute"
  6. local luaCode = msg:sub(10)
  7. -- Execute the Lua code
  8. local success, errorMsg = pcall(loadstring(luaCode))
  9. -- If there was an error, display it in the chat
  10. if not success then
  11. game:GetService("Chat"):Chat(game:GetService("Players").LocalPlayer.Character, "Error: " .. errorMsg)
  12. end
  13. end
  14. end)
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement