Advertisement
trixade

Untitled

Apr 19th, 2022
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.18 KB | None | 0 0
  1. --// Made by Blissful#4992
  2. --// Locals:
  3. local workspace = game:GetService("Workspace")
  4. local player = game:GetService("Players").LocalPlayer
  5. local camera = workspace.CurrentCamera
  6.  
  7. --// Settings:
  8. local on = true -- Use this if your making gui
  9.  
  10. local Box_Color = Color3.fromRGB(255, 0, 0)
  11. local Box_Thickness = 2
  12. local Box_Transparency = 1 -- 1 Visible, 0 Not Visible
  13.  
  14. local Tracers = true
  15. local Tracer_Color = Color3.fromRGB(255, 0, 0)
  16. local Tracer_Thickness = 2
  17. local Tracer_Transparency = 1 -- 1 Visible, 0 Not Visible
  18.  
  19. local Autothickness = true -- Makes screen less encumbered
  20.  
  21. local Team_Check = true
  22. local red = Color3.fromRGB(227, 52, 52)
  23. local green = Color3.fromRGB(88, 217, 24)
  24.  
  25. local function NewLine()
  26.     local line = Drawing.new("Line")
  27.     line.Visible = false
  28.     line.From = Vector2.new(0, 0)
  29.     line.To = Vector2.new(1, 1)
  30.     line.Color = Box_Color
  31.     line.Thickness = Box_Thickness
  32.     line.Transparency = Box_Transparency
  33.     return line
  34. end
  35.  
  36. --// Main Function:
  37. for i, v in pairs(game.Players:GetChildren()) do
  38.     --// Lines for 3D box (12)
  39.     local lines = {
  40.         line1 = NewLine(),
  41.         line2 = NewLine(),
  42.         line3 = NewLine(),
  43.         line4 = NewLine(),
  44.         line5 = NewLine(),
  45.         line6 = NewLine(),
  46.         line7 = NewLine(),
  47.         line8 = NewLine(),
  48.         line9 = NewLine(),
  49.         line10 = NewLine(),
  50.         line11 = NewLine(),
  51.         line12 = NewLine(),
  52.         Tracer = NewLine()
  53.     }
  54.  
  55.     lines.Tracer.Color = Tracer_Color
  56.     lines.Tracer.Thickness = Tracer_Thickness
  57.     lines.Tracer.Transparency = Tracer_Transparency
  58.  
  59.     --// Updates ESP (lines) in render loop
  60.     local function ESP()
  61.         local connection
  62.         connection = game:GetService("RunService").RenderStepped:Connect(function()
  63.             if on and v.Character ~= nil and v.Character:FindFirstChild("Humanoid") ~= nil and v.Character:FindFirstChild("HumanoidRootPart") ~= nil and v.Name ~= player.Name and v.Character.Humanoid.Health > 0 and v.Character:FindFirstChild("Head") ~= nil then
  64.                 local pos, vis = camera:WorldToViewportPoint(v.Character.HumanoidRootPart.Position)
  65.                 if vis then
  66.                     local Scale = v.Character.Head.Size.Y/2
  67.                     local Size = Vector3.new(2, 3, 1.5) * (Scale * 2) -- Change this for different box size
  68.  
  69.                     local Top1 = camera:WorldToViewportPoint((v.Character.HumanoidRootPart.CFrame * CFrame.new(-Size.X, Size.Y, -Size.Z)).p)
  70.                     local Top2 = camera:WorldToViewportPoint((v.Character.HumanoidRootPart.CFrame * CFrame.new(-Size.X, Size.Y, Size.Z)).p)
  71.                     local Top3 = camera:WorldToViewportPoint((v.Character.HumanoidRootPart.CFrame * CFrame.new(Size.X, Size.Y, Size.Z)).p)
  72.                     local Top4 = camera:WorldToViewportPoint((v.Character.HumanoidRootPart.CFrame * CFrame.new(Size.X, Size.Y, -Size.Z)).p)
  73.  
  74.                     local Bottom1 = camera:WorldToViewportPoint((v.Character.HumanoidRootPart.CFrame * CFrame.new(-Size.X, -Size.Y, -Size.Z)).p)
  75.                     local Bottom2 = camera:WorldToViewportPoint((v.Character.HumanoidRootPart.CFrame * CFrame.new(-Size.X, -Size.Y, Size.Z)).p)
  76.                     local Bottom3 = camera:WorldToViewportPoint((v.Character.HumanoidRootPart.CFrame * CFrame.new(Size.X, -Size.Y, Size.Z)).p)
  77.                     local Bottom4 = camera:WorldToViewportPoint((v.Character.HumanoidRootPart.CFrame * CFrame.new(Size.X, -Size.Y, -Size.Z)).p)
  78.  
  79.                     --// Top:
  80.                     lines.line1.From = Vector2.new(Top1.X, Top1.Y)
  81.                     lines.line1.To = Vector2.new(Top2.X, Top2.Y)
  82.  
  83.                     lines.line2.From = Vector2.new(Top2.X, Top2.Y)
  84.                     lines.line2.To = Vector2.new(Top3.X, Top3.Y)
  85.  
  86.                     lines.line3.From = Vector2.new(Top3.X, Top3.Y)
  87.                     lines.line3.To = Vector2.new(Top4.X, Top4.Y)
  88.  
  89.                     lines.line4.From = Vector2.new(Top4.X, Top4.Y)
  90.                     lines.line4.To = Vector2.new(Top1.X, Top1.Y)
  91.  
  92.                     --// Bottom:
  93.                     lines.line5.From = Vector2.new(Bottom1.X, Bottom1.Y)
  94.                     lines.line5.To = Vector2.new(Bottom2.X, Bottom2.Y)
  95.  
  96.                     lines.line6.From = Vector2.new(Bottom2.X, Bottom2.Y)
  97.                     lines.line6.To = Vector2.new(Bottom3.X, Bottom3.Y)
  98.  
  99.                     lines.line7.From = Vector2.new(Bottom3.X, Bottom3.Y)
  100.                     lines.line7.To = Vector2.new(Bottom4.X, Bottom4.Y)
  101.  
  102.                     lines.line8.From = Vector2.new(Bottom4.X, Bottom4.Y)
  103.                     lines.line8.To = Vector2.new(Bottom1.X, Bottom1.Y)
  104.  
  105.                     --//S ides:
  106.                     lines.line9.From = Vector2.new(Bottom1.X, Bottom1.Y)
  107.                     lines.line9.To = Vector2.new(Top1.X, Top1.Y)
  108.  
  109.                     lines.line10.From = Vector2.new(Bottom2.X, Bottom2.Y)
  110.                     lines.line10.To = Vector2.new(Top2.X, Top2.Y)
  111.  
  112.                     lines.line11.From = Vector2.new(Bottom3.X, Bottom3.Y)
  113.                     lines.line11.To = Vector2.new(Top3.X, Top3.Y)
  114.  
  115.                     lines.line12.From = Vector2.new(Bottom4.X, Bottom4.Y)
  116.                     lines.line12.To = Vector2.new(Top4.X, Top4.Y)
  117.  
  118.                     --// Tracer:
  119.                     if Tracers then
  120.                         local trace = camera:WorldToViewportPoint((v.Character.HumanoidRootPart.CFrame * CFrame.new(0, -Size.Y, 0)).p)
  121.  
  122.                         lines.Tracer.From = Vector2.new(camera.ViewportSize.X/2, camera.ViewportSize.Y)
  123.                         lines.Tracer.To = Vector2.new(trace.X, trace.Y)
  124.                     end
  125.  
  126.                     --// Teamcheck:
  127.                     if Team_Check then
  128.                         if v.TeamColor == player.TeamColor then
  129.                             for u, x in pairs(lines) do
  130.                                 x.Color = green
  131.                             end
  132.                         else
  133.                             for u, x in pairs(lines) do
  134.                                 x.Color = red
  135.                             end
  136.                         end
  137.                     end
  138.  
  139.                     --// Autothickness:
  140.                     if Autothickness then
  141.                         local distance = (player.Character.HumanoidRootPart.Position - v.Character.HumanoidRootPart.Position).magnitude
  142.                         local value = math.clamp(1/distance*100, 0.1, 4) --0.1 is min thickness, 6 is max
  143.                         for u, x in pairs(lines) do
  144.                             x.Thickness = value
  145.                         end
  146.                     else
  147.                         for u, x in pairs(lines) do
  148.                             x.Thickness = Box_Thickness
  149.                         end
  150.                     end
  151.  
  152.                     for u, x in pairs(lines) do
  153.                         if x ~= lines.Tracer then
  154.                             x.Visible = true
  155.                         end
  156.                     end
  157.                     if Tracers then
  158.                         lines.Tracer.Visible = true
  159.                     end
  160.                 else
  161.                     for u, x in pairs(lines) do
  162.                         x.Visible = false
  163.                     end
  164.                 end
  165.             else
  166.                 for u, x in pairs(lines) do
  167.                     x.Visible = false
  168.                 end
  169.                 if game.Players:FindFirstChild(v.Name) == nil then
  170.                     connection:Disconnect()
  171.                 end
  172.             end
  173.         end)
  174.     end
  175.     coroutine.wrap(ESP)()
  176. end
  177.  
  178. game.Players.PlayerAdded:Connect(function(newplr)
  179.     --// Lines for 3D box (12)
  180.     local lines = {
  181.         line1 = NewLine(),
  182.         line2 = NewLine(),
  183.         line3 = NewLine(),
  184.         line4 = NewLine(),
  185.         line5 = NewLine(),
  186.         line6 = NewLine(),
  187.         line7 = NewLine(),
  188.         line8 = NewLine(),
  189.         line9 = NewLine(),
  190.         line10 = NewLine(),
  191.         line11 = NewLine(),
  192.         line12 = NewLine(),
  193.         Tracer = NewLine()
  194.     }
  195.  
  196.     lines.Tracer.Color = Tracer_Color
  197.     lines.Tracer.Thickness = Tracer_Thickness
  198.     lines.Tracer.Transparency = Tracer_Transparency
  199.  
  200.     --// Updates ESP (lines) in render loop
  201.     local function ESP()
  202.         local connection
  203.         connection = game:GetService("RunService").RenderStepped:Connect(function()
  204.             if on and newplr.Character ~= nil and newplr.Character:FindFirstChild("Humanoid") ~= nil and newplr.Character:FindFirstChild("HumanoidRootPart") ~= nil and newplr.Name ~= player.Name and newplr.Character.Humanoid.Health > 0 and newplr.Character:FindFirstChild("Head") ~= nil then
  205.                 local pos, vis = camera:WorldToViewportPoint(newplr.Character.HumanoidRootPart.Position)
  206.                 if vis then
  207.                     local Scale = newplr.Character.Head.Size.Y/2
  208.                     local Size = Vector3.new(2, 3, 1.5) * (Scale * 2) -- Change this for different box size
  209.  
  210.                     local Top1 = camera:WorldToViewportPoint((newplr.Character.HumanoidRootPart.CFrame * CFrame.new(-Size.X, Size.Y, -Size.Z)).p)
  211.                     local Top2 = camera:WorldToViewportPoint((newplr.Character.HumanoidRootPart.CFrame * CFrame.new(-Size.X, Size.Y, Size.Z)).p)
  212.                     local Top3 = camera:WorldToViewportPoint((newplr.Character.HumanoidRootPart.CFrame * CFrame.new(Size.X, Size.Y, Size.Z)).p)
  213.                     local Top4 = camera:WorldToViewportPoint((newplr.Character.HumanoidRootPart.CFrame * CFrame.new(Size.X, Size.Y, -Size.Z)).p)
  214.  
  215.                     local Bottom1 = camera:WorldToViewportPoint((newplr.Character.HumanoidRootPart.CFrame * CFrame.new(-Size.X, -Size.Y, -Size.Z)).p)
  216.                     local Bottom2 = camera:WorldToViewportPoint((newplr.Character.HumanoidRootPart.CFrame * CFrame.new(-Size.X, -Size.Y, Size.Z)).p)
  217.                     local Bottom3 = camera:WorldToViewportPoint((newplr.Character.HumanoidRootPart.CFrame * CFrame.new(Size.X, -Size.Y, Size.Z)).p)
  218.                     local Bottom4 = camera:WorldToViewportPoint((newplr.Character.HumanoidRootPart.CFrame * CFrame.new(Size.X, -Size.Y, -Size.Z)).p)
  219.  
  220.                     --// Top:
  221.                     lines.line1.From = Vector2.new(Top1.X, Top1.Y)
  222.                     lines.line1.To = Vector2.new(Top2.X, Top2.Y)
  223.  
  224.                     lines.line2.From = Vector2.new(Top2.X, Top2.Y)
  225.                     lines.line2.To = Vector2.new(Top3.X, Top3.Y)
  226.  
  227.                     lines.line3.From = Vector2.new(Top3.X, Top3.Y)
  228.                     lines.line3.To = Vector2.new(Top4.X, Top4.Y)
  229.  
  230.                     lines.line4.From = Vector2.new(Top4.X, Top4.Y)
  231.                     lines.line4.To = Vector2.new(Top1.X, Top1.Y)
  232.  
  233.                     --// Bottom:
  234.                     lines.line5.From = Vector2.new(Bottom1.X, Bottom1.Y)
  235.                     lines.line5.To = Vector2.new(Bottom2.X, Bottom2.Y)
  236.  
  237.                     lines.line6.From = Vector2.new(Bottom2.X, Bottom2.Y)
  238.                     lines.line6.To = Vector2.new(Bottom3.X, Bottom3.Y)
  239.  
  240.                     lines.line7.From = Vector2.new(Bottom3.X, Bottom3.Y)
  241.                     lines.line7.To = Vector2.new(Bottom4.X, Bottom4.Y)
  242.  
  243.                     lines.line8.From = Vector2.new(Bottom4.X, Bottom4.Y)
  244.                     lines.line8.To = Vector2.new(Bottom1.X, Bottom1.Y)
  245.  
  246.                     --//S ides:
  247.                     lines.line9.From = Vector2.new(Bottom1.X, Bottom1.Y)
  248.                     lines.line9.To = Vector2.new(Top1.X, Top1.Y)
  249.  
  250.                     lines.line10.From = Vector2.new(Bottom2.X, Bottom2.Y)
  251.                     lines.line10.To = Vector2.new(Top2.X, Top2.Y)
  252.  
  253.                     lines.line11.From = Vector2.new(Bottom3.X, Bottom3.Y)
  254.                     lines.line11.To = Vector2.new(Top3.X, Top3.Y)
  255.  
  256.                     lines.line12.From = Vector2.new(Bottom4.X, Bottom4.Y)
  257.                     lines.line12.To = Vector2.new(Top4.X, Top4.Y)
  258.  
  259.                     --// Tracer:
  260.                     if Tracers then
  261.                         local trace = camera:WorldToViewportPoint((newplr.Character.HumanoidRootPart.CFrame * CFrame.new(0, -Size.Y, 0)).p)
  262.                         lines.Tracer.From = Vector2.new(camera.ViewportSize.X/2, camera.ViewportSize.Y)
  263.                         lines.Tracer.To = Vector2.new(trace.X, trace.Y)
  264.                     end
  265.  
  266.                     --// Teamcheck:
  267.                     if Team_Check then
  268.                         if newplr.TeamColor == player.TeamColor then
  269.                             for u, x in pairs(lines) do
  270.                                 x.Color = green
  271.                             end
  272.                         else
  273.                             for u, x in pairs(lines) do
  274.                                 x.Color = red
  275.                             end
  276.                         end
  277.                     end
  278.  
  279.                     --// Autothickness:
  280.                     if Autothickness then
  281.                         local distance = (player.Character.HumanoidRootPart.Position - newplr.Character.HumanoidRootPart.Position).magnitude
  282.                         local value = math.clamp(1/distance*100, 0.1, 4) --0.1 is min thickness, 6 is max
  283.                         for u, x in pairs(lines) do
  284.                             x.Thickness = value
  285.                         end
  286.                     else
  287.                         for u, x in pairs(lines) do
  288.                             x.Thickness = Box_Thickness
  289.                         end
  290.                     end
  291.  
  292.                     for u, x in pairs(lines) do
  293.                         if x ~= lines.Tracer then
  294.                             x.Visible = true
  295.                         end
  296.                     end
  297.                     if Tracers then
  298.                         lines.Tracer.Visible = true
  299.                     end
  300.                 else
  301.                     for u, x in pairs(lines) do
  302.                         x.Visible = false
  303.                     end
  304.                 end
  305.             else
  306.                 for u, x in pairs(lines) do
  307.                     x.Visible = false
  308.                 end
  309.                 if game.Players:FindFirstChild(newplr.Name) == nil then
  310.                     connection:Disconnect()
  311.                 end
  312.             end
  313.         end)
  314.     end
  315.     coroutine.wrap(ESP)()
  316. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement