local camera = workspace.CurrentCamera local boxes = {} local boxesoutline = {} local healthbars = {} local healthbaroutlines = {} local nametags = {} local healthvalues = {} while task.wait() do for _, box in pairs(boxes) do box.Visible = false end for _, boxoutline in pairs(boxesoutline) do boxoutline.Visible = false end for _, healthbar in pairs(healthbars) do healthbar.Visible = false end for _, healthbaroutline in pairs(healthbaroutlines) do healthbaroutline.Visible = false end for _, nametag in pairs(nametags) do nametag.Visible = false end for _, healthvalue in pairs(healthvalues) do healthvalue.Visible = false end for _, value in ipairs(workspace:GetChildren()) do local HumanoidRootPart = value:FindFirstChild("HumanoidRootPart") local Humanoid = value:FindFirstChild("Humanoid") if HumanoidRootPart and Humanoid then local feet = Vector3.new(HumanoidRootPart.Position.X, HumanoidRootPart.Position.Y - 4, HumanoidRootPart.Position.Z) local head = Vector3.new(HumanoidRootPart.Position.X, HumanoidRootPart.Position.Y + 2, HumanoidRootPart.Position.Z) local vector, onscreen = camera:WorldToViewportPoint(HumanoidRootPart.Position) local vectorfeet, onscreenfeet = camera:WorldToViewportPoint(feet) local vectorhead, onscreenhead = camera:WorldToViewportPoint(head) local distance = (camera.CFrame.Position - HumanoidRootPart.Position).Magnitude local height = vectorhead.Y - vectorfeet.Y if onscreen and onscreenhead and onscreenfeet and Humanoid.Health > 0 and HumanoidRootPart and Humanoid then if not boxesoutline[value] then boxesoutline[value] = Drawing.new("Square") boxesoutline[value].Visible = false boxesoutline[value].Thickness = 3 boxesoutline[value].Color = Color3.fromRGB(10, 10, 10) boxesoutline[value].Transparency = 1 end if not boxes[value] then boxes[value] = Drawing.new("Square") boxes[value].Visible = false boxes[value].Thickness = 1 boxes[value].Color = Color3.fromRGB(248, 247, 247) boxes[value].Transparency = 1 end local boxsize = height / 2 local boxoutline = boxesoutline[value] boxoutline.Size = Vector2.new(boxsize, height) boxoutline.Position = Vector2.new(vector.X - boxsize / 2, vector.Y - (height / 2)) boxoutline.Visible = true local box = boxes[value] box.Size = Vector2.new(boxsize, height) box.Position = Vector2.new(vector.X - boxsize / 2, vector.Y - (height / 2)) box.Visible = true if not healthbaroutlines[value] then healthbaroutlines[value] = Drawing.new("Line") healthbaroutlines[value].Visible = false healthbaroutlines[value].Thickness = 3 healthbaroutlines[value].Color = Color3.fromRGB(10, 10, 10) healthbaroutlines[value].Transparency = 1 end if not healthbars[value] then healthbars[value] = Drawing.new("Line") healthbars[value].Visible = false healthbars[value].Thickness = 1 healthbars[value].Color = Color3.fromRGB(8, 240, 85) healthbars[value].Transparency = 1 end local barx = box.Position.X + (height / 2) - 5 local procent = Humanoid.Health / Humanoid.MaxHealth local barheight = height * procent local baroutline = healthbaroutlines[value] baroutline.From = Vector2.new(barx, box.Position.Y + height) baroutline.To = Vector2.new(barx, box.Position.Y) baroutline.Visible = true local bar = healthbars[value] bar.From = Vector2.new(barx, box.Position.Y) bar.To = Vector2.new(barx, box.Position.Y + barheight) bar.Visible = true if not nametags[value] then nametags[value] = Drawing.new("Text") nametags[value].Visible = false nametags[value].Outline = true nametags[value].Center = true nametags[value].Color = Color3.fromRGB(202, 207, 204) nametags[value].Transparency = 1 end local text = nametags[value] text.Text = value.Name.." ["..tostring(math.round(distance)).."st]" text.Size = math.clamp(boxsize / 2, 10, 18) text.Position = Vector2.new(box.Position.X + (boxsize / 2), box.Position.Y + height - 12) text.Visible = true text.Font = 3 if not healthvalues[value] then healthvalues[value] = Drawing.new("Text") healthvalues[value].Visible = false healthvalues[value].Outline = true healthvalues[value].Center = true healthvalues[value].Color = Color3.fromRGB(30, 233, 98) healthvalues[value].Transparency = 1 end local healthings = healthvalues[value] healthings.Text = tostring(math.round(Humanoid.Health)) healthings.Size = math.clamp(boxsize / 2, 9, 14) healthings.Position = Vector2.new(barx, box.Position.Y + barheight - 5) healthings.Visible = true healthings.Font = 3 end end end end