Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Camera = game:GetService("Workspace").CurrentCamera
- local Players = game:GetService("Players")
- local LocalPlayer = game:GetService("Players").LocalPlayer
- local function GetClosestPlayer()
- local ClosestPlayer = nil
- local FarthestDistance = math.huge
- for i, v in pairs(Players.GetPlayers(Players)) do
- if v ~= LocalPlayer and v.Character and v.Character.FindFirstChild(v.Character, "HumanoidRootPart") then
- local DistanceFromPlayer = (LocalPlayer.Character.HumanoidRootPart.Position - v.Character.HumanoidRootPart.Position).Magnitude
- if DistanceFromPlayer < FarthestDistance then
- FarthestDistance = DistanceFromPlayer
- ClosestPlayer = v
- end
- end
- end
- if ClosestPlayer then
- return ClosestPlayer
- end
- end
- local GameMetaTable = getrawmetatable(game)
- local OldGameMetaTableNamecall = GameMetaTable.__namecall
- setreadonly(GameMetaTable, false)
- GameMetaTable.__namecall = newcclosure(function(object, ...)
- local NamecallMethod = getnamecallmethod()
- local Arguments = {...}
- if tostring(NamecallMethod) == "FindPartOnRayWithIgnoreList" then
- local ClosestPlayer = GetClosestPlayer()
- if ClosestPlayer and ClosestPlayer.Character then
- Arguments[1] = Ray.new(Camera.CFrame.Position, (ClosestPlayer.Character.Head.Position - Camera.CFrame.Position).Unit * (Camera.CFrame.Position - ClosestPlayer.Character.Head.Position).Magnitude)
- end
- end
- return OldGameMetaTableNamecall(object, unpack(Arguments))
- end)
- setreadonly(GameMetaTable, true)
- print("aimbot on")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement