UsernameRTX

Phantom Forces Grenade Teleport

Jul 20th, 2021 (edited)
425
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 getbodyparts = coroutine.wrap(function(...)
  16.     for _, Value in ipairs(getgc(false)) do
  17.         if debug.getinfo(Value).name == "getbodyparts" then
  18.             return Value
  19.         end
  20.     end
  21. end)()
  22.  
  23. local GetClosestEnemyPlayer = function(Range, ...)
  24.     local Player = nil
  25.     for _, Value in ipairs(Players:GetPlayers()) do
  26.         if Value ~= LocalPlayer and Value.Team ~= LocalPlayer.Team and LocalPlayer.Character then
  27.             local BodyParts = getbodyparts(Value)
  28.             if BodyParts then
  29.                 local Magnitude = math.floor((BodyParts.head.Position - LocalPlayer.Character.Head.Position).Magnitude)
  30.                 if Magnitude <= Range then
  31.                     Player = Value
  32.                     Range = Magnitude
  33.                 end
  34.             end
  35.         end
  36.     end
  37.     return Player
  38. end
  39.  
  40. local Old = network.send
  41. network.send = function(Self, Name, ...)
  42.     local Arguments = {...}
  43.     if Name == "newgrenade" then
  44.         local ClosestEnemyPlayer = GetClosestEnemyPlayer(math.huge)
  45.         if ClosestEnemyPlayer then
  46.             for Index, Value in ipairs(Arguments[2].frames) do
  47.                 if Index ~= 1 then
  48.                     Value.p0 = getbodyparts(ClosestEnemyPlayer).head.Position + getbodyparts(ClosestEnemyPlayer).rootpart.Velocity
  49.                 end
  50.             end
  51.             Arguments[2].blowuptime = 0
  52.             return Old(Self, Name, unpack(Arguments))
  53.         end
  54.     end
  55.     return Old(Self, Name, unpack(Arguments))
  56. end
RAW Paste Data