-- Инициализация сервисов local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera -- Конфигурация local FLY_SPEED = 50 local isFlying = false local noclipEnabled = false -- Создание GUI (графического интерфейса) local screenGui = Instance.new("ScreenGui") screenGui.Name = "FlightModule" screenGui.ResetOnSpawn = false screenGui.Parent = LocalPlayer:WaitForChild("PlayerGui") local toggleButton = Instance.new("TextButton") toggleButton.Size = UDim2.new(0, 100, 0, 30) toggleButton.Position = UDim2.new(0, 10, 0, 50) toggleButton.Text = "Flight: OFF" toggleButton.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2) toggleButton.TextColor3 = Color3.new(1, 1, 1) toggleButton.Parent = screenGui toggleButton.Draggable = true toggleButton.Active = true toggleButton.Selectable = true -- Функция Noclip (отключение коллизий) local function updateNoclip() if not noclipEnabled then return end local character = LocalPlayer.Character if character then for _, part in ipairs(character:GetChildren()) do if part:IsA("BasePart") then part.CanCollide = false end end end end -- Функция полета (физический метод через Velocity) local function fly() local character = LocalPlayer.Character if not character then return end local hrp = character:FindFirstChild("HumanoidRootPart") if not hrp then return end -- Расчет вектора движения на основе нажатых клавиш local moveDirection = Vector3.new() if UserInputService:IsKeyDown(Enum.KeyCode.W) then moveDirection = moveDirection + Camera.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.S) then moveDirection = moveDirection - Camera.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.D) then moveDirection = moveDirection + Camera.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.A) then moveDirection = moveDirection - Camera.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.Space) then moveDirection = moveDirection + Vector3.new(0, 1, 0) -- Вверх end if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then moveDirection = moveDirection + Vector3.new(0, -1, 0) -- Вниз end -- Применение скорости if moveDirection.Magnitude > 0 then -- Нормализуем вектор, чтобы сохранить скорость постоянной при диагональном движении hrp.Velocity = moveDirection.Unit * FLY_SPEED else hrp.Velocity = Vector3.new() -- Остановка, если клавиши не нажаты end end -- Обработчик нажатия кнопки GUI toggleButton.MouseButton1Click:Connect(function() isFlying = not isFlying noclipEnabled = isFlying -- Автоматически включаем noclip при полете (опционально) if isFlying then toggleButton.Text = "Flight: ON" toggleButton.BackgroundColor3 = Color3.new(0, 0.5, 0) else toggleButton.Text = "Flight: OFF" toggleButton.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2) end end) -- Главный цикл обновления (срабатывает каждый кадр) RunService.RenderStepped:Connect(function() if isFlying and LocalPlayer.Character then fly() updateNoclip() end end) -- Сброс скорости при повреждении персонажа или выходе из режима LocalPlayer.CharacterAdded:Connect(function() isFlying = false toggleButton.Text = "Flight: OFF" toggleButton.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2) end)