Advertisement
CAT_SUS

ESP_.lua

Sep 6th, 2023 (edited)
46,826
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.29 KB | None | 0 0
  1. --[[ Tracer Esp Make By cat sus]]
  2. export type confix = {
  3.     Color : Color3,
  4. }
  5.  
  6. export type Custom_Confix = {
  7.     AutoDelete : boolean,
  8.     Color : Color3,
  9.     AutoUpdate : boolean
  10. }
  11.  
  12. local Camera = workspace.CurrentCamera
  13.  
  14. local function GetLineOrigin(Camera)
  15.     return Vector2.new(Camera.ViewportSize.X/2, Camera.ViewportSize.Y*.9)
  16. end
  17.  
  18. local LineOrigin = GetLineOrigin(Camera)
  19.  
  20. local Gui = Instance.new("ScreenGui")
  21.  
  22. Gui.ResetOnSpawn = false
  23.  
  24. Gui.Name = tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9))
  25.  
  26. Gui.Parent = game.Players.LocalPlayer.PlayerGui
  27.  
  28. Camera:GetPropertyChangedSignal("ViewportSize"):Connect(function()
  29.     LineOrigin = GetLineOrigin(Camera)
  30. end)
  31.  
  32. function Setline(Line, Width, Color, Origin, Destination)
  33.     LineOrigin = GetLineOrigin(Camera)
  34.     Origin = Origin or LineOrigin
  35.     local Position = (Origin + Destination) / 2
  36.     Line.Position = UDim2.new(0, Position.X, 0, Position.Y)
  37.     local Length = (Origin - Destination).Magnitude
  38.     Line.BackgroundColor3 = Color
  39.     Line.BorderColor3 = Color
  40.     Line.Size = UDim2.new(0, Length, 0, Width)
  41.     Line.Rotation = math.deg(math.atan2(Destination.Y - Origin.Y, Destination.X - Origin.X))
  42. end
  43.  
  44. local Tracer_Esp = {
  45.     LineWidth = 0.1,
  46.     AutoUpdate = true,
  47.     TranDex = 0,
  48.     Main = {},
  49.     LOOP_BINDS = {}
  50. }
  51.  
  52. local function IsInScreen(Position:Vector3)
  53.     local Duration = (Position - workspace.CurrentCamera.CFrame.Position).Unit * 1000000000000
  54.     local lOOK = workspace.CurrentCamera.CFrame.LookVector
  55.     local mem = workspace.CurrentCamera.FieldOfView / 120
  56.  
  57.     if Duration:Dot(lOOK) > mem then
  58.         return true
  59.     else
  60.         return false
  61.     end
  62. end
  63.  
  64. local function Find(line)
  65.     for i,v in ipairs(Tracer_Esp.LOOP_BINDS) do
  66.         if v[2]==line then
  67.             return i,v
  68.         end
  69.     end
  70. end
  71.  
  72. function Tracer_Esp:Tracer(Target:BasePart,CustomConfix:Custom_Confix)
  73.     -- Target Only Part - Object not Support value CFrame - Vector
  74.     if not Target or typeof(Target)=="Vector3" or typeof(Target)=="CFrame" then
  75.         return
  76.     end
  77.    
  78.     task.wait()
  79.    
  80.     CustomConfix = CustomConfix or {}
  81.     CustomConfix.Color = CustomConfix.Color or Color3.fromRGB(255,255,255)
  82.     CustomConfix.AutoDelete = CustomConfix.AutoDelete
  83.     CustomConfix.AutoUpdate = CustomConfix.AutoUpdate
  84.  
  85.     local NewLine = Instance.new("Frame")
  86.     NewLine.Name = tostring(Target)
  87.     NewLine.AnchorPoint = Vector2.new(.5, .5)
  88.     NewLine.Parent = Gui
  89.     NewLine.Transparency = Tracer_Esp.TranDex
  90.    
  91.     local bx = {}
  92.     local espui = nil
  93.    
  94.     if CustomConfix.AutoUpdate then
  95.         table.insert(Tracer_Esp.LOOP_BINDS,{Target,NewLine,CustomConfix.Color})
  96.     end
  97.  
  98.     local function del()
  99.         if not NewLine then
  100.             return
  101.         end
  102.        
  103.         NewLine.Visible = false
  104.         NewLine:Destroy()
  105.        
  106.         if espui ~= nil then
  107.             espui:Destroy()
  108.         end
  109.        
  110.         pcall(function()
  111.             if CustomConfix.AutoUpdate then
  112.                 local index = Find(NewLine)
  113.  
  114.                 if index then
  115.                     table.remove(Tracer_Esp.LOOP_BINDS,index)
  116.                 end
  117.             end
  118.         end)
  119.  
  120.         pcall(function()
  121.             for i,v in ipairs(bx) do
  122.                 if v then
  123.                     pcall(function()
  124.                         v:Disconnect()
  125.                     end)
  126.                 end
  127.             end
  128.         end)
  129.  
  130.         pcall(function()
  131.             if NewLine then
  132.                 NewLine:Destroy()
  133.             end
  134.         end)
  135.  
  136.         return
  137.     end
  138.  
  139.     table.insert(bx,Target.Changed:Connect(function()
  140.         if not CustomConfix.AutoDelete then
  141.             return
  142.         end
  143.         local checked = pcall(function()
  144.             if not Target or not Target.Parent or Target == "" or Target.Parent == "" or Target.Parent == nil or Target == nil then
  145.                 del()
  146.             end
  147.         end)
  148.  
  149.         if not checked then
  150.             del()
  151.         end
  152.     end))
  153.  
  154.     table.insert(bx,Target.AncestryChanged:Connect(function(lfr)
  155.         if not CustomConfix.AutoDelete then
  156.             return
  157.         end
  158.         if lfr then
  159.             if not lfr.Parent and Target:IsDescendantOf(lfr) then
  160.                 return del()
  161.             end
  162.         end
  163.         local checked = pcall(function()
  164.             if not Target or not Target.Parent or Target == "" or Target.Parent == "" or Target.Parent == nil or Target == nil then
  165.                 return del()
  166.             end
  167.         end)
  168.  
  169.         if not checked then
  170.             del()
  171.         end
  172.     end))
  173.  
  174.     local dex = {}
  175.  
  176.     function dex:Delete()
  177.         del()
  178.     end
  179.    
  180.     function dex:Edit(NewCustomConfix:Custom_Confix)
  181.         NewCustomConfix = NewCustomConfix or {}
  182.         NewCustomConfix.Color = NewCustomConfix.Color or Color3.fromRGB(255,255,255)
  183.         NewCustomConfix.AutoDelete = NewCustomConfix.AutoDelete
  184.         NewCustomConfix.AutoUpdate = NewCustomConfix.AutoUpdate
  185.        
  186.         CustomConfix.AutoUpdate = NewCustomConfix.AutoUpdate
  187.         CustomConfix.AutoDelete = CustomConfix.AutoDelete
  188.  
  189.         for i,v in ipairs(Tracer_Esp.LOOP_BINDS) do
  190.             if v[2]==NewLine then
  191.                 v[3] = CustomConfix.Color
  192.             end
  193.         end
  194.     end
  195.    
  196.     function dex:AddUIEsp(Name,Type,Color,On_Distance)
  197.         Color = Color or Color3.fromRGB(255, 255, 255)
  198.         local BillboardGui = Instance.new("BillboardGui")
  199.         local TextLabel = Instance.new("TextLabel")
  200.  
  201.         BillboardGui.Parent = game:FindFirstChild('CoreGui') or Gui
  202.         BillboardGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  203.         BillboardGui.Active = true
  204.         BillboardGui.Adornee = Target
  205.         BillboardGui.AlwaysOnTop = true
  206.         BillboardGui.LightInfluence = 1.000
  207.         BillboardGui.Size = UDim2.new(7, 0, 1.5, 0)
  208.         BillboardGui.StudsOffset = Vector3.new(0, 3.5, 0)
  209.  
  210.         TextLabel.Parent = BillboardGui
  211.         TextLabel.AnchorPoint = Vector2.new(0, 0.5)
  212.         TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  213.         TextLabel.BackgroundTransparency = 1.000
  214.         TextLabel.BorderColor3 = Color3.fromRGB(0, 0, 0)
  215.         TextLabel.BorderSizePixel = 0
  216.         TextLabel.Position = UDim2.new(0, 0, 0.5, 0)
  217.         TextLabel.Size = UDim2.new(1, 0, 0.899999976, 0)
  218.         TextLabel.Font = Enum.Font.SourceSansBold
  219.         TextLabel.TextColor3 = Color3.fromRGB(254, 254, 254)
  220.         TextLabel.TextScaled = true
  221.         TextLabel.TextSize = 14.000
  222.         TextLabel.TextWrapped = true
  223.        
  224.         espui = BillboardGui
  225.        
  226.         if On_Distance then
  227.             coroutine.wrap(function()
  228.                 while true do task.wait(0.1)
  229.                     pcall(function()
  230.                         local disance = (workspace.CurrentCamera.CFrame.Position - Target.Position).Magnitude
  231.  
  232.  
  233.                         if Type then
  234.                             TextLabel.Text = tostring(Name)..tostring(" | ")..tostring(Type)..tostring(" | ")..tostring(math.ceil(disance))..tostring("M")
  235.  
  236.                         else
  237.  
  238.                             TextLabel.Text = tostring(Name)..tostring(" | ")..tostring(math.ceil(disance))..tostring("M")
  239.  
  240.                         end
  241.                     end)
  242.                 end
  243.             end)()
  244.            
  245.         else
  246.             if Type then
  247.                 TextLabel.Text = tostring(Name)..tostring(" | ")..tostring(Type)
  248.  
  249.             else
  250.  
  251.                 TextLabel.Text = tostring(Name)
  252.  
  253.             end
  254.         end
  255.     end
  256.    
  257.     return dex
  258. end
  259.  
  260.  
  261.  
  262. function Tracer_Esp:CreateTracer(name,target,confix:confix)
  263.     if Tracer_Esp.Main[name] then
  264.         warn("already haved data")
  265.         return
  266.     end
  267.  
  268.     confix = confix or {}
  269.     confix.Color = confix.Color or Color3.fromRGB(255,255,255)
  270.  
  271.     local target_Fixed = (typeof(target)=="CFrame" and target.Position) or ((typeof(target)=="Instance" and target.ClassName=="Model")and target:GetPivot().Position) or ((typeof(target)=="Instance" and target:isA"BasePart")and target.Position) or ((typeof(target)=="Instance" and target:isA"UnionOperation")and target.Position) or target
  272.  
  273.     local NewLine = Instance.new("Frame")
  274.     NewLine.Name = name
  275.     NewLine.AnchorPoint = Vector2.new(.5, .5)
  276.     NewLine.Parent = Gui
  277.     NewLine.Transparency = Tracer_Esp.TranDex
  278.  
  279.     Tracer_Esp.Main[name] = {}
  280.  
  281.     Tracer_Esp.Main[name]['Confix'] = confix
  282.  
  283.     Tracer_Esp.Main[name]['Frame'] = NewLine
  284.  
  285.     Tracer_Esp.Main[name]['Update'] = function()
  286.         target_Fixed = (typeof(target)=="CFrame" and target.Position) or ((typeof(target)=="Instance" and target.ClassName=="Model")and target:GetPivot().Position) or ((typeof(target)=="Instance" and target:isA"BasePart")and target.Position) or ((typeof(target)=="Instance" and target:isA"UnionOperation")and target.Position) or target
  287.  
  288.         local ScreenPoint = Camera:WorldToScreenPoint(target_Fixed)
  289.         local arge = {Vector2.new(ScreenPoint.X, ScreenPoint.Y),Tracer_Esp.Main[name]['Confix'].Color}
  290.         if IsInScreen(target_Fixed) then
  291.             NewLine.Visible = true
  292.             Setline(NewLine, Tracer_Esp.LineWidth, arge[2], LineOrigin, arge[1])
  293.         else
  294.             NewLine.Visible = false
  295.         end
  296.     end
  297.  
  298.     return Tracer_Esp.Main[name]
  299. end
  300.  
  301. function Tracer_Esp:ConfixTracer(name,Confix:confix)
  302.     Confix = Confix or {}
  303.     Confix.Color = Confix.Color or Color3.fromRGB(255,255,255)
  304.     if Tracer_Esp.Main[name] then
  305.         Tracer_Esp.Main[name].Confix = Confix
  306.     end
  307. end
  308.  
  309. function Tracer_Esp:Delete(name)
  310.     if Tracer_Esp.Main[name] then
  311.         local frame = Tracer_Esp.Main[name]['Frame']
  312.         Tracer_Esp.Main[name] = nil
  313.  
  314.         if frame then
  315.             frame:Destroy()
  316.             return true
  317.         end
  318.     end
  319. end
  320.  
  321. _G.TRACE_LOOP = true
  322.  
  323. coroutine.wrap(function()
  324.     while _G.TRACE_LOOP do task.wait()
  325.         pcall(function()
  326.             if Tracer_Esp.AutoUpdate then
  327.                 for index,val in next,Tracer_Esp.Main do
  328.                     pcall(function()
  329.                         if Tracer_Esp.Main[index] then
  330.                             Tracer_Esp.Main[index].Update()
  331.                         end
  332.                     end)
  333.                 end
  334.             end        
  335.             LineOrigin = GetLineOrigin(Camera)
  336.         end)
  337.     end
  338. end)()
  339.  
  340. game:GetService('RunService'):BindToRenderStep('LOOPED_ESP_TRRACE',3,function()
  341.     for i,v in ipairs(Tracer_Esp.LOOP_BINDS) do
  342.         local ScreenPoint = Camera:WorldToScreenPoint(v[1].Position)
  343.         local arge = {Vector2.new(ScreenPoint.X, ScreenPoint.Y),v[3]}
  344.         if IsInScreen(v[1].Position) then
  345.             Setline(v[2], Tracer_Esp.LineWidth, arge[2], LineOrigin, arge[1])
  346.             v[2].Visible = true
  347.         else
  348.             v[2].Visible = false
  349.         end
  350.     end
  351. end)
  352.  
  353. return Tracer_Esp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement