Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-mini-2025-04-14· OpenAIAi2 WildChat-4.8M (AI2)

скинь скрипт на полет с scriptblox

  1. User

    скинь скрипт на полет с scriptblox

  2. Assistant

    Привет! Вот простой пример скрипта полёта для ScriptBlox (платформа Roblox), который ты можешь использовать и адаптировать под свои нужды.

    -- Скрипт полёта для ScriptBlox
    local player = game.Players.LocalPlayer
    local character = player.Character or player.CharacterAdded:Wait()
    local humanoid = character:WaitForChild("Humanoid")
    local uis = game:GetService("UserInputService")
    
    local flying = false
    local speed = 50
    local flightForce
    
    function startFly()
        if flying then return end
        flying = true
    
        local root = character:WaitForChild("HumanoidRootPart")
    
        flightForce = Instance.new("BodyGyro", root)
        flightForce.MaxTorque = Vector3.new(400000, 400000, 400000)
        flightForce.P = 9000
    
        local bodyVelocity = Instance.new("BodyVelocity", root)
        bodyVelocity.MaxForce = Vector3.new(400000, 400000, 400000)
        bodyVelocity.Velocity = Vector3.new(0, 0, 0)
    
        local function onRenderStep()
            if not flying then return end
    
            local camCFrame = workspace.CurrentCamera.CFrame
            local direction = Vector3.new(0, 0, 0)
    
            if uis:IsKeyDown(Enum.KeyCode.W) then
                direction = direction + camCFrame.LookVector
            end
            if uis:IsKeyDown(Enum.KeyCode.S) then
                direction = direction - camCFrame.LookVector
            end
            if uis:IsKeyDown(Enum.KeyCode.A) then
                direction = direction - camCFrame.RightVector
            end
            if uis:IsKeyDown(Enum.KeyCode.D) then
                direction = direction + camCFrame.RightVector
            end
            if uis:IsKeyDown(Enum.KeyCode.Space) then
                direction = direction + Vector3.new(0, 1, 0)
            end
            if uis:IsKeyDown(Enum.KeyCode.LeftControl) then
                direction = direction - Vector3.new(0, 1, 0)
            end
    
            direction = direction.Unit * speed
    
            bodyVelocity.Velocity = direction
            flightForce.CFrame = workspace.CurrentCamera.CFrame
        end
    
        game:GetService("RunService").RenderStepped:Connect(onRenderStep)
    end
    
    function stopFly()
        flying = false
        if flightForce then
            flightForce:Destroy()
            flightForce = nil
        end
        local root = character:FindFirstChild("HumanoidRootPart")
        if root then
            for _, v in pairs(root:GetChildren()) do
                if v:IsA("BodyVelocity") then
                    v:Destroy()
                end
            end
        end
    end
    
    uis.InputBegan:Connect(function(input, gameProcessed)
        if gameProcessed then return end
    
        if input.KeyCode == Enum.KeyCode.F then
            if flying then
                stopFly()
            else
                startFly()
            end
        end
    end)
    

    Как пользоваться:

    • Нажми клавишу F для включения/выключения полёта.
    • Управление полётом с помощью WASD для движения, Space для подъёма и Ctrl для спуска.

    Если хочешь, могу помочь с доработкой скрипта или объяснить, как его вставить в игру.