Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
Add Comment
Please, Sign In to add comment