local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Workspace = game:GetService("Workspace") local TweenService = game:GetService("TweenService") local player = Players.LocalPlayer local camera = Workspace.CurrentCamera -- == НАСТРОЙКИ == local flightSpeed = 50 local isFlying = false local verticalMove = 0 -- -1 (вниз), 0 (нет), 1 (вверх) local connections = {} -- Цветовая палитра local COLORS = { BG = Color3.fromRGB(35, 35, 45), ACCENT_OFF = Color3.fromRGB(200, 60, 60), -- Красный ACCENT_ON = Color3.fromRGB(60, 200, 100), -- Зеленый BUTTON_BG = Color3.fromRGB(50, 50, 60), TEXT = Color3.fromRGB(240, 240, 240) } -- == СОЗДАНИЕ GUI (ИНТЕРФЕЙСА) == local screenGui = Instance.new("ScreenGui") screenGui.Name = "ProFlyGui" screenGui.ResetOnSpawn = false screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling screenGui.Parent = player:WaitForChild("PlayerGui") -- Главная панель (Контейнер) local mainFrame = Instance.new("Frame") mainFrame.Name = "MainPanel" mainFrame.Size = UDim2.new(0, 140, 0, 230) -- Начальная позиция (немного правее центра) mainFrame.Position = UDim2.new(0.7, 0, 0.4, 0) mainFrame.BackgroundColor3 = COLORS.BG mainFrame.BorderSizePixel = 0 mainFrame.Active = true -- Важно для перетаскивания mainFrame.Parent = screenGui -- Закругление углов local uiCorner = Instance.new("UICorner") uiCorner.CornerRadius = UDim.new(0, 12) uiCorner.Parent = mainFrame -- Обводка local uiStroke = Instance.new("UIStroke") uiStroke.Color = Color3.fromRGB(60, 60, 75) uiStroke.Thickness = 2 uiStroke.Parent = mainFrame -- Заголовок (для перетаскивания) local titleLabel = Instance.new("TextLabel") titleLabel.Size = UDim2.new(1, 0, 0, 30) titleLabel.BackgroundTransparency = 1 titleLabel.Text = ":: Fly Control ::" titleLabel.TextColor3 = COLORS.TEXT titleLabel.Font = Enum.Font.GothamBold titleLabel.TextSize = 14 titleLabel.Parent = mainFrame -- === Вспомогательная функция для стиля кнопок === local function styleElement(element) element.BackgroundColor3 = COLORS.BUTTON_BG element.TextColor3 = COLORS.TEXT element.Font = Enum.Font.GothamSemibold element.BorderSizePixel = 0 local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 8) corner.Parent = element end -- Кнопка FLY (Основной переключатель) local flyButton = Instance.new("TextButton") flyButton.Size = UDim2.new(0.9, 0, 0, 50) flyButton.Position = UDim2.new(0.05, 0, 0.15, 0) flyButton.Text = "FLY OFF" styleElement(flyButton) flyButton.BackgroundColor3 = COLORS.ACCENT_OFF flyButton.TextSize = 18 flyButton.Parent = mainFrame -- Поле скорости local speedInput = Instance.new("TextBox") speedInput.Size = UDim2.new(0.9, 0, 0, 35) speedInput.Position = UDim2.new(0.05, 0, 0.4, 0) speedInput.Text = tostring(flightSpeed) speedInput.PlaceholderText = "Speed..." styleElement(speedInput) speedInput.Parent = mainFrame local speedLabel = Instance.new("TextLabel") speedLabel.Size = UDim2.new(1, 0, 0, 15) speedLabel.Position = UDim2.new(0, 0, -0.5, 0) speedLabel.BackgroundTransparency = 1 speedLabel.Text = "Speed:" speedLabel.TextColor3 = Color3.fromRGB(180, 180, 180) speedLabel.Font = Enum.Font.Gotham speedLabel.TextSize = 12 speedLabel.Parent = speedInput -- Контейнер для кнопок Вверх/Вниз local verticalContainer = Instance.new("Frame") verticalContainer.Size = UDim2.new(0.9, 0, 0, 80) verticalContainer.Position = UDim2.new(0.05, 0, 0.6, 0) verticalContainer.BackgroundTransparency = 1 verticalContainer.Parent = mainFrame -- Кнопка ВВЕРХ local upButton = Instance.new("TextButton") upButton.Size = UDim2.new(1, 0, 0.45, 0) upButton.Position = UDim2.new(0, 0, 0, 0) upButton.Text = "▲ UP" styleElement(upButton) upButton.Parent = verticalContainer -- Кнопка ВНИЗ local downButton = Instance.new("TextButton") downButton.Size = UDim2.new(1, 0, 0.45, 0) downButton.Position = UDim2.new(0, 0, 0.55, 0) downButton.Text = "▼ DOWN" styleElement(downButton) downButton.Parent = verticalContainer -- == ЛОГИКА ПЕРЕТАСКИВАНИЯ ПАНЕЛИ (DRAGGING) == local dragging, dragInput, dragStart, startPos local function update(input) local delta = input.Position - dragStart mainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end mainFrame.InputBegan:Connect(function(input) -- Проверяем, что нажатие было левой кнопкой мыши или касанием if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then -- Не начинаем перетаскивание, если нажали на текстовое поле или кнопки if UserInputService:GetFocusedTextBox() == nil then dragging = true dragStart = input.Position startPos = mainFrame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end end) mainFrame.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then dragInput = input end end) UserInputService.InputChanged:Connect(function(input) if input == dragInput and dragging then update(input) end end) -- == ЛОГИКА ИНТЕРФЕЙСА == -- Обновление скорости speedInput.FocusLost:Connect(function(enterPressed) local num = tonumber(speedInput.Text) if num and num > 0 then flightSpeed = num else speedInput.Text = tostring(flightSpeed) end end) -- Обработка кнопок Вверх/Вниз (поддержка мультитача) local function setupVerticalButton(btn, directionValue) btn.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then verticalMove = directionValue TweenService:Create(btn, TweenInfo.new(0.1), {BackgroundColor3 = COLORS.ACCENT_ON}):Play() end end) btn.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then verticalMove = 0 TweenService:Create(btn, TweenInfo.new(0.1), {BackgroundColor3 = COLORS.BUTTON_BG}):Play() end end) end setupVerticalButton(upButton, 1) setupVerticalButton(downButton, -1) -- == ОСНОВНАЯ ЛОГИКА ПОЛЁТА == local function startFlying() local char = player.Character if not char then return end local hrp = char:WaitForChild("HumanoidRootPart") local humanoid = char:WaitForChild("Humanoid") isFlying = true flyButton.Text = "FLY ON" TweenService:Create(flyButton, TweenInfo.new(0.3), {BackgroundColor3 = COLORS.ACCENT_ON}):Play() hrp.Anchored = true humanoid.PlatformStand = true local runConnection = RunService.RenderStepped:Connect(function(deltaTime) if not isFlying or not char or not hrp then return end -- 1. Горизонтальное движение от джойстика/WASD -- MoveDirection уже учитывает поворот камеры по горизонтали local moveDir = humanoid.MoveDirection local horizontalShift = moveDir * flightSpeed * deltaTime -- 2. Вертикальное движение от кнопок -- Используем глобальный Vector3.yAxis (вверх в мире) local verticalShift = Vector3.yAxis * (verticalMove * flightSpeed * deltaTime) -- Итоговая позиция local newPosition = hrp.Position + horizontalShift + verticalShift -- Установка CFrame: новая позиция + поворот как у камеры hrp.CFrame = CFrame.new(newPosition) * camera.CFrame.Rotation end) table.insert(connections, runConnection) end local function stopFlying() isFlying = false flyButton.Text = "FLY OFF" TweenService:Create(flyButton, TweenInfo.new(0.3), {BackgroundColor3 = COLORS.ACCENT_OFF}):Play() local char = player.Character if char then local hrp = char:WaitForChild("HumanoidRootPart") local humanoid = char:WaitForChild("Humanoid") hrp.Anchored = false humanoid.PlatformStand = false hrp.Velocity = Vector3.zero -- Сброс инерции end verticalMove = 0 for _, conn in pairs(connections) do conn:Disconnect() end connections = {} end flyButton.MouseButton1Click:Connect(function() if isFlying then stopFlying() else startFlying() end end) player.CharacterAdded:Connect(function() stopFlying() end)