Advertisement
kill21_2

шотает игроко в ohio

May 13th, 2025
956
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local localPlayer = Players.LocalPlayer
  3. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  4.  
  5. local function getNearestPlayer(character)
  6. local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
  7. if not humanoidRootPart then return end
  8.  
  9. local nearestPlayer = nil
  10. local shortestDistance = math.huge
  11.  
  12. for _, player in ipairs(Players:GetPlayers()) do
  13. if player ~= localPlayer and player.Character then
  14. local targetRoot = player.Character:FindFirstChild("HumanoidRootPart")
  15. if targetRoot then
  16. local distance = (humanoidRootPart.Position - targetRoot.Position).Magnitude
  17. if distance < shortestDistance then
  18. shortestDistance = distance
  19. nearestPlayer = player
  20. end
  21. end
  22. end
  23. end
  24.  
  25. return nearestPlayer
  26. end
  27.  
  28. while true do
  29. local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
  30. local nearestPlayer = getNearestPlayer(character)
  31.  
  32. if nearestPlayer then
  33. local args = {
  34. "player",
  35. {
  36. meleeType = "meleemegapunch",
  37. hitPlayerId = nearestPlayer.UserId
  38. }
  39. }
  40.  
  41. ReplicatedStorage:WaitForChild("devv"):WaitForChild("remoteStorage"):WaitForChild("wth"):FireServer(unpack(args))
  42. else
  43. warn("No nearby players found!")
  44. end
  45.  
  46. wait(0.2) -- Задержка между выполнениями для оптимизации
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement