Advertisement
C-H-4-0-S

Killaura 2

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