Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local c = workspace.CurrentCamera
- local ps = game:GetService("Players")
- local lp = ps.LocalPlayer
- local rs = game:GetService("RunService")
- local function getdistancefc(part)
- return (part.Position - c.CFrame.Position).Magnitude
- end
- local function esp(p,cr)
- local h = cr:WaitForChild("Humanoid")
- local hrp = cr:WaitForChild("HumanoidRootPart")
- local text = Drawing.new("Text")
- text.Visible = false
- text.Center = true
- text.Outline = true
- text.Font = 2
- text.Color = Color3.fromRGB(255,255,255)
- text.Size = 16
- local c1
- local c2
- local c3
- local function dc()
- text.Visible = false
- text:Remove()
- if c1 then
- c1:Disconnect()
- c1 = nil
- end
- if c2 then
- c2:Disconnect()
- c2 = nil
- end
- if c3 then
- c3:Disconnect()
- c3 = nil
- end
- end
- c2 = cr.AncestryChanged:Connect(function(_,parent)
- if not parent then
- dc()
- end
- end)
- c3 = h.HealthChanged:Connect(function(v)
- if (v<=0) or (h:GetState() == Enum.HumanoidStateType.Dead) then
- dc()
- end
- end)
- c1 = rs.RenderStepped:Connect(function()
- local hrp_pos,hrp_os = c:WorldToViewportPoint(hrp.Position)
- if hrp_os then
- text.Position = Vector2.new(hrp_pos.X,hrp_pos.Y)
- text.Text = p.Name .. ' ('..tostring(math.floor(getdistancefc(hrp)))..' ms)'
- text.Visible = true
- else
- text.Visible = false
- end
- end)
- end
- local function p_added(p)
- if p.Character then
- esp(p,p.Character)
- end
- p.CharacterAdded:Connect(function(cr)
- esp(p,cr)
- end)
- end
- for i,p in next, ps:GetPlayers() do
- if p ~= lp then
- p_added(p)
- end
- end
- ps.PlayerAdded:Connect(p_added)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement