ZynatyGaming

Silent Aim

May 6th, 2021 (edited)
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. local CurrentCamera = workspace.CurrentCamera
  2.  
  3. local Players = game.GetService(game, "Players")
  4. local LocalPlayer = Players.LocalPlayer
  5. local Mouse = LocalPlayer:GetMouse()
  6. function ClosestPlayer()
  7. local MaxDist, Closest = math.huge
  8. for I,V in pairs(Players.GetPlayers(Players)) do
  9. if V == LocalPlayer then continue end
  10. if V.Team == LocalPlayer then continue end
  11. if not V.Character then continue end
  12. local Head = V.Character.FindFirstChild(V.Character, "Head")
  13. if not Head then continue end
  14. local Pos, Vis = CurrentCamera.WorldToScreenPoint(CurrentCamera, Head.Position)
  15. if not Vis then continue end
  16. local MousePos, TheirPos = Vector2.new(Mouse.X, Mouse.Y), Vector2.new(Pos.X, Pos.Y)
  17. local Dist = (TheirPos - MousePos).Magnitude
  18. if Dist < MaxDist then
  19. MaxDist = Dist
  20. Closest = V
  21. end
  22. end
  23. return Closest
  24. end
  25. local MT = getrawmetatable(game)
  26. local OldNC = MT.__namecall
  27. local OldIDX = MT.__index
  28. setreadonly(MT, false)
  29. MT.__namecall = newcclosure(function(self, ...)
  30. local Args, Method = {...}, getnamecallmethod()
  31. if Method == "FindPartOnRayWithIgnoreList" and not checkcaller() then
  32. local CP = ClosestPlayer()
  33. if CP and CP.Character and CP.Character.FindFirstChild(CP.Character, "Head") then
  34. Args[1] = Ray.new(CurrentCamera.CFrame.Position, (CP.Character.Head.Position - CurrentCamera.CFrame.Position).Unit * 1000)
  35. return OldNC(self, unpack(Args))
  36. end
  37. end
  38. return OldNC(self, ...)
  39. end)
  40. MT.__index = newcclosure(function(self, K)
  41. if K == "Clips" then
  42. return workspace.Map
  43. end
  44. return OldIDX(self, K)
  45. end)
  46. setreadonly(MT, true)
Add Comment
Please, Sign In to add comment