Kiriot22

MultiObj

Jun 16th, 2018
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. local function MultiObj(obj)
  2.     local fake = newproxy(true)
  3.     local mt = getmetatable(fake)
  4.     mt.__index = function(self, i)
  5.         return obj[i]
  6.     end
  7.     mt.__namecall = function(self, ...)
  8.         local args = {...}
  9.         local method = args[#args]
  10.         args[#args] = nil
  11.         if method == "delay" then
  12.             wait(tonumber(args[1]) or 0)
  13.             return fake
  14.         end
  15.         obj[method](obj, unpack(args))
  16.         return fake
  17.     end
  18.     return fake
  19. end
  20.  
  21. do
  22.     local rin = Instance.new
  23.     Instance = {
  24.         new = function(cn, par)
  25.             return MultiObj(rin(cn, par))
  26.         end
  27.     }
  28. end
  29.  
  30. local part = Instance.new("Part", workspace)
  31. part:Explode()
  32.     :delay(1)
  33.     :Destroy()
Advertisement
Add Comment
Please, Sign In to add comment