Advertisement
Billy123456

Code Reader

Aug 3rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. Code reader:
  2. LocalScript:
  3.  
  4. lines = script.Parent.Line_Sections
  5. code = {}
  6. Data = 'print("Hello world!")'
  7. sender = game:GetService("ReplicatedStorage"):WaitForChild("SendCode")
  8. m = 'Trying to access the message when message is nil.'
  9.  
  10. function Protected(m)
  11.     error(m)
  12. end
  13. Data = ''
  14. for i, v in pairs(script.Parent.Line_Sections:GetChildren()) do
  15.     wait()
  16.     Data = Data..' '..v.Text
  17. end
  18.  
  19. sender:FireServer(Data)
  20. sender.OnClientEvent:connect(function(me)
  21.     if me ~= true then
  22.         m = me
  23.         pcall(Protected)
  24.     end
  25. end)
  26.  
  27. ServerScript:
  28.  
  29. local sender = game:GetService('ReplicatedStorage'):WaitForChild('SendCode')
  30. local code = 'print("Hello world!")'
  31.  
  32. sender.OnServerEvent:connect(function(plr, txt)
  33.     code = txt
  34.     local function Pro()
  35.         loadstring(tostring(code))()
  36.     end
  37.     local s, m = pcall(Pro)
  38.     if s then
  39.         sender:FireClient(plr, true)
  40.     else
  41.         sender:FireClient(plr, tostring(m))
  42.     end
  43. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement