Advertisement
KeyyToWavyy

Untitled

Apr 8th, 2023
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. --[[
  2. WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk!
  3. ]]
  4. local uis = game:GetService("UserInputService")
  5. local cam = game:GetService("Workspace").CurrentCamera
  6. local ts = game:GetService("TweenService")
  7. local plr = game:GetService("Players").LocalPlayer
  8. local zombies = game:GetService("Workspace").Zombies
  9.  
  10. local function getClosestSilent()
  11. local closestDist = math.huge
  12. local closestPlr = nil
  13. for _, v in next, zombies.GetChildren(zombies) do
  14. if game.FindFirstChild(v, "Humanoid") and v.Humanoid.Health > 0 then
  15. local vector, onScreen = cam.worldToScreenPoint(cam, game.WaitForChild(v, "Head", math.huge).Position)
  16. local dist = (Vector2.new(uis.GetMouseLocation(uis).X, uis.GetMouseLocation(uis).Y) - Vector2.new(vector.X, vector.Y)).Magnitude
  17. if dist < closestDist and onScreen then
  18. closestDist = dist
  19. closestPlr = v
  20. end
  21. end
  22. end
  23. return closestPlr
  24. end
  25.  
  26. local namecall;
  27. namecall = hookmetamethod(game, "__namecall", function(Self, ...)
  28. if not checkcaller() and tostring(getcallingscript()) == "Framework" and string.lower(getnamecallmethod()) == "findpartonraywithignorelist" then
  29. local args = {...}
  30. local closest = getClosestSilent()
  31. if closest then
  32. local origin = args[1].Origin
  33. args[1] = Ray.new(origin, closest.Head.Position - origin)
  34. end
  35. return namecall(Self, unpack(args))
  36. end
  37. return namecall(Self, ...)
  38. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement