Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Listen for chat messages
- game:GetService("Players").Chat:Connect(function(msg)
- -- Check if message starts with "/execute"
- if msg:sub(1, 8) == "/execute" then
- -- Get the Lua code after "/execute"
- local luaCode = msg:sub(10)
- -- Execute the Lua code
- local success, errorMsg = pcall(loadstring(luaCode))
- -- If there was an error, display it in the chat
- if not success then
- game:GetService("Chat"):Chat(game:GetService("Players").LocalPlayer.Character, "Error: " .. errorMsg)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement