Open source fly script
Key RequiredUniversal

Open source fly script

Universal Scriptthelogger123thelogger123 1.4K views 599 executesUpdated May 18, 2026
5.0/ 5(2 votes)
20100% Positive
Lua Script•156 lines (4773 chars)
--[[ 
    PC-Friendly Fly Script + Safe Unstuck
    Toggle Fly: T
    Movement: WASD + Space (Up) + Ctrl (Down)
    Unstuck: Press U (if you get stuck)
]]

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera

local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local hrp = character:WaitForChild("HumanoidRootPart")

local flying = false
local flySpeed = 60

local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5)

local bodyGyro = Instance.new("BodyGyro")
bodyGyro.MaxTorque = Vector3.new(1e5, 1e5, 1e5)

-- Simple UI
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "PCFlyGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")

local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 200, 0, 70)
frame.Position = UDim2.new(0, 20, 0, 20)
frame.BackgroundColor3 = Color3.fromRGB(20, 20, 25)
frame.BackgroundTransparency = 0.25
frame.BorderSizePixel = 0
frame.Parent = screenGui

Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 12)
local stroke = Instance.new("UIStroke", frame)
stroke.Thickness = 1.8
stroke.Color = Color3.fromRGB(0, 180, 255)

local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, 0, 0.45, 0)
title.BackgroundTransparency = 1
title.Text = "FLY SCRIPT"
title.Font = Enum.Font.GothamBold
title.TextSize = 15
title.TextColor3 = Color3.fromRGB(0, 200, 255)
title.Parent = frame

local status = Instance.new("TextLabel")
status.Size = UDim2.new(1, 0, 0.55, 0)
status.Position = UDim2.new(0, 0, 0.45, 0)
status.BackgroundTransparency = 1
status.Text = "Press T to Toggle • U to Unstuck"
status.Font = Enum.Font.Gotham
status.TextSize = 12
status.TextColor3 = Color3.fromRGB(180, 180, 180)
status.Parent = frame

-- Functions
local function startFlying()
    flying = true
    bodyVelocity.Parent = hrp
    bodyGyro.Parent = hrp
    humanoid.PlatformStand = true
    status.Text = "FLYING - WASD + Space/Ctrl"
    status.TextColor3 = Color3.fromRGB(0, 255, 100)
end

local function stopFlying()
    flying = false
    bodyVelocity.Parent = nil
    bodyGyro.Parent = nil
    humanoid.PlatformStand = false
    status.Text = "Press T to Toggle • U to Unstuck"
    status.TextColor3 = Color3.fromRGB(180, 180, 180)
end

local function safeUnstuck()
    humanoid.PlatformStand = false
    humanoid.Sit = false
    humanoid:ChangeState(Enum.HumanoidStateType.Running)
    
    local animator = humanoid:FindFirstChild("Animator")
    if animator then
        for _, track in pairs(animator:GetPlayingAnimationTracks()) do
            track:Stop()
        end
    end
    
    hrp.CFrame = hrp.CFrame + Vector3.new(0, 5, 0)
    hrp.AssemblyLinearVelocity = Vector3.new(0, 15, 0)
    print("✅ Safe Unstuck Activated")
    status.Text = "UNSTUCK APPLIED"
    task.delay(1, function()
        if flying then
            status.Text = "FLYING - WASD + Space/Ctrl"
        else
            status.Text = "Press T to Toggle • U to Unstuck"
        end
    end)
end

-- Keybinds
UserInputService.InputBegan:Connect(function(input, gp)
    if gp then return end
    
    if input.KeyCode == Enum.KeyCode.T then
        if flying then
            stopFlying()
        else
            startFlying()
        end
    elseif input.KeyCode == Enum.KeyCode.U then
        safeUnstuck()
    end
end)

-- Flying Movement
RunService.RenderStepped:Connect(function()
    if not flying then return end

    local moveDir = Vector3.new(0, 0, 0)
    local camCF = camera.CFrame

    if UserInputService:IsKeyDown(Enum.KeyCode.W) then moveDir += camCF.LookVector end
    if UserInputService:IsKeyDown(Enum.KeyCode.S) then moveDir -= camCF.LookVector end
    if UserInputService:IsKeyDown(Enum.KeyCode.A) then moveDir -= camCF.RightVector end
    if UserInputService:IsKeyDown(Enum.KeyCode.D) then moveDir += camCF.RightVector end
    if UserInputService:IsKeyDown(Enum.KeyCode.Space) then moveDir += Vector3.new(0,1,0) end
    if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then moveDir -= Vector3.new(0,1,0) end

    if moveDir.Magnitude > 0 then
        moveDir = moveDir.Unit
    end

    bodyVelocity.Velocity = moveDir * flySpeed
    bodyGyro.CFrame = camCF
end)

-- Respawn Support
player.CharacterAdded:Connect(function(newChar)
    character = newChar
    humanoid = newChar:WaitForChild("Humanoid")
    hrp = newChar:WaitForChild("HumanoidRootPart")
    if flying then startFlying() end
end)

print("✅ PC Fly + Safe Unstuck Loaded | T = Fly | U = Unstuck")

Features & Information

My own fly script

Community Comments (1)

filo_ofilo_oMay 19, 2026

@thelogger123 Hii i tried ur script, my player is just stuck and cant move, i hope this helps😊

More Scripts for Universal Scripts