Categories > WeAreDevs > Suggestions >
a f###king better team checker for aimbot
Posted
this is just one I did as a example, btw, I don't know if it works
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
-- Get closest valid enemy
local function getClosestEnemy()
local closest, closestAngle = nil, math.huge
for _, plr in ipairs(Players:GetPlayers()) do
if plr ~= player and plr.Team ~= player.Team then -- skip self & teammates
local char = plr.Character
if char and char:FindFirstChild("Head") then
local hrp = char.HumanoidRootPart
local dir = (hrp.Position - camera.CFrame.Position).Unit
local angle = math.deg(math.acos(dir:Dot(camera.CFrame.LookVector)))
if angle < closestAngle then
closestAngle = angle
closest = hrp
end
end
end
end
return closest
end
-- Snap aim
local function snapAim()
local target = getClosestEnemy()
if target then
camera.CFrame = CFrame.new(camera.CFrame.Position, target.Position)
end
end
-- Bind to Right Mouse Button
UserInputService.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.UserInputType == Enum.UserInputType.MouseButton2 then -- RMB
snapAim()
end
end)
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post