olivia1246

FE Kill All Including NPC (Modified, not mine)

Nov 9th, 2024 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.23 KB | Gaming | 0 0
  1. -- Settings
  2. local range = -5 -- Adjust this for each game (e.g., -3 for close-range games, -5/-4 for sword)
  3.  
  4. -- Variables
  5. local localplayer = game.Players.LocalPlayer
  6. local localcharacter = localplayer.Character or localplayer.CharacterAdded:Wait()
  7. local localroot = localcharacter:WaitForChild("HumanoidRootPart")
  8. local localhumanoid = localcharacter:WaitForChild("Humanoid")
  9.  
  10. -- Load Orion Library and create GUI
  11. local OrionLib = loadstring(game:HttpGet('https://raw.githubusercontent.com/shlexware/Orion/main/source'))()
  12. local Window = OrionLib:MakeWindow({
  13.     Name = "FE Kill All Script GUI v3",
  14.     HidePremium = false,
  15.     SaveConfig = true,
  16.     ConfigFolder = "OrionTest"
  17. })
  18.  
  19. -- Create tabs and sections
  20. local Tab = Window:MakeTab({
  21.     Name = "Main",
  22.     Icon = "rbxassetid://4483345998",
  23.     PremiumOnly = false
  24. })
  25.  
  26. local Section = Tab:AddSection({
  27.     Name = "Section Script"
  28. })
  29.  
  30. -- State Variable
  31. local FEKillAllToggle = false
  32.  
  33. -- Function to get the root part of a character model (HumanoidRootPart, UpperTorso, or Torso)
  34. local function getCharacterRootPart(character)
  35.     return character:FindFirstChild("HumanoidRootPart") or
  36.            character:FindFirstChild("UpperTorso") or
  37.            character:FindFirstChild("Torso")
  38. end
  39.  
  40. -- Function to update local character references
  41. local function updateLocalCharacter()
  42.     localcharacter = localplayer.Character or localplayer.CharacterAdded:Wait()
  43.     localroot = getCharacterRootPart(localcharacter)
  44.     localhumanoid = localcharacter:WaitForChild("Humanoid")
  45. end
  46.  
  47. -- Update character references on respawn
  48. localplayer.CharacterAdded:Connect(function()
  49.     updateLocalCharacter()
  50.     FEKillAllToggle = false
  51. end)
  52.  
  53. -- Function to move target to range and set speed to 0
  54. local function bringTargetToRange(target)
  55.     local targetRoot = getCharacterRootPart(target)
  56.     local targetHumanoid = target:FindFirstChild("Humanoid")
  57.  
  58.     if targetRoot and targetHumanoid and localhumanoid.Health > 0 and targetHumanoid.Health > 0 then
  59.         targetRoot.CFrame = localroot.CFrame * CFrame.new(0, 0, range)
  60.         targetHumanoid.WalkSpeed = 0
  61.     end
  62. end
  63.  
  64. -- Function to get all potential targets (players and NPCs)
  65. local function getAllTargets()
  66.     local targets = {}
  67.  
  68.     -- Add NPCs (any model with Humanoid in the workspace)
  69.     for _, model in pairs(workspace:GetDescendants()) do
  70.         if model:IsA("Model") and model:FindFirstChild("Humanoid") and getCharacterRootPart(model) then
  71.             -- Check to exclude the local player's character
  72.             if model ~= localplayer.Character then
  73.                 table.insert(targets, model)
  74.             end
  75.         end
  76.     end
  77.  
  78.     return targets
  79. end
  80.  
  81. -- Add "FE Kill All" toggle
  82. Tab:AddToggle({
  83.     Name = "FE Kill All Toggle",
  84.     Default = false,
  85.     Callback = function(state)
  86.         FEKillAllToggle = state
  87.         if FEKillAllToggle then
  88.             coroutine.wrap(function()
  89.                 while FEKillAllToggle do
  90.                     for _, target in ipairs(getAllTargets()) do
  91.                         bringTargetToRange(target)
  92.                     end
  93.                     game:GetService("RunService").RenderStepped:Wait()
  94.                 end
  95.             end)()
  96.         end
  97.     end
  98. })
Advertisement
Add Comment
Please, Sign In to add comment