Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local LocalPlayer = Players.LocalPlayer
- local Camera = workspace.CurrentCamera
- local ESP = {}
- local Tracers = {}
- local NameTags = {}
- RunService.RenderStepped:Connect(function()
- for _, player in pairs(Players:GetPlayers()) do
- if player ~= LocalPlayer then
- local character = player.Character
- local hrp = character and character:FindFirstChild("HumanoidRootPart")
- local humanoid = character and character:FindFirstChild("Humanoid")
- local head = character and character:FindFirstChild("Head")
- if hrp and humanoid and humanoid.Health > 0 then
- local pos, onScreen = Camera:WorldToViewportPoint(hrp.Position)
- if onScreen then
- -- Create ESP box if it doesn't exist
- if not ESP[player] then
- local box = Drawing.new("Square")
- box.Thickness = 2
- box.Color = Color3.new(1, 0, 0)
- box.Transparency = 1
- box.Filled = false
- ESP[player] = box
- end
- -- Create Tracer if it doesn't exist
- if not Tracers[player] then
- local line = Drawing.new("Line")
- line.Thickness = 1
- line.Color = Color3.new(1, 0, 0)
- line.Transparency = 1
- Tracers[player] = line
- end
- -- Create NameTag with black box if it doesn't exist
- if not NameTags[player] then
- local nameBox = Drawing.new("Square")
- nameBox.Thickness = 2
- nameBox.Color = Color3.new(0, 0, 0) -- Black background for the name
- nameBox.Filled = true
- NameTags[player] = {Box = nameBox, Text = Drawing.new("Text")}
- NameTags[player].Text.Size = 16
- NameTags[player].Text.Color = Color3.new(1, 1, 1) -- White text color
- NameTags[player].Text.Transparency = 1
- NameTags[player].Text.Center = true
- NameTags[player].Text.Outline = true
- NameTags[player].Text.OutlineColor = Color3.new(0, 0, 0) -- Black outline for readability
- end
- -- Set size and position for ESP box
- local scaleFactor = 3
- local sizeY = 5 * scaleFactor
- local sizeX = 2 * scaleFactor
- ESP[player].Size = Vector2.new(sizeX, sizeY)
- ESP[player].Position = Vector2.new(pos.X - sizeX / 2, pos.Y - sizeY / 2)
- ESP[player].Visible = true
- -- Set Tracer line
- Tracers[player].From = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2)
- Tracers[player].To = Vector2.new(pos.X, pos.Y)
- Tracers[player].Visible = true
- -- Set NameTag with black box directly behind the name
- if head then
- local namePos, nameOnScreen = Camera:WorldToViewportPoint(head.Position + Vector3.new(0, 2, 0)) -- Adjusted for name above head
- if nameOnScreen then
- local textWidth = NameTags[player].Text.TextBounds.X
- local textHeight = NameTags[player].Text.TextBounds.Y
- -- Position the name box behind the text (ensure it's below the name text)
- NameTags[player].Box.Size = Vector2.new(textWidth + 10, textHeight + 5)
- NameTags[player].Box.Position = Vector2.new(namePos.X - (textWidth / 2) - 5, namePos.Y - (textHeight / 2) + 5) -- Box placed below the text
- -- Position the name text correctly in front of the box
- NameTags[player].Text.Text = player.Name
- NameTags[player].Text.Position = Vector2.new(namePos.X, namePos.Y)
- NameTags[player].Box.Visible = true
- NameTags[player].Text.Visible = true
- else
- NameTags[player].Box.Visible = false
- NameTags[player].Text.Visible = false
- end
- end
- else
- if ESP[player] then ESP[player].Visible = false end
- if Tracers[player] then Tracers[player].Visible = false end
- if NameTags[player] then
- NameTags[player].Box.Visible = false
- NameTags[player].Text.Visible = false
- end
- end
- else
- -- Remove ESP, Tracers, and NameTags if player dies or no valid character
- if ESP[player] then ESP[player]:Remove(); ESP[player] = nil end
- if Tracers[player] then Tracers[player]:Remove(); Tracers[player] = nil end
- if NameTags[player] then
- NameTags[player].Box:Remove()
- NameTags[player].Text:Remove()
- NameTags[player] = nil
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement