local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera local MAX_DISTANCE = 150 local function getPlayer() if not LocalPlayer:GetAttribute("Map") then return nil end local myCharacter = LocalPlayer.Character local myRoot = myCharacter and myCharacter:FindFirstChild("HumanoidRootPart") if not myRoot then return nil end local mouse = LocalPlayer:GetMouse() local mousePos = Vector2.new(mouse.X, mouse.Y) local myTeam = LocalPlayer:GetAttribute("Team") local myGame = LocalPlayer:GetAttribute("Game") local closestPlayer = nil local shortestDistance = math.huge for _, player in ipairs(Players:GetPlayers()) do if player ~= LocalPlayer then local character = player.Character local root = character and character:FindFirstChild("HumanoidRootPart") if root and player:GetAttribute("Game") == myGame and player:GetAttribute("Team") ~= myTeam then local worldDistance = (root.Position - myRoot.Position).Magnitude if worldDistance <= MAX_DISTANCE then local screenPos, onScreen = Camera:WorldToViewportPoint(root.Position) if onScreen then local dist = ( Vector2.new(screenPos.X, screenPos.Y) - mousePos ).Magnitude if dist < shortestDistance then shortestDistance = dist closestPlayer = player end end end end end end return closestPlayer end local oldIndex oldIndex = hookmetamethod(game, "__index", newcclosure(function(self, key) if not checkcaller() and self == LocalPlayer:GetMouse() and key == "Hit" then local target = getPlayer() if target then local root = target.Character and target.Character:FindFirstChild("HumanoidRootPart") if root then return CFrame.new(root.Position) end end end return oldIndex(self, key) end))