-- ==========================================
-- ЛОГИКА И ВВОД
-- ==========================================
local function isBindMatch(input, bind)
if bind == Enum.KeyCode.Unknown then return false end
return input.KeyCode == bind or input.UserInputType == bind
end
UserInputService.InputBegan:Connect(function(input, gp)
if gp then return end
if input.KeyCode == Config.toggleKey then
Config.menuOpen = not Config.menuOpen
mainContainer.Visible = Config.menuOpen
end
-- Бинды игрока
if isBindMatch(input, Config.flyBind) then Config.flyEnabled = not Config.flyEnabled; updateFly() end
if isBindMatch(input, Config.speedhackBind) then Config.speedhackEnabled = not Config.speedhackEnabled; updateSpeed() end
if isBindMatch(input, Config.noclipBind) then Config.noclipEnabled = not Config.noclipEnabled; updateNoclip() end
-- Управление полетом
if input.KeyCode == Enum.KeyCode.W then flyKeys.W = true end
if input.KeyCode == Enum.KeyCode.A then flyKeys.A = true end
if input.KeyCode == Enum.KeyCode.S then flyKeys.S = true end
if input.KeyCode == Enum.KeyCode.D then flyKeys.D = true end
if input.KeyCode == Enum.KeyCode.Space then flyKeys.Space = true end
if input.KeyCode == Enum.KeyCode.LeftControl then flyKeys.LCtrl = true end
-- Click TP
if Config.clickTpEnabled and input.UserInputType == Enum.UserInputType.MouseButton1 then
if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) or UserInputService:IsKeyDown(Enum.KeyCode.RightControl) then
local char = localPlayer.Character
if char and char:FindFirstChild("HumanoidRootPart") then
local mouse = localPlayer:GetMouse()
if mouse.Hit then char:MoveTo(mouse.Hit.p) end
end
end
end
-- Активация Аимбота
if isBindMatch(input, Config.aimBind) then
if Config.aimActivation == "Hold" then
isAiming = true
elseif Config.aimActivation == "Toggle" then
Config.aimActiveToggle = not Config.aimActiveToggle
isAiming = Config.aimActiveToggle
if not isAiming then lockedTarget = nil end -- Сброс цели при выключении
end
end
end)
UserInputService.InputEnded:Connect(function(input, gp)
if input.KeyCode == Enum.KeyCode.W then flyKeys.W = false end
if input.KeyCode == Enum.KeyCode.A then flyKeys.A = false end
if input.KeyCode == Enum.KeyCode.S then flyKeys.S = false end
if input.KeyCode == Enum.KeyCode.D then flyKeys.D = false end
if input.KeyCode == Enum.KeyCode.Space then flyKeys.Space = false end
if input.KeyCode == Enum.KeyCode.LeftControl then flyKeys.LCtrl = false end
if isBindMatch(input, Config.aimBind) and Config.aimActivation == "Hold" then
isAiming = false
lockedTarget = nil -- Отпускаем присоску
end
end)
-- Функция проверки валидности цели (жив ли, за стеной ли)
local function isTargetValid(char)
if not char then return false end
local hum = char:FindFirstChild("Humanoid")
local part = char:FindFirstChild(Config.aimTarget == "Head" and "Head" or "HumanoidRootPart")
if not hum or hum.Health <= 0 or not part then return false end
if Config.wallCheck then
local rayParams = RaycastParams.new()
rayParams.FilterDescendantsInstances = {localPlayer.Character, char}
rayParams.FilterType = Enum.RaycastFilterType.Exclude
local rayResult = Workspace:Raycast(camera.CFrame.Position, part.Position - camera.CFrame.Position, rayParams)
if rayResult then return false end
end
return true
end
-- Умная логика поиска/удержания цели (Присоска)
local function getTarget()
-- Если мы уже целимся и у нас есть прилипшая цель, проверяем её и продолжаем вести (Игнорируем FOV)
if isAiming and lockedTarget and isTargetValid(lockedTarget) then
return lockedTarget
end
-- Иначе сбрасываем присоску и ищем новую ближайшую цель в кружке FOV
lockedTarget = nil
local target = nil
local minDist = Config.aimFov
local mousePos = UserInputService:GetMouseLocation()
local center = Vector2.new(mousePos.X, mousePos.Y)
Post #6
18