Advertisement
C-H-4-0-S

Killaura

Nov 14th, 2024 (edited)
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1.  
  2.  
  3. --// Setting \--
  4. local range = 10
  5.  
  6. --// Variable \--
  7. local player = game:GetService("Players").LocalPlayer
  8.  
  9. --// Script \--
  10. game:GetService("RunService").RenderStepped:Connect(function()
  11. local p = game.Players:GetPlayers()
  12. for i = 2, #p do local v = p[i].Character
  13. if v and v:FindFirstChild("Humanoid") and v.Humanoid.Health > 0 and v:FindFirstChild("HumanoidRootPart") and player:DistanceFromCharacter(v.HumanoidRootPart.Position) <= range then
  14. local tool = player.Character and player.Character:FindFirstChildOfClass("Tool")
  15. if tool and tool:FindFirstChild("Handle") then
  16. tool:Activate()
  17. for i,v in next, v:GetChildren() do
  18. if v:IsA("BasePart") then
  19. firetouchinterest(tool.Handle,v,0)
  20. firetouchinterest(tool.Handle,v,1)
  21. end
  22. end
  23. end
  24. end
  25. end
  26. end)
  27.  
  28. local connections = getgenv().configs and getgenv().configs.connection
  29. if connections then
  30. local Disable = configs.Disable
  31. for i,v in connections do
  32. v:Disconnect()
  33. end
  34. Disable:Fire()
  35. Disable:Destroy()
  36. table.clear(configs)
  37. end
  38.  
  39. local Disable = Instance.new("BindableEvent")
  40. getgenv().configs = {
  41. connections = {},
  42. Disable = Disable,
  43. Size = Vector3.new(10,10,10),
  44. DeathCheck = true
  45. }
  46.  
  47. local Players = cloneref(game:GetService("Players"))
  48. local RunService = cloneref(game:GetService("RunService"))
  49. local lp = Players.LocalPlayer
  50. local Run = true
  51. local Ignorelist = OverlapParams.new()
  52. Ignorelist.FilterType = Enum.RaycastFilterType.Include
  53.  
  54. local function getchar(plr)
  55. local plr = plr or lp
  56. return plr.Character
  57. end
  58.  
  59. local function gethumanoid(plr: Player | Character)
  60. local char = plr:IsA("Model") and plr or getchar(plr)
  61.  
  62. if char then
  63. return char:FindFirstChildWhichIsA("Humanoid")
  64. end
  65. end
  66.  
  67. local function IsAlive(Humanoid)
  68. return Humanoid and Humanoid.Health > 0
  69. end
  70.  
  71. local function GetTouchInterest(Tool)
  72. return Tool and Tool:FindFirstChildWhichIsA("TouchTransmitter",true)
  73. end
  74.  
  75. local function GetCharacters(LocalPlayerChar)
  76. local Characters = {}
  77. for i,v in Players:GetPlayers() do
  78. table.insert(Characters,getchar(v))
  79. end
  80. table.remove(Characters,table.find(Characters,LocalPlayerChar))
  81. return Characters
  82. end
  83.  
  84. local function Attack(Tool,TouchPart,ToTouch)
  85. if Tool:IsDescendantOf(workspace) then
  86. Tool:Activate()
  87. firetouchinterest(TouchPart,ToTouch,1)
  88. firetouchinterest(TouchPart,ToTouch,0)
  89. end
  90. end
  91.  
  92. table.insert(getgenv().configs.connections,Disable.Event:Connect(function()
  93. Run = false
  94. end))
  95.  
  96. while Run do
  97. local char = getchar()
  98. if IsAlive(gethumanoid(char)) then
  99. local Tool = char and char:FindFirstChildWhichIsA("Tool")
  100. local TouchInterest = Tool and GetTouchInterest(Tool)
  101.  
  102. if TouchInterest then
  103. local TouchPart = TouchInterest.Parent
  104. local Characters = GetCharacters(char)
  105. Ignorelist.FilterDescendantsInstances = Characters
  106. local InstancesInBox = workspace:GetPartBoundsInBox(TouchPart.CFrame,TouchPart.Size + getgenv().configs.Size,Ignorelist)
  107.  
  108. for i,v in InstancesInBox do
  109. local Character = v:FindFirstAncestorWhichIsA("Model")
  110.  
  111. if table.find(Characters,Character) then
  112. if getgenv().configs.DeathCheck then
  113. if IsAlive(gethumanoid(Character)) then
  114. Attack(Tool,TouchPart,v)
  115. end
  116. else
  117. Attack(Tool,TouchPart,v)
  118. end
  119. end
  120. end
  121. end
  122. end
  123. RunService.Heartbeat:Wait()
  124. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement