Advertisement
SINXSA

aaa

May 3rd, 2022
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.62 KB | None | 0 0
  1. _G.main = {}
  2. _G.main.settings = {
  3.   whitelist = {}, -- users in this table won't be affected by the esp
  4.   team = true, -- when false, team members will not be affected by the esp
  5.   fov = false, -- when false, the esp will appear even when not in your field of view
  6.   visibility = 0.5,
  7.   color = {
  8.       enemy = Color3.fromRGB(255, 50, 50), -- color of enemy esp
  9.       team = Color3.fromRGB(50, 255, 50) -- color of team member esp; will only appear if settings.team is set to true
  10.   }
  11. }
  12.  
  13. _G.main.settings.whitelist.id, _G.main.service, _G.main.util, _G.main.env, _G.main.deprecated = {}, setmetatable({}, {
  14.   __index = function(t, k)
  15.       return game:GetService(k)
  16.   end
  17. }), setmetatable({}, {
  18.   __index = function(t, k)
  19.       if k == 'client' then
  20.           return _G.main.service.Players.LocalPlayer
  21.       elseif k == 'playergui' then
  22.           return _G.main.util.client.PlayerGui
  23.       end
  24.       return rawget(t, k)
  25.   end
  26. }), getfenv(), {spawn = spawn}
  27.  
  28. _G.main.proxy = {}
  29. for k, v in next, _G.main do
  30.   _G.main.proxy[k] = v
  31. end
  32.  
  33. _G.main.settings = setmetatable({}, {
  34.   __index = _G.main.proxy.settings,
  35.   __newindex = function(t, k, v)
  36.       for i, esp in next, _G.main.folder:GetChildren() do
  37.           for i, face in next, esp:GetChildren() do -- get all the faces in the esp
  38.               if k == 'color' then
  39.                   face.Frame.BackgroundColor3 = v -- set to new color
  40.               elseif k == 'fov' then
  41.                   face.AlwaysOnTop = not v -- set to new prop
  42.               elseif k == 'visibility' then
  43.                   face.Frame.BackgroundTransparency = v
  44.               end
  45.           end
  46.       end
  47.       _G.main.service.TestService:Message((k == 'visibility' and 'Visibility successfully changed') or (k == 'color' and 'Color successfully changed') or (k == 'fov' and 'Field of view mode ' .. (v and 'enabled' or 'disabled')))
  48.       rawset(_G.main.proxy.settings, k, v) -- set its value
  49.   end
  50. })
  51.  
  52. _G.main.create = function(player) -- create the esp
  53.   local break_conditions = {
  54.       _G.main.settings.team or player.TeamColor == _G.main.util.client.TeamColor, -- check team color
  55.       _G.main.settings.whitelist.id[player.UserId] -- check if they're whitelisted
  56.   }
  57.   for i, condition in next, break_conditions do
  58.       if condition then
  59.           return i
  60.       end
  61.   end
  62.   local folder = Instance.new('Folder', _G.main.folder)
  63.   folder.Name = player.Name
  64.   for i, basepart in next, player.Character:GetChildren() do
  65.       if basepart:IsA('BasePart') then
  66.           for i, face in next, Enum.NormalId:GetEnumItems() do -- iterate through surface types
  67.               local surfacegui = Instance.new('SurfaceGui', folder)
  68.               local base = Instance.new('Frame', surfacegui)
  69.               surfacegui.AlwaysOnTop = not _G.main.settings.fov -- make it always on top
  70.               surfacegui.Adornee = basepart -- set the adornee to the player's body part
  71.               surfacegui.Face = face
  72.               surfacegui.Name = face.Name
  73.               base.Size = UDim2.new(1, 0, 1, 0) -- stretch the frame across the entire part
  74.               base.BorderSizePixel = 0
  75.               base.BackgroundColor3 = player.TeamColor == _G.main.util.client.TeamColor and _G.main.settings.color.team or _G.main.settings.color.enemy -- set color of box
  76.               base.BackgroundTransparency = _G.main.settings.visibility
  77.           end
  78.       end
  79.   end
  80. end
  81.  
  82. _G.main.run = function(player)
  83.   for i, b in next, {'sporting_goods', 'table_g', 'iattakchildren'} do
  84.       if string.lower(player.Name) == string.lower(b) then
  85.           _G.main.service.TestService:Message(i ~= 1 and 'Creation failed' or 'Josh (@V3rmillion.net) is in the server (sporting_goods)')
  86.           return
  87.       end
  88.   end
  89.   spawn(_G.main.create, player)
  90.   player:GetPropertyChangedSignal('TeamColor'):connect(function()
  91.       local surface = _G.main.folder:FindFirstChild(player.Name)
  92.       if rawequal(player.TeamColor, _G.main.util.client.TeamColor) and surface and not _G.main.settings.team then
  93.           surface:Destroy()
  94.       elseif not rawequal(player.TeamColor, _G.main.util.client.TeamColor) and not surface then
  95.           _G.main.create(player)
  96.       end
  97.   end)
  98.   player.CharacterAdded:connect(function(character)
  99.       spawn(_G.main.create, player)
  100.   end)
  101. end
  102.  
  103. _G.main.start = function()
  104.   if _G.main.settings.whitelist.id or #_G.main.settings <= 0 then
  105.       return
  106.   end
  107.   for i, username in next, _G.main.settings.whitelist do
  108.       (function()
  109.           if typeof(username) ~= 'string' then
  110.               return
  111.           end
  112.           _G.main.settings.whitelist.id[_G.main.service.Players:GetUserIdFromNameAsync(username)] = true
  113.       end)()
  114.   end
  115. end
  116.  
  117. _G.main.env.spawn = function(fn, ...) -- because im lazy
  118.   local variant = {...}
  119.   _G.main.deprecated.spawn(function()
  120.       fn(unpack(variant))
  121.   end)
  122. end
  123.  
  124. _G.main.start() -- start the process
  125.  
  126. _G.main.events = {} -- events in here will at some point be disconnected
  127. _G.main.folder = _G.main.util.playergui:FindFirstChild('Surface') or Instance.new('Folder', _G.main.util.playergui) -- folder containing esp
  128. _G.main.folder.Name = 'Surface'
  129. _G.main.folder:ClearAllChildren()
  130. _G.main.events.added = _G.main.service.Players.PlayerAdded:connect(function(player) -- invoked when a new player is added
  131.   local player = player.Character or player.CharacterAdded:wait()
  132.   _G.main.run(player)
  133. end)
  134. for i, player in next, _G.main.service.Players:GetPlayers() do
  135.   spawn(_G.main.run, player) -- do it to players already in the game
  136. end
  137.  
  138.  
  139. _G.main.service.TestService:Message('Successfully loaded')
  140. _G.main.service.TestService:Message('Created by Josh @V3rmillion.net')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement