local function GetClosest() local closestdist = math.huge local closesttarget = nil local player = game.Players.LocalPlayer local character = player.Character local rootPart = character and character:FindFirstChild("HumanoidRootPart") if not rootPart then return nil end for _, otherPlayer in pairs(game.Players:GetPlayers()) do if otherPlayer ~= player then local otherChar = otherPlayer.Character if otherChar and otherChar:FindFirstChild("HumanoidRootPart") then local otherRoot = otherChar.HumanoidRootPart local distance = (otherRoot.Position - rootPart.Position).Magnitude if distance < closestdist then closestdist = distance closesttarget = otherChar end end end end return closesttarget end local function hook() local Hooked = false; repeat (function() local Reference; for _, Function in getgc() do if typeof(Function) == "function" and debug.info(Function, "n") == "randomunitvector" then Reference = Function end end; if Reference then local RandomUnitVector; RandomUnitVector = hookfunction(Reference, function(Spread, Direction) local Target = GetClosest() if Target then local Head = Target:FindFirstChild("Head") if Head then local Camera = workspace.CurrentCamera; return (Head.Position - Camera.CFrame.Position).Unit * 10000 end end; return RandomUnitVector(Spread, Direction) end) Hooked = true end end)() if not Hooked then task.wait(1) end until Hooked end game.Players.LocalPlayer.CharacterAdded:Connect(function(character) -- this check is necessary because the "gunS" script only appears when youre alive but i dont think it works task.wait(0.5) hook() end) if game.Players.LocalPlayer.Character then hook() end