Advertisement
Guest User

Untitled

a guest
Jul 15th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. local enabled = {
  2. -- Set any of these objects to false to stop logging them
  3. BindableEvent = true;
  4. BindableFunction = true;
  5. RemoteEvent = true;
  6. RemoteFunction = true;
  7. }
  8.  
  9. local ignore = {
  10. -- Any remotes matching the names listed below will be ignored
  11. Event = true;
  12. }
  13.  
  14. local meta,oldmeta = getrawmetatable(game),{}
  15. changereadonly(meta, false)
  16. for i,v in next,meta do oldmeta[i] = v end
  17. function formatargs(args,showkeys)
  18. if #args == 0 then return "N/A" end
  19. local strargs = {}
  20. for k,v in next,args do
  21. local argstr = ""
  22. if type(v) == "string" then
  23. argstr = "\"" .. v .. "\""
  24. elseif type(v) == "table" then
  25. argstr = "{" .. formatargs(v,true) .. "}"
  26. else
  27. argstr = tostring(v)
  28. end
  29. if showkeys and type(k) ~= "number" then
  30. table.insert(strargs,k.."="..argstr)
  31. else
  32. table.insert(strargs,argstr)
  33. end
  34. end
  35. return table.concat(strargs, ", ")
  36. end
  37. local realmethods = {}
  38. realmethods.Fire = Instance.new("BindableEvent").Fire
  39. realmethods.Invoke = Instance.new("BindableFunction").Invoke
  40. realmethods.FireServer = Instance.new("RemoteEvent").FireServer
  41. realmethods.InvokeServer = Instance.new("RemoteFunction").InvokeServer
  42. meta.__index = function(t,k)
  43. if (k == "Fire" or k == "Invoke" or k == "FireServer" or k == "InvokeServer") and (enabled[t.ClassName] and not ignore[t.Name]) then
  44. return function(self,...)
  45. local args = {...}
  46. local ret = {realmethods[k](self,...)}
  47. warn(t.ClassName.." called!\nPath: "..t:GetFullName().."\n".."Args: "..formatargs(args).."\nReturn: "..formatargs(ret))
  48. return unpack(ret)
  49. end
  50. else
  51. return oldmeta.__index(t,k)
  52. end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement