Advertisement
C-H-4-0-S

Killaura but it works for NPCs and players

Nov 15th, 2024
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. local players = game:GetService("Players")
  2. local player = players.LocalPlayer
  3. local camera = workspace.CurrentCamera
  4.  
  5. local Range = 10 -- Define the range (e.g., 10 studs)
  6.  
  7. local function getPartsInViewport(maxDistance)
  8. local partsInViewport = {}
  9. for _, part in ipairs(workspace:GetDescendants()) do
  10. if part:IsA("BasePart") then
  11. local distance = player:DistanceFromCharacter(part.Position)
  12. if distance <= maxDistance then
  13. local _, isVisible = camera:WorldToViewportPoint(part.Position)
  14. if isVisible then
  15. table.insert(partsInViewport, part)
  16. end
  17. end
  18. end
  19. end
  20. return partsInViewport
  21. end
  22.  
  23. while true do
  24. wait()
  25. local tool = player.Character and player.Character:FindFirstChildOfClass("Tool")
  26. local parts = getPartsInViewport(Range)
  27.  
  28. if tool and tool:FindFirstChild("Handle") then
  29. for _, part in ipairs(parts) do
  30. if part and part.Parent and part.Parent ~= player.Character and part.Parent:FindFirstChildWhichIsA("Humanoid") and part.Parent:FindFirstChildWhichIsA("Humanoid").Health > 0 then
  31. tool:Activate()
  32. firetouchinterest(tool.Handle, part, 0)
  33. firetouchinterest(tool.Handle, part, 1)
  34. end
  35. end
  36. end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement