CaliberMag

Untitled

Oct 15th, 2020 (edited)
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. local RunService = game:GetService("RunService")
  2. local Workspace = game:GetService("Workspace")
  3.  
  4. local Player = game:GetService("Players").LocalPlayer
  5. local Mouse = Player:GetMouse()
  6. local Locked = false
  7.  
  8. local function WTS(Part)
  9. local Screen = workspace.CurrentCamera:WorldToViewportPoint(Part.Position)
  10. return Vector2.new(Screen.x, Screen.y)
  11. end
  12.  
  13. function LockOn()
  14. if Mouse.Target then
  15. for _, v in pairs(game.Players:GetChildren()) do
  16. if Mouse.Target:FindFirstAncestor(v.Name) and v.Name ~= Player.Name then
  17. local PlayerName = Mouse.Target:FindFirstAncestor(v.Name)
  18. local Victim = PlayerName:FindFirstChild("HumanoidRootPart")
  19. Locked = true
  20.  
  21. DrawESP = Drawing.new("Text")
  22. DrawESP.Color = _G.color
  23. DrawESP.Position = WTS(PlayerName.Head)
  24. DrawESP.Size = 20.0
  25. DrawESP.Outline = true
  26. DrawESP.Center = true
  27. DrawESP.Visible = _G.healthesp
  28.  
  29. local NewThread = coroutine.create(function()
  30. Stepped = RunService.RenderStepped:Connect(function()
  31. local Camera = workspace.CurrentCamera
  32. if Victim then
  33. Workspace.CurrentCamera.CFrame = CFrame.new(Camera.CFrame.Position, Victim.CFrame.Position)
  34. DrawESP.Position = WTS(PlayerName.Head)
  35. else
  36. LockOff()
  37. end
  38.  
  39. DrawESP.Text = "[".. tostring(math.floor(PlayerName.Humanoid.Health / PlayerName.Humanoid.MaxHealth * 100)).. "%]"
  40.  
  41. local _, Screen = workspace.CurrentCamera:WorldToViewportPoint(PlayerName.Head.Position)
  42. if Screen then
  43. DrawESP.Visible = _G.healthesp
  44. else
  45. DrawESP.Visible = false
  46. end
  47. end)
  48. end)
  49. coroutine.resume(NewThread)
  50. end
  51. end
  52. end
  53. end
  54.  
  55. function LockOff()
  56. if Stepped then
  57. Stepped:Disconnect()
  58. Locked = false
  59. end
  60. if DrawESP then
  61. DrawESP:Remove()
  62. end
  63. end
  64.  
  65. Mouse.KeyDown:Connect(function(key)
  66. if key == _G.keybind then
  67. if Locked == true then
  68. LockOff()
  69. elseif Locked == false then
  70. LockOn()
  71. end
  72. end
  73. end)
Add Comment
Please, Sign In to add comment