yaminameis59

box esp

Apr 27th, 2023
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.08 KB | Gaming | 0 0
  1.  
  2.  
  3. local lplr = game.Players.LocalPlayer
  4. local camera = game:GetService("Workspace").CurrentCamera
  5. local CurrentCamera = workspace.CurrentCamera
  6. local worldToViewportPoint = CurrentCamera.worldToViewportPoint
  7.  
  8. local HeadOff = Vector3.new(0, 0.5, 0)
  9. local LegOff = Vector3.new(0,3,0)
  10.  
  11. for i,v in pairs(game.Players:GetChildren()) do
  12.     local BoxOutline = Drawing.new("Square")
  13.     BoxOutline.Visible = false
  14.     BoxOutline.Color = Color3.new(0,0,0)
  15.     BoxOutline.Thickness = 3
  16.     BoxOutline.Transparency = 1
  17.     BoxOutline.Filled = false
  18.  
  19.     local Box = Drawing.new("Square")
  20.     Box.Visible = false
  21.     Box.Color = Color3.new(1,1,1)
  22.     Box.Thickness = 1
  23.     Box.Transparency = 1
  24.     Box.Filled = false
  25.  
  26.     function boxesp()
  27.         game:GetService("RunService").RenderStepped:Connect(function()
  28.             if v.Character ~= nil and v.Character:FindFirstChild("Humanoid") ~= nil and v.Character:FindFirstChild("HumanoidRootPart") ~= nil and v ~= lplr and v.Character.Humanoid.Health > 0 then
  29.                 local Vector, onScreen = camera:worldToViewportPoint(v.Character.HumanoidRootPart.Position)
  30.  
  31.                 local RootPart = v.Character.HumanoidRootPart
  32.                 local Head = v.Character.Head
  33.                 local RootPosition, RootVis = worldToViewportPoint(CurrentCamera, RootPart.Position)
  34.                 local HeadPosition = worldToViewportPoint(CurrentCamera, Head.Position + HeadOff)
  35.                 local LegPosition = worldToViewportPoint(CurrentCamera, RootPart.Position - LegOff)
  36.  
  37.                 if onScreen then
  38.                     BoxOutline.Size = Vector2.new(1000 / RootPosition.Z, HeadPosition.Y - LegPosition.Y)
  39.                     BoxOutline.Position = Vector2.new(RootPosition.X - BoxOutline.Size.X / 2, RootPosition.Y - BoxOutline.Size.Y / 2)
  40.                     BoxOutline.Visible = true
  41.  
  42.                     Box.Size = Vector2.new(1000 / RootPosition.Z, HeadPosition.Y - LegPosition.Y)
  43.                     Box.Position = Vector2.new(RootPosition.X - Box.Size.X / 2, RootPosition.Y - Box.Size.Y / 2)
  44.                     Box.Visible = true
  45.  
  46.                     if v.TeamColor == lplr.TeamColor then
  47.                         BoxOutline.Visible = false
  48.                         Box.Visible = false
  49.                     else
  50.                         BoxOutline.Visible = true
  51.                         Box.Visible = true
  52.                     end
  53.  
  54.                 else
  55.                     BoxOutline.Visible = false
  56.                     Box.Visible = false
  57.                 end
  58.             else
  59.                 BoxOutline.Visible = false
  60.                 Box.Visible = false
  61.             end
  62.         end)
  63.     end
  64.     coroutine.wrap(boxesp)()
  65. end
  66.  
  67. game.Players.PlayerAdded:Connect(function(v)
  68.     local BoxOutline = Drawing.new("Square")
  69.     BoxOutline.Visible = false
  70.     BoxOutline.Color = Color3.new(0,0,0)
  71.     BoxOutline.Thickness = 3
  72.     BoxOutline.Transparency = 1
  73.     BoxOutline.Filled = false
  74.  
  75.     local Box = Drawing.new("Square")
  76.     Box.Visible = false
  77.     Box.Color = Color3.new(1,1,1)
  78.     Box.Thickness = 1
  79.     Box.Transparency = 1
  80.     Box.Filled = false
  81.  
  82.     function boxesp()
  83.         game:GetService("RunService").RenderStepped:Connect(function()
  84.             if v.Character ~= nil and v.Character:FindFirstChild("Humanoid") ~= nil and v.Character:FindFirstChild("HumanoidRootPart") ~= nil and v ~= lplr and v.Character.Humanoid.Health > 0 then
  85.                 local Vector, onScreen = camera:worldToViewportPoint(v.Character.HumanoidRootPart.Position)
  86.  
  87.                 local RootPart = v.Character.HumanoidRootPart
  88.                 local Head = v.Character.Head
  89.                 local RootPosition, RootVis = worldToViewportPoint(CurrentCamera, RootPart.Position)
  90.                 local HeadPosition = worldToViewportPoint(CurrentCamera, Head.Position + HeadOff)
  91.                 local LegPosition = worldToViewportPoint(CurrentCamera, RootPart.Position - LegOff)
  92.  
  93.                 if onScreen then
  94.                     BoxOutline.Size = Vector2.new(1000 / RootPosition.Z, HeadPosition.Y - LegPosition.Y)
  95.                     BoxOutline.Position = Vector2.new(RootPosition.X - BoxOutline.Size.X / 2, RootPosition.Y - BoxOutline.Size.Y / 2)
  96.                     BoxOutline.Visible = true
  97.  
  98.                     Box.Size = Vector2.new(1000 / RootPosition.Z, HeadPosition.Y - LegPosition.Y)
  99.                     Box.Position = Vector2.new(RootPosition.X - Box.Size.X / 2, RootPosition.Y - Box.Size.Y / 2)
  100.                     Box.Visible = true
  101.  
  102.                     if v.TeamColor == lplr.TeamColor then
  103.                         BoxOutline.Visible = false
  104.                         Box.Visible = false
  105.                     else
  106.                         BoxOutline.Visible = true
  107.                         Box.Visible = true
  108.                     end
  109.  
  110.                 else
  111.                     BoxOutline.Visible = false
  112.                     Box.Visible = false
  113.                 end
  114.             else
  115.                 BoxOutline.Visible = false
  116.                 Box.Visible = false
  117.             end
  118.         end)
  119.     end
  120.     coroutine.wrap(boxesp)()
  121. end)
  122.  
  123. ---Created By 0x83
Add Comment
Please, Sign In to add comment