local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local Camera = Workspace.CurrentCamera
local LocalPlayer = Players.LocalPlayer
local FOV_RADIUS = 650
local currentTarget = nil
RunService.RenderStepped:Connect(function()
local closestTarget = nil
local shortestDistance = FOV_RADIUS
local mousePos = UserInputService:GetMouseLocation()
local charsFolder = Workspace:FindFirstChild("Characters")
local characters = charsFolder and charsFolder:GetChildren() or Workspace:GetChildren()
for _, char in ipairs(characters) do
if char:IsA("Model") and char ~= LocalPlayer.Character then
local humanoid = char:FindFirstChildOfClass("Humanoid")
if humanoid and humanoid.Health > 0 then
local mySide = LocalPlayer:GetAttribute("MatchSide")
local theirSide = char:GetAttribute("MatchSide")
if mySide and theirSide and mySide == theirSide then
if char:GetAttribute("BotMatchBot") ~= true and char:GetAttribute("Decoy") ~= true then
continue
end
end
local head = char:FindFirstChild("Head")
local rootPart = char:FindFirstChild("HumanoidRootPart")
local aimPart = head or rootPart
if aimPart then
local screenPos, onScreen = Camera:WorldToViewportPoint(aimPart.Position)
if onScreen then
local distance = (Vector2.new(screenPos.X, screenPos.Y) - mousePos).Magnitude
if distance < shortestDistance then
shortestDistance = distance
closestTarget = aimPart
end
end
end
end
end
end
currentTarget = closestTarget
end)
local oldNamecall
oldNamecall = hookmetamethod(game, "__namecall", function(self, ...)
local method = getnamecallmethod()
local args = {...}
if not checkcaller() and currentTarget then
-- Server Redirection
if method == "FireServer" then
if self.Name == "ThrowReplicate" and type(args[1]) == "table" then
args[1].target = currentTarget.Position
return oldNamecall(self, unpack(args))
elseif self.Name == "ShootReplicate" and type(args[1]) == "table" then
args[1].hitInstance = currentTarget
args[1].hitPos = currentTarget.Position
args[1].to = currentTarget.Position
args[1].isCharacterHit = true
if args[1].segments and type(args[1].segments) == "table" and #args[1].segments > 0 then
local lastSegment = args[1].segments[#args[1].segments]
lastSegment.hitInstance = currentTarget
lastSegment.hitPos = currentTarget.Position
lastSegment.isCharacterHit = true
end
return oldNamecall(self, unpack(args))
end
-- Visual Redirection (might not be needed)
elseif method == "Fire" then
if self.Name == "SpawnKnife" and type(args[1]) == "table" then
args[1].target = currentTarget.Position
return oldNamecall(self, unpack(args))
elseif self.Name == "SpawnBullet" and type(args[1]) == "table" then
args[1].hitInstance = currentTarget
args[1].hitPos = currentTarget.Position
args[1].to = currentTarget.Position
args[1].isCharacterHit = true
if args[1].segments and type(args[1].segments) == "table" and #args[1].segments > 0 then
local lastSegment = args[1].segments[#args[1].segments]
lastSegment.hitInstance = currentTarget
lastSegment.hitPos = currentTarget.Position
lastSegment.isCharacterHit = true
end
return oldNamecall(self, unpack(args))
end
end
end
return oldNamecall(self, ...)
end)
Comments
Works bad and it gets your fps lower and because of that it stops working
icl thats pretty cool, asw very kind of you to make it open source 👏