local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local humanoidRootPart = character:WaitForChild("HumanoidRootPart") -- Параметры для имитации падения local speed = 100 -- Скорость падения по земле local jumpSpeed = 100 -- Скорость падения вверх -- Таблица для отслеживания состояния клавиш local keyIsPressed = { W = false, A = false, S = false, D = false, Space = false } -- Флаг для включения/выключения падения local isFallingEnabled = true -- Функция для создания и обновления эффекта падения local function updateFalling() if not isFallingEnabled then return end -- Если падение выключено, не выполняем дальнейшую логику -- Получаем текущие векторы направления для падения local rootOrientation = humanoidRootPart.CFrame.LookVector -- Направление вперед local rightOrientation = humanoidRootPart.CFrame.RightVector -- Направление вправо local upOrientation = humanoidRootPart.CFrame.UpVector -- Направление вверх local fallDirection = Vector3.zero -- Направление падения по умолчанию (нет падения) -- Проверяем комбинации клавиш и устанавливаем соответствующее направление падения if keyIsPressed.W and keyIsPressed.A then fallDirection = rootOrientation + -rightOrientation + (keyIsPressed.Space and upOrientation or Vector3.zero) -- Влево-вперед + вверх (если Space) elseif keyIsPressed.W and keyIsPressed.D then fallDirection = rootOrientation + rightOrientation + (keyIsPressed.Space and upOrientation or Vector3.zero) -- Вправо-вперед + вверх (если Space) elseif keyIsPressed.S and keyIsPressed.A then fallDirection = -rootOrientation + -rightOrientation + (keyIsPressed.Space and upOrientation or Vector3.zero) -- Влево-назад + вверх (если Space) elseif keyIsPressed.S and keyIsPressed.D then fallDirection = -rootOrientation + rightOrientation + (keyIsPressed.Space and upOrientation or Vector3.zero) -- Вправо-назад + вверх (если Space) elseif keyIsPressed.W then fallDirection = rootOrientation + (keyIsPressed.Space and upOrientation or Vector3.zero) -- Вперед + вверх (если Space) elseif keyIsPressed.A then fallDirection = -rightOrientation + (keyIsPressed.Space and upOrientation or Vector3.zero) -- Влево + вверх (если Space) elseif keyIsPressed.S then fallDirection = -rootOrientation + (keyIsPressed.Space and upOrientation or Vector3.zero) -- Назад + вверх (если Space) elseif keyIsPressed.D then fallDirection = rightOrientation + (keyIsPressed.Space and upOrientation or Vector3.zero) -- Вправо + вверх (если Space) elseif keyIsPressed.Space then fallDirection = upOrientation -- Только вверх end -- Если падение активно, применяем силу if fallDirection.Magnitude > 0 then local bodyVelocity = humanoidRootPart:FindFirstChild("BodyVelocity") -- Если BodyVelocity не существует, создаем новый if not bodyVelocity then bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.MaxForce = Vector3.new(100000, 100000, 100000) -- Сила, влияющая на движение bodyVelocity.Velocity = fallDirection * (keyIsPressed.Space and jumpSpeed or speed) -- Направление падения bodyVelocity.Parent = humanoidRootPart else -- Обновляем существующий BodyVelocity bodyVelocity.Velocity = fallDirection * (keyIsPressed.Space and jumpSpeed or speed) end else -- Если клавиша не удерживается, убираем BodyVelocity local bodyVelocity = humanoidRootPart:FindFirstChild("BodyVelocity") if bodyVelocity then bodyVelocity:Destroy() end end end -- Обработчик нажатий клавиш local function onInputBegan(input) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.W then keyIsPressed.W = true elseif input.KeyCode == Enum.KeyCode.A then keyIsPressed.A = true elseif input.KeyCode == Enum.KeyCode.S then keyIsPressed.S = true elseif input.KeyCode == Enum.KeyCode.D then keyIsPressed.D = true elseif input.KeyCode == Enum.KeyCode.Space then keyIsPressed.Space = true end end end -- Обработчик отпускания клавиш local function onInputEnded(input) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.W then keyIsPressed.W = false elseif input.KeyCode == Enum.KeyCode.A then keyIsPressed.A = false elseif input.KeyCode == Enum.KeyCode.S then keyIsPressed.S = false elseif input.KeyCode == Enum.KeyCode.D then keyIsPressed.D = false elseif input.KeyCode == Enum.KeyCode.Space then keyIsPressed.Space = false end end end -- Основной цикл обновления падения game:GetService("RunService").Heartbeat:Connect(function() -- Обновляем падение каждый кадр, чтобы направление следовало за поворотом updateFalling() end) -- Подключаем обработчики событий game:GetService("UserInputService").InputBegan:Connect(onInputBegan) game:GetService("UserInputService").InputEnded:Connect(onInputEnded) -- Создание GUI local ScreenGui = Instance.new("ScreenGui") ScreenGui.Parent = player:WaitForChild("PlayerGui") local menuFrame = Instance.new("Frame") menuFrame.Size = UDim2.new(0, 200, 0, 150) menuFrame.Position = UDim2.new(0, 50, 0, 50) menuFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50) menuFrame.Parent = ScreenGui local toggleButton = Instance.new("TextButton") toggleButton.Size = UDim2.new(1, 0, 0.5, 0) toggleButton.Position = UDim2.new(0, 0, 0, 0) toggleButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) toggleButton.Text = "Disable Falling" toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255) toggleButton.Parent = menuFrame local dragFrame = Instance.new("Frame") dragFrame.Size = UDim2.new(1, 0, 0.5, 0) dragFrame.Position = UDim2.new(0, 0, 0.5, 0) dragFrame.BackgroundTransparency = 1 dragFrame.Parent = menuFrame local dragStart local startPos local isDragging = false -- Функция для начала перетаскивания меню menuFrame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then isDragging = true -- Начало перетаскивания dragStart = input.Position startPos = menuFrame.Position end end) -- Функция для перетаскивания меню menuFrame.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement and isDragging then local delta = input.Position - dragStart menuFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end) -- Функция для завершения перетаскивания menuFrame.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then isDragging = false -- Завершаем перетаскивание end end) -- Функция для переключения состояния падения toggleButton.MouseButton1Click:Connect(function() isFallingEnabled = not isFallingEnabled if isFallingEnabled then toggleButton.Text = "Disable Falling" toggleButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) else toggleButton.Text = "Enable Falling" toggleButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0) end end)