UsernameRTX

Phantom Forces Knife Aura

Jul 19th, 2021 (edited)
584
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Players = game:GetService("Players")
  2. local ReplicatedFirst = game:GetService("ReplicatedFirst")
  3. local RunService = game:GetService("RunService")
  4.  
  5. local LocalPlayer = Players.LocalPlayer
  6.  
  7. local ClientModules = ReplicatedFirst.ClientModules
  8.  
  9. local Old = ClientModules.Old
  10.  
  11. local framework = Old.framework
  12.  
  13. local network = require(framework.network)
  14.  
  15. local Table = coroutine.wrap(function(...)
  16.     for _, Value in ipairs(getgc(true)) do
  17.         if typeof(Value) == "table" and rawget(Value, "gammo") then
  18.             return Value
  19.         end
  20.     end
  21. end)()
  22.  
  23. local getbodyparts = coroutine.wrap(function(...)
  24.     for _, Value in ipairs(getgc(false)) do
  25.         if debug.getinfo(Value).name == "getbodyparts" then
  26.             return Value
  27.         end
  28.     end
  29. end)()
  30.  
  31. local GetClosestEnemyPlayer = function(Range, ...)
  32.     local Player = nil
  33.     for _, Value in ipairs(Players:GetPlayers()) do
  34.         if Value ~= LocalPlayer and Value.Team ~= LocalPlayer.Team and LocalPlayer.Character then
  35.             local BodyParts = getbodyparts(Value)
  36.             if BodyParts then
  37.                 local Magnitude = math.floor((BodyParts.head.Position - LocalPlayer.Character.Head.Position).Magnitude)
  38.                 if Magnitude <= Range then
  39.                     Player = Value
  40.                     Range = Magnitude
  41.                 end
  42.             end
  43.         end
  44.     end
  45.     return Player
  46. end
  47.  
  48. local KnifeEquipped = false
  49. local GunEquipped = false
  50. local Old = 0
  51. local Range = 25
  52.  
  53. RunService.RenderStepped:Connect(function(...)
  54.     if Table.currentgun then
  55.         local ClosestEnemyPlayer = GetClosestEnemyPlayer(Range)
  56.         if ClosestEnemyPlayer then
  57.             if not KnifeEquipped and Table.currentgun.type ~= "KNIFE" then
  58.                 KnifeEquipped = true
  59.                 GunEquipped = false
  60.                 Old = Table.currentgun.gunnumber
  61.                 network:send("equip", 3)
  62.             end
  63.             network:send("knifehit", ClosestEnemyPlayer, tick(), getbodyparts(ClosestEnemyPlayer).head)
  64.         else
  65.             if not GunEquipped and Old ~= 0 then
  66.                 GunEquipped = true
  67.                 KnifeEquipped = false
  68.                 network:send("equip", Old)
  69.             end
  70.         end
  71.     end
  72. end)
RAW Paste Data