Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RunService = game:GetService("RunService")
- local Workspace = game:GetService("Workspace")
- local Player = game:GetService("Players").LocalPlayer
- local Mouse = Player:GetMouse()
- local Locked = false
- local function WTS(Part)
- local Screen = workspace.CurrentCamera:WorldToViewportPoint(Part.Position)
- return Vector2.new(Screen.x, Screen.y)
- end
- function LockOn()
- if Mouse.Target then
- for _, v in pairs(game.Players:GetChildren()) do
- if Mouse.Target:FindFirstAncestor(v.Name) and v.Name ~= Player.Name then
- local PlayerName = Mouse.Target:FindFirstAncestor(v.Name)
- local Victim = PlayerName:FindFirstChild("HumanoidRootPart")
- Locked = true
- DrawESP = Drawing.new("Text")
- DrawESP.Color = _G.color
- DrawESP.Position = WTS(PlayerName.Head)
- DrawESP.Size = 20.0
- DrawESP.Outline = true
- DrawESP.Center = true
- DrawESP.Visible = _G.healthesp
- local NewThread = coroutine.create(function()
- Stepped = RunService.RenderStepped:Connect(function()
- local Camera = workspace.CurrentCamera
- if Victim then
- Workspace.CurrentCamera.CFrame = CFrame.new(Camera.CFrame.Position, Victim.CFrame.Position)
- DrawESP.Position = WTS(PlayerName.Head)
- else
- LockOff()
- end
- DrawESP.Text = "[".. tostring(math.floor(PlayerName.Humanoid.Health / PlayerName.Humanoid.MaxHealth * 100)).. "%]"
- local _, Screen = workspace.CurrentCamera:WorldToViewportPoint(PlayerName.Head.Position)
- if Screen then
- DrawESP.Visible = _G.healthesp
- else
- DrawESP.Visible = false
- end
- end)
- end)
- coroutine.resume(NewThread)
- end
- end
- end
- end
- function LockOff()
- if Stepped then
- Stepped:Disconnect()
- Locked = false
- end
- if DrawESP then
- DrawESP:Remove()
- end
- end
- Mouse.KeyDown:Connect(function(key)
- if key == _G.keybind then
- if Locked == true then
- LockOff()
- elseif Locked == false then
- LockOn()
- end
- end
- end)
Add Comment
Please, Sign In to add comment