-- For more scripts, join discord. (https://discord.gg/JH8Kqtqq3m) -- > Services local ReplicatedStorage = game.GetService(game, 'ReplicatedStorage') local UserInputService = game.GetService(game, 'UserInputService') local Players = game.GetService(game, 'Players') -- > Variables local MiscHandler, LocalPlayer, Camera = ReplicatedStorage:FindFirstChild('MiscHandler', true), Players.LocalPlayer, workspace.CurrentCamera -- > Functions function GetClosestTarget() local Target, Closest = nil, math.huge for Index, Value in next, Players.GetPlayers(Players) do if LocalPlayer == Value or (Value.Team and Value.Team.Name == 'Lobby') or (LocalPlayer.Team and Value.Team and not (LocalPlayer.Team.Name == 'FFA') and (LocalPlayer.Team == Value.Team or MiscHandler.Relationships[LocalPlayer.Team.Name] and MiscHandler.Relationships[LocalPlayer.Team.Name][Value.Team.Name] == 'Friendly')) 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, {Camera.CFrame.Position, 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 local Identity, Detected = getthreadidentity(), nil setthreadidentity(2) for Index, Value in next, getgc(true) do if typeof(Value) == 'function' then if debug.getinfo(Value).name == 'recoil' then hookfunction(Value, function(...) end) end elseif typeof(Value) == 'table' then if typeof(rawget(Value, 'Detected')) == 'function' and not Detected then Detected = rawget(Value, 'Detected') hookfunction(Detected, function(...) return true end) elseif rawget(Value, 'Variables') and rawget(Value, 'Process') and typeof(rawget(Value, 'Kill')) == 'function' and not Kill then hookfunction(rawget(Value, 'Kill'), function(...) end) end end end local Original; Original = hookfunction(getrenv().debug.info, newcclosure(function(...) local Args = {...} if Detected and Args[1] == Detected then return coroutine.yield(coroutine.running()) end -- return Original(table.unpack(Args)) end)) setthreadidentity(Identity) local Original; Original = hookmetamethod(game, '__namecall', newcclosure(function(self, ...) local Args, Method, Script = {...}, getnamecallmethod(), getcallingscript() if self == workspace and Method == 'Raycast' and tostring(Script) == 'WeaponSystem_Overhaul' then local Target = GetClosestTarget() if not Target then return Original(self, table.unpack(Args)) end Args[2] = (Target.Position - Args[1]).Unit * 1000 end -- return Original(self, table.unpack(Args)) end))