SgtVibesYT

Phantom Forces SILENT AIM

Feb 10th, 2021
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.05 KB | None | 0 0
  1. -- Phantom Forces SILENT AIM
  2.  
  3. local Players = game:GetService("Players")
  4. local Camera = workspace.CurrentCamera
  5. local LocalPlayer = Players.LocalPlayer
  6. local Mouse = LocalPlayer:GetMouse()
  7. local GameLogic, CharTable, Trajectory
  8. for I,V in pairs(getgc(true)) do
  9.     if type(V) == "table" then
  10.         if rawget(V, "gammo") then
  11.             GameLogic = V
  12.         end
  13.     elseif type(V) == "function" then
  14.         if debug.getinfo(V).name == "getbodyparts" then
  15.             CharTable = debug.getupvalue(V, 1)
  16.         elseif debug.getinfo(V).name == "trajectory" then
  17.             Trajectory = V
  18.         end
  19.     end
  20.     if GameLogic and CharTable and Trajectory then break end
  21. end
  22.  
  23. local function Closest()
  24.     local Max, Close = math.huge
  25.     for I,V in pairs(Players:GetPlayers()) do
  26.         if V ~= LocalPlayer and V.Team ~= LocalPlayer.Team and CharTable[V] then
  27.             local Pos, OnScreen = Camera:WorldToScreenPoint(CharTable[V].head.Position)
  28.             if OnScreen then
  29.                 local Dist = (Vector2.new(Pos.X, Pos.Y) - Vector2.new(Mouse.X, Mouse.Y)).Magnitude
  30.                 if Dist < Max then
  31.                     Max = Dist
  32.                     Close = V
  33.                 end
  34.             end
  35.         end
  36.     end
  37.     return Close
  38. end
  39. local MT = getrawmetatable(game)
  40. local __index = MT.__index
  41. setreadonly(MT, false)
  42. MT.__index = newcclosure(function(self, K)
  43.     if not checkcaller() and GameLogic.currentgun and GameLogic.currentgun.data and (self == GameLogic.currentgun.barrel or tostring(self) == "SightMark") and K == "CFrame" then
  44.         local CharChosen = (CharTable[Closest()] and CharTable[Closest()].head)
  45.         if CharChosen then
  46.             local _, Time = Trajectory(self.Position, Vector3.new(0, -workspace.Gravity, 0), CharChosen.Position, GameLogic.currentgun.data.bulletspeed)
  47.             return CFrame.new(self.Position, CharChosen.Position + (Vector3.new(0, -workspace.Gravity / 2, 0)) * (Time ^ 2) + (CharChosen.Velocity * Time))
  48.         end
  49.     end
  50.     return __index(self, K)
  51. end)
  52. setreadonly(MT, true)
Advertisement
Add Comment
Please, Sign In to add comment