Advertisement
trixade

Untitled

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