Advertisement
YellowGreg

Chaos KillAura | Modify Version

Aug 25th, 2023
1,400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.93 KB | None | 0 0
  1. if shared.settings then
  2.     return
  3. end
  4.  
  5. shared.settings = {
  6.     killaura = true,
  7.     maxdistance = 30,
  8.     debugging = true,
  9. }
  10.  
  11. local Players = game:GetService("Players")
  12. local lp = Players.LocalPlayer or Players.LocalPlayerChanged:Wait()
  13.  
  14. local function getchar(plr)
  15.     local character = plr.Character or plr.CharacterAdded:Wait()
  16.     return character
  17. end
  18.  
  19. local function gethumanoid(plr)
  20.     local character = getchar(plr)
  21.     return character:WaitForChild("Humanoid")
  22. end
  23.  
  24. local function getDamageRemote()
  25.     local character = getchar(lp)
  26.     local tool = character:FindFirstChildWhichIsA("Tool")
  27.     return tool and tool:FindFirstChild("DamageRemote")
  28. end
  29.  
  30. local function GetClosestPlayer()
  31.     local maxDistance = shared.settings.maxdistance
  32.     local closestPlayer = nil
  33.     local closestDistance = maxDistance
  34.  
  35.     for _, player in ipairs(Players:GetPlayers()) do
  36.         if player ~= lp then
  37.             local character = getchar(player)
  38.             local basePart = character:FindFirstChildWhichIsA("BasePart")
  39.             local humanoid = gethumanoid(player)
  40.            
  41.             if basePart and humanoid and humanoid.Health > 0 then
  42.                 local distance = lp:DistanceFromCharacter(basePart.Position)
  43.                 if distance <= maxDistance and distance < closestDistance then
  44.                     closestPlayer = player
  45.                     closestDistance = distance
  46.                 end
  47.             end
  48.         end
  49.     end
  50.  
  51.     return closestPlayer, closestDistance
  52. end
  53.  
  54. while shared.settings.killaura do
  55.     local damageRemote = getDamageRemote()
  56.     if damageRemote then
  57.         local target, distance = GetClosestPlayer()
  58.         if target then
  59.             damageRemote:FireServer(gethumanoid(target))
  60.             if shared.settings.debugging then
  61.                 warn("Attacked", target, "from", distance, "studs away")
  62.             end
  63.         end
  64.     end
  65.     task.wait()
  66. end
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement