Advertisement
SigmaBoy456

Aimbot Example #183(player)

Sep 1st, 2024
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local character = player.Character
  3. local localroot = character:WaitForChild("HumanoidRootPart")
  4.  
  5. local function closest()
  6. local range = math.huge
  7. local target = nil
  8. for _, v in pairs(game.Players:GetPlayers()) do
  9. if v ~= player and v.Character then
  10. local JN = v.Character:FindFirstChild("HumanoidRootPart")
  11. local vhum = v.Character:FindFirstChildOfClass("Humanoid")
  12. if JN and vhum and vhum.Health > 0 then
  13. local dist = (localroot.Position - JN.Position).magnitude
  14. if dist < range then
  15. range = dist
  16. target = JN
  17. end
  18. end
  19. end
  20. end
  21. return target
  22. end
  23.  
  24. local Cam = workspace.CurrentCamera
  25. local function Update()
  26. local t = closest()
  27. if t then
  28. Cam.CFrame = CFrame.new(Cam.CFrame.Position, t.Position)
  29. end
  30. end
  31.  
  32. game:GetService("RunService").RenderStepped:Connect(Update)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement