0% found this document useful (0 votes)
5 views1 page

Aimbot

The document contains a Lua script for a game that identifies the closest player to the local player, excluding teammates and players without characters. It modifies the game's metatable to change the behavior of raycasting to target the closest player's head. Additionally, it overrides certain properties to ensure the game functions correctly while implementing these changes.

Uploaded by

maoukurobb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Aimbot

The document contains a Lua script for a game that identifies the closest player to the local player, excluding teammates and players without characters. It modifies the game's metatable to change the behavior of raycasting to target the closest player's head. Additionally, it overrides certain properties to ensure the game functions correctly while implementing these changes.

Uploaded by

maoukurobb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

local CurrentCamera = workspace.

CurrentCamera
local Players = game.GetService(game, "Players")
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()
function ClosestPlayer()
local MaxDist, Closest = math.huge
for I,V in pairs(Players.GetPlayers(Players)) do
if V == LocalPlayer then continue end
if V.Team == LocalPlayer then continue end
if not V.Character then continue end
local Head = V.Character.FindFirstChild(V.Character, "Head")
if not Head then continue end
local Pos, Vis = CurrentCamera.WorldToScreenPoint(CurrentCamera,
Head.Position)
if not Vis then continue end
local MousePos, TheirPos = Vector2.new(Mouse.X, Mouse.Y),
Vector2.new(Pos.X, Pos.Y)
local Dist = (TheirPos - MousePos).Magnitude
if Dist < MaxDist then
MaxDist = Dist
Closest = V
end
end
return Closest
end
local MT = getrawmetatable(game)
local OldNC = MT.__namecall
local OldIDX = MT.__index
setreadonly(MT, false)
MT.__namecall = newcclosure(function(self, ...)
local Args, Method = {...}, getnamecallmethod()
if Method == "FindPartOnRayWithIgnoreList" and not checkcaller() then
local CP = ClosestPlayer()
if CP and CP.Character and CP.Character.FindFirstChild(CP.Character,
"Head") then
Args[1] = Ray.new(CurrentCamera.CFrame.Position,
(CP.Character.Head.Position - CurrentCamera.CFrame.Position).Unit * 1000)
return OldNC(self, unpack(Args))
end
end
return OldNC(self, ...)
end)
MT.__index = newcclosure(function(self, K)
if K == "Clips" then
return workspace.Map
end
return OldIDX(self, K)
end)
setreadonly(MT, true)

You might also like