ryghost

Environment

Aug 19th, 2019
159
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Environment = {
  2.     GetMetatable = getrawmetatable or debug.getmetatable or false,
  3.     GetUpvalues = debug.getupvalues or getupvalues or getupvals or false,
  4.     GetLocals = (isluau() and debug.getlocals) or (debug.getstack and function(stkid)
  5.         local r = {}
  6.         r.caller = debug.getstack(stkid + 1)[1]
  7.         r.player = debug.getstack(stkid + 1)[2]
  8.         return r
  9.     end) or false,
  10.     SetUpvalue = debug.setupvalue or setupval or false,
  11.     MetaWrite = function(meta)
  12.         if not setreadonly then
  13.             return make_writeable(meta)
  14.         end
  15.         return setreadonly(meta, false)
  16.     end,
  17.     Place = false
  18. }
  19.  
  20. local SharedMeta = Environment.GetMetatable(getrenv().shared)
  21. if SharedMeta then
  22.     Environment.Place = "Vanilla"
  23. end
  24.  
  25. if not Environment.Place then
  26.     local Pod = rawget(game:GetObjects("rbxassetid://2640185420"), 1)
  27.     local Ok = Pod.MessageBox.OK.Ok
  28.     Pod.Parent = Arsenic.Client.PlayerGui
  29.     Pod.MessageBox.Title.Text = 'Invalid environement'
  30.     Pod.MessageBox.Content.Text = 'Arsenic does not support the current game'
  31.     Ok.Visible = true
  32.     Ok.MouseButton1Click:Connect(function()
  33.         Pod:Destroy()
  34.     end)
  35.     return
  36. end
  37.  
  38. local fireserver
  39. if SharedMeta.__index then
  40.     if not isluau() then
  41.         fireserver = Environment.GetUpvalues(SharedMeta.__index).fireserver
  42.         Environment.SetUpvalue(fireserver, "heystopokay", function() return error end)
  43.         Environment.SetUpvalue(fireserver, "plsno", function() return true end)
  44.     else
  45.         fireserver = debug.getupvalue(SharedMeta.__index, 3)
  46.         Environment.SetUpvalue(fireserver, 1, function() return error end)
  47.         Environment.SetUpvalue(fireserver, 2, function() return true end)
  48.     end
  49. end
  50.  
  51. setmetatable(Arsenic, {
  52.     __index = {
  53.         Client = game:GetService("Players").LocalPlayer,
  54.         UI = Arsenic.Interface,
  55.         Globals = (function()
  56.             return getrenv()._G
  57.         end)(),
  58.         Remote = workspace.Remote
  59.     },
  60.     __call = function(t, remote, ...)
  61.         fireserver(remote, ...)
  62.     end
  63. })
  64.  
  65. return Environment
RAW Paste Data