
Key Required

-- For more scripts, join discord. (https://discord.gg/JH8Kqtqq3m)
-- > Services
local UserInputService = game.GetService(game, 'UserInputService')
local Players = game.GetService(game, 'Players')
-- > Variables
local LocalPlayer, Camera = Players.LocalPlayer, workspace.CurrentCamera
-- > Functions
function GetClosestTarget(...)
local Args = {...}
if not Args then return nil end
--
local Target, Closest = nil, math.huge
for Index, Value in next, Players.GetPlayers(Players) do
if LocalPlayer == Value then continue end
--
local Character = Value.Character
if not Character then continue end
--
local Head = game.FindFirstChild(Character, 'Head')
if not Head then return Target end
--
local Humanoid = game.FindFirstChildOfClass(Character, 'Humanoid')
if not Humanoid or Humanoid.Health <= 0 then continue end
--
local Obscuring = Camera.GetPartsObscuringTarget(Camera, {Args[1], Head.Position}, {Character, LocalPlayer.Character})
if #Obscuring > 0 then continue end
--
local Vector, OnScreen = Camera.WorldToViewportPoint(Camera, Head.Position)
if not OnScreen then continue end
--
local Distance = (Vector2.new(Vector.X, Vector.Y) - UserInputService.GetMouseLocation(UserInputService)).Magnitude
if Distance < Closest then Closest, Target = Distance, Head end
end
--
return Target
end
-- > Connections
for Index, Value in next, getgc() do
if typeof(Value) ~= 'function' then continue end
--
if debug.getinfo(Value).name == 'ProcessProjectiles' or debug.getinfo(Value).name == 'ProcessShot' then
local Original; Original = hookfunction(Value, function(...)
local Args = {...}
--
local Target = GetClosestTarget(Args[1]:GetBase().Tip.WorldPosition)
if not Target then return Original(table.unpack(Args)) end
--
Args[3] = Target.Position
return Original(table.unpack(Args))
end)
end
endNo comments yet for this script.



