local PathfindingService = game:GetService("PathfindingService") local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local Me = Players.LocalPlayer local following = false local STOP_DISTANCE = 2 local isTeamGame = false local myTeam = nil -- GUI local screenGui = Instance.new("ScreenGui", Me.PlayerGui) screenGui.Name = "MenuGui" local dragFrame = Instance.new("Frame", screenGui) dragFrame.Size = UDim2.new(0, 300, 0, 200) dragFrame.Position = UDim2.new(0, 10, 0, 10) dragFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30) local toggleButton = Instance.new("TextButton", dragFrame) toggleButton.Size = UDim2.new(0, 140, 0, 50) toggleButton.Text = "Следовать: ВЫКЛ" toggleButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50) toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255) local distanceLabel = Instance.new("TextLabel", dragFrame) distanceLabel.Size = UDim2.new(1, 0, 0, 30) distanceLabel.Position = UDim2.new(0, 0, 0, 60) distanceLabel.Text = "Дистанция остановки: " .. STOP_DISTANCE distanceLabel.BackgroundColor3 = Color3.fromRGB(50, 50, 50) distanceLabel.TextColor3 = Color3.fromRGB(255, 255, 255) local distanceInput = Instance.new("TextBox", dragFrame) distanceInput.Size = UDim2.new(1, 0, 0, 30) distanceInput.Position = UDim2.new(0, 0, 0, 100) distanceInput.PlaceholderText = "Введите дистанцию" distanceInput.Text = tostring(STOP_DISTANCE) distanceInput.BackgroundColor3 = Color3.fromRGB(70, 70, 70) distanceInput.TextColor3 = Color3.fromRGB(255, 255, 255) local applyButton = Instance.new("TextButton", dragFrame) applyButton.Size = UDim2.new(1, 0, 0, 50) applyButton.Position = UDim2.new(0, 0, 0, 140) applyButton.Text = "Применить дистанцию" applyButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50) applyButton.TextColor3 = Color3.fromRGB(255, 255, 255) local menuVisible = true -- Движение с прыжками по физике local function moveToPosition(targetPos) if not (Me.Character and Me.Character:FindFirstChild("Humanoid") and Me.Character:FindFirstChild("HumanoidRootPart")) then return end local humanoid = Me.Character.Humanoid local root = Me.Character.HumanoidRootPart local direction = (targetPos - root.Position).Unit local ray = Ray.new(root.Position, direction * 3) local ignoreList = {Me.Character} for _, p in pairs(Players:GetPlayers()) do if p.Character then table.insert(ignoreList, p.Character) end end local hit = workspace:FindPartOnRayWithIgnoreList(ray, ignoreList) if hit and not hit:IsDescendantOf(Players) then humanoid.Jump = true -- Натуральный прыжок end humanoid:MoveTo(targetPos) end -- Поиск ближайшего игрока local function getClosestPlayer() local closestPlayer = nil local shortestDistance = math.huge if not Me.Character or not Me.Character:FindFirstChild("HumanoidRootPart") then return nil end local myPos = Me.Character.HumanoidRootPart.Position for _, player in pairs(Players:GetPlayers()) do if player ~= Me and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then local humanoid = player.Character:FindFirstChildOfClass("Humanoid") local forceField = player.Character:FindFirstChildOfClass("ForceField") if humanoid and humanoid.Health > 0 and not forceField then local plrPos = player.Character.HumanoidRootPart.Position local dist = (plrPos - myPos).Magnitude if (not isTeamGame or player.Team ~= myTeam) and dist < shortestDistance then shortestDistance = dist closestPlayer = player end end end end return closestPlayer end -- Основной цикл следования local function followLoop() while Me.Character and Me.Character:FindFirstChild("Humanoid") and following do local targetPlayer = getClosestPlayer() if targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then local myPos = Me.Character.HumanoidRootPart.Position local targetPos = targetPlayer.Character.HumanoidRootPart.Position local distance = (targetPos - myPos).Magnitude if distance > STOP_DISTANCE then moveToPosition(targetPos) else Me.Character.Humanoid:MoveTo(Me.Character.HumanoidRootPart.Position) end end wait(0.2) end end -- Обработчики toggleButton.MouseButton1Click:Connect(function() following = not following toggleButton.Text = following and "Следовать: ВКЛ" or "Следовать: ВЫКЛ" if following then followLoop() end end) applyButton.MouseButton1Click:Connect(function() local newDistance = tonumber(distanceInput.Text) if newDistance then STOP_DISTANCE = newDistance distanceLabel.Text = "Дистанция остановки: " .. STOP_DISTANCE end end) UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.RightShift then menuVisible = not menuVisible dragFrame.Visible = menuVisible end end) -- Проверка команд local function checkIfTeamsExist() local count = 0 for _, player in pairs(Players:GetPlayers()) do if player.Team then count += 1 end end return count > 1 end -- Постоянная проверка команд task.spawn(function() while true do wait(1) isTeamGame = checkIfTeamsExist() myTeam = Me.Team end end)