MY OWN FLY GUI
Key RequiredUniversal

MY OWN FLY GUI

Universal Script*inytt*inytt 3.6K views 42.5K executesUpdated Mar 26, 2026
Unrated
00
Lua Script•77 lines (2595 chars)
local ScreenGui = Instance.new("ScreenGui", game:GetService("CoreGui"))
local FlyBtn = Instance.new("TextButton", ScreenGui)
local UICorner = Instance.new("UICorner", FlyBtn)

-- GUI Setup
FlyBtn.Name = "CodexFlyButton"
FlyBtn.Size = UDim2.new(0, 90, 0, 45)
FlyBtn.Position = UDim2.new(0.05, 0, 0.45, 0)
FlyBtn.Text = "FLY: OFF"
FlyBtn.Draggable = true 
FlyBtn.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
FlyBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
FlyBtn.Font = Enum.Font.SourceSansBold
FlyBtn.TextSize = 16
UICorner.CornerRadius = UDim.new(0, 8)

local plr = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local flying = false
local speed = 70 

local function startFly()
    local char = plr.Character
    if not char then return end
    local root = char:WaitForChild("HumanoidRootPart")
    local hum = char:WaitForChild("Humanoid")
    
    local bv = Instance.new("BodyVelocity", root)
    bv.MaxForce = Vector3.new(1e6, 1e6, 1e6)
    bv.Velocity = Vector3.new(0, 0, 0)
    
    local bg = Instance.new("BodyGyro", root)
    bg.MaxTorque = Vector3.new(1e6, 1e6, 1e6)
    bg.P = 10000
    
    hum:ChangeState(Enum.HumanoidStateType.Swimming)

    task.spawn(function()
        while flying and char and root do
            local moveDir = hum.MoveDirection -- This is your Joystick input
            
            if moveDir.Magnitude > 0 then
                -- This math allows for Forward, Backward, and Side-to-Side
                -- It takes your joystick direction and applies it to your camera's angle
                local lookV = camera.CFrame.LookVector
                local rightV = camera.CFrame.RightVector
                
                -- We calculate the 3D direction based on the Joystick's relative input
                bv.Velocity = moveDir * speed
            else
                -- Stop instantly when joystick is let go
                bv.Velocity = Vector3.new(0, 0, 0) 
            end
            
            -- Keep the character upright and looking forward
            bg.CFrame = camera.CFrame
            hum:ChangeState(Enum.HumanoidStateType.Swimming)
            task.wait()
        end
        
        bv:Destroy()
        bg:Destroy()
        hum:ChangeState(Enum.HumanoidStateType.GettingUp)
    end)
end

FlyBtn.MouseButton1Click:Connect(function()
    flying = not flying
    if flying then
        FlyBtn.Text = "FLY: ON"
        FlyBtn.BackgroundColor3 = Color3.fromRGB(0, 200, 100)
        startFly()
    else
        FlyBtn.Text = "FLY: OFF"
        FlyBtn.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
    end
end)

Features & Information

Fly
#Fly

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts