Advertisement
ZV0K

Lock Detector

Aug 6th, 2023 (edited)
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. lock detector
  2.  
  3. 1.the dot follows u good when they locking
  4.  
  5. 2.the dot goes crazy when they arent
  6.  
  7. 3.u gotta click q on ur target
  8.  
  9. local placemarker = Instance.new("Part", game.Workspace)
  10. local Plr
  11. local enabled = false
  12. local CC = game:GetService'Workspace'.CurrentCamera
  13. local mouse = game.Players.LocalPlayer:GetMouse()
  14.  
  15. function makemarker(Parent, Adornee, Color, Size, Size2)
  16. local e = Instance.new("BillboardGui", Parent)
  17. e.Name = "PP"
  18. e.Adornee = Adornee
  19. e.Size = UDim2.new(Size, Size2, Size, Size2)
  20. e.AlwaysOnTop = true
  21. local a = Instance.new("Frame", e)
  22. a.Size = UDim2.new(1, 0, 1, 0)
  23. a.BackgroundTransparency = 0.4
  24. a.BackgroundColor3 = Color
  25. local g = Instance.new("UICorner", a)
  26. g.CornerRadius = UDim.new(30, 30)
  27. return(e)
  28. end
  29.  
  30. function getClosestPlayerToCursor()
  31. local closestPlayer
  32. local shortestDistance = math.huge
  33.  
  34. for i, v in pairs(game.Players:GetPlayers()) do
  35. if v ~= game.Players.LocalPlayer and v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild("Head") then
  36. local pos = CC:WorldToViewportPoint(v.Character.PrimaryPart.Position)
  37. local magnitude = (Vector2.new(pos.X, pos.Y) - Vector2.new(mouse.X, mouse.Y)).magnitude
  38. if magnitude < shortestDistance then
  39. closestPlayer = v
  40. shortestDistance = magnitude
  41. end
  42. end
  43. end
  44. return closestPlayer
  45. end
  46.  
  47. mouse.KeyDown:Connect(function(k)
  48. if k ~= "q" then return end
  49. if enabled then
  50. enabled = false
  51. placemarker.Transparency = 1
  52. else
  53. placemarker.Transparency = 0
  54. enabled = true
  55. Plr = getClosestPlayerToCursor()
  56. end
  57. end)
  58.  
  59. placemarker.Anchored = true
  60. placemarker.CanCollide = false
  61. placemarker.Size = Vector3.new(0.1, 0.1, 0.1)
  62. placemarker.Transparency = 1
  63. makemarker(placemarker, placemarker, Color3.fromRGB(255, 255, 255), 1, 0)
  64.  
  65. game:GetService"RunService".Stepped:connect(function()
  66. if enabled and Plr.Character then
  67. placemarker.CFrame = CFrame.new(Plr.Character.BodyEffects.MousePos.Value)
  68. end
  69. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement