Advertisement
Suteishia

Roblox Phantom Forces Kill Aura Script

Mar 4th, 2021 (edited)
1,066
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.97 KB | None | 0 0
  1. --https://discord.gg/Mkpq3gr4S4
  2. --Brought to you by Noa#4479
  3. --https://sites.google.com/view/synaptics/home
  4.  
  5. local Range = 25
  6.  
  7. local Network;
  8. local UiEffects; -- Hit marker because it looks cool
  9. local PlayerInfo;
  10. local LocalPlayer;
  11.  
  12. for _, Val in next, getgc(true) do
  13.   if type(Val) == "table" and rawget(Val, "send") then
  14.       Network = Val;
  15.   elseif type(Val) == "table" and rawget(Val, "firehitmarker") then
  16.       UiEffects = Val;
  17.   elseif type(Val) == "table" and rawget(Val, "getbodyparts") and rawget(Val, "getplayerhit") then
  18.       PlayerInfo = Val
  19.   elseif type(Val) == "table" and rawget(Val, "rootpart") and rawget(Val, "setmovementmode") then
  20.       LocalPlayer = Val
  21.   end
  22.   if Network and UiEffects and PlayerInfo and LocalPlayer then
  23.       break;
  24.   end
  25. end
  26. warn(LocalPlayer)
  27. local Players = getupvalue(PlayerInfo.getbodyparts, 1)
  28.  
  29.  
  30. local function GetClosestEnemy()
  31.   local ClosestDistance = math.huge
  32.   local ClosestBodyParts, ClosestPlayer = nil, nil;
  33.  
  34.   local LLocalPlayer = game:GetService("Players").LocalPlayer
  35.   local CurrentTeam = LLocalPlayer.Team
  36.  
  37.   for Player, BodyParts in next, Players do
  38.       if Player.Team ~= CurrentTeam and BodyParts and BodyParts.rootpart then
  39.           local Distance = (BodyParts.rootpart.Position - LocalPlayer.rootpart.Position).Magnitude
  40.           if Distance < ClosestDistance then
  41.               ClosestDistance = Distance
  42.               ClosestPlayer = Player
  43.               ClosestBodyParts = BodyParts
  44.           end
  45.       end
  46.   end
  47.  
  48.   return ClosestPlayer, ClosestBodyParts, ClosestDistance
  49. end
  50.  
  51. local function DamagePlayer(Player, BodyParts)
  52.   Network:send("knifehit", Player, tick(), BodyParts.head)
  53.   UiEffects:firehitmarker(true) -- headshot effect, looks really cool thats why i added it lol
  54. end
  55.  
  56. game:GetService("RunService").RenderStepped:Connect(function(dT)
  57.   local Player, BodyParts, Distance = GetClosestEnemy()
  58.  
  59.   if Distance < Range then
  60.       DamagePlayer(Player, BodyParts)
  61.   end
  62. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement