Skip to content
RoRoScripts
Epic fly gui preview
UnknownUniversal

Epic fly gui

Script
Universal ScriptEpic_Scripts
Views
1.4K
Likes
2
Dislikes
1
Added
Script
-- EPIC FLY GUI
-- LocalScript | StarterPlayer > StarterPlayerScripts

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

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local speed = 60
local flying = false
local vertical = 0
local flyConnection
local bodyVelocity
local bodyGyro
local humanoid
local oldAutoRotate
local destroyed = false

-- GUI
local gui = Instance.new("ScreenGui")
gui.Name = "EpicFlyGui"
gui.ResetOnSpawn = false
gui.Parent = playerGui

-- Main window
local frame = Instance.new("Frame")
frame.Name = "MainFrame"
frame.Size = UDim2.fromOffset(300, 255)
frame.Position = UDim2.new(0.5, -150, 0.5, -127)
frame.BackgroundColor3 = Color3.fromRGB(24, 24, 27)
frame.BorderSizePixel = 0
frame.ZIndex = 2
frame.Parent = gui

local mainCorner = Instance.new("UICorner")
mainCorner.CornerRadius = UDim.new(0, 10)
mainCorner.Parent = frame

local stroke = Instance.new("UIStroke")
stroke.Color = Color3.fromRGB(55, 58, 68)
stroke.Thickness = 1
stroke.Parent = frame

-- Black shadow, separate from the main window
local shadowHolder = Instance.new("Frame")
shadowHolder.Name = "ShadowHolder"
shadowHolder.AnchorPoint = Vector2.zero
shadowHolder.Size = UDim2.fromOffset(340, 295)
shadowHolder.Position = UDim2.new(0.5, -170, 0.5, -137)
shadowHolder.BackgroundTransparency = 1
shadowHolder.BorderSizePixel = 0
shadowHolder.ZIndex = 0
shadowHolder.Parent = gui

local function makeShadowLayer(padding, transparency)
    local layer = Instance.new("Frame")
    layer.Size = UDim2.new(1, padding, 1, padding)
    layer.Position = UDim2.new(
        0, -padding / 2,
        0, -padding / 2 + 5
    )
    layer.BackgroundColor3 = Color3.new(0, 0, 0)
    layer.BackgroundTransparency = transparency
    layer.BorderSizePixel = 0
    layer.ZIndex = 0
    layer.Parent = shadowHolder

    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0, 16 + padding / 4)
    corner.Parent = layer
end

makeShadowLayer(38, 0.82)
makeShadowLayer(28, 0.65)
makeShadowLayer(18, 0.43)
makeShadowLayer(8, 0.22)

-- Shadow follows the frame's position and size
local function updateShadow()
    shadowHolder.Position = UDim2.new(
        frame.Position.X.Scale,
        frame.Position.X.Offset - 20,
        frame.Position.Y.Scale,
        frame.Position.Y.Offset - 20
    )

    shadowHolder.Size = UDim2.new(
        frame.Size.X.Scale,
        frame.Size.X.Offset + 40,
        frame.Size.Y.Scale,
        frame.Size.Y.Offset + 40
    )
end

updateShadow()

frame:GetPropertyChangedSignal("Position"):Connect(updateShadow)
frame:GetPropertyChangedSignal("Size"):Connect(updateShadow)

-- Title bar
local titleBar = Instance.new("Frame")
titleBar.Name = "TitleBar"
titleBar.Size = UDim2.new(1, 0, 0, 40)
titleBar.BackgroundColor3 = Color3.fromRGB(32, 33, 38)
titleBar.BorderSizePixel = 0
titleBar.ZIndex = 3
titleBar.Parent = frame

local titleCorner = Instance.new("UICorner")
titleCorner.CornerRadius = UDim.new(0, 10)
titleCorner.Parent = titleBar

local titleCover = Instance.new("Frame")
titleCover.Size = UDim2.new(1, 0, 0, 10)
titleCover.Position = UDim2.new(0, 0, 1, -10)
titleCover.BackgroundColor3 = titleBar.BackgroundColor3
titleCover.BorderSizePixel = 0
titleCover.ZIndex = 3
titleCover.Parent = titleBar

local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, -50, 1, 0)
title.Position = UDim2.fromOffset(13, 0)
title.BackgroundTransparency = 1
title.Text = "Epic Fly GUI"
title.TextColor3 = Color3.fromRGB(235, 235, 240)
title.TextSize = 16
title.Font = Enum.Font.GothamMedium
title.TextXAlignment = Enum.TextXAlignment.Left
title.ZIndex = 4
title.Parent = titleBar

local closeButton = Instance.new("TextButton")
closeButton.Name = "CloseButton"
closeButton.Size = UDim2.fromOffset(30, 28)
closeButton.Position = UDim2.new(1, -35, 0, 6)
closeButton.BackgroundColor3 = Color3.fromRGB(65, 39, 42)
closeButton.Text = "X"
closeButton.TextColor3 = Color3.fromRGB(235, 190, 190)
closeButton.TextSize = 17
closeButton.Font = Enum.Font.Gotham
closeButton.BorderSizePixel = 0
closeButton.ZIndex = 4
closeButton.Parent = titleBar

Instance.new("UICorner", closeButton).CornerRadius =
    UDim.new(0, 6)

-- Smooth dragging; move the window and shadow together
local dragging = false
local dragStart
local startPosition
local activeDragInput
local dragTween
local shadowTween

titleBar.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1
        or input.UserInputType == Enum.UserInputType.Touch then

        dragging = true
        dragStart = input.Position
        startPosition = frame.Position
        activeDragInput = input

        if dragTween then dragTween:Cancel() end
        if shadowTween then shadowTween:Cancel() end
    end
end)

UIS.InputChanged:Connect(function(input)
    if not dragging then return end

    if input.UserInputType == Enum.UserInputType.MouseMovement
        or input.UserInputType == Enum.UserInputType.Touch then

        local delta = input.Position - dragStart

        local target = UDim2.new(
            startPosition.X.Scale,
            startPosition.X.Offset + delta.X,
            startPosition.Y.Scale,
            startPosition.Y.Offset + delta.Y
        )

        if dragTween then dragTween:Cancel() end

        dragTween = TweenService:Create(
            frame,
            TweenInfo.new(
                0.06,
                Enum.EasingStyle.Linear,
                Enum.EasingDirection.Out
            ),
            {Position = target}
        )
        dragTween:Play()
    end
end)

UIS.InputEnded:Connect(function(input)
    if input == activeDragInput then
        dragging = false
        activeDragInput = nil
    end

    if input.UserInputType == Enum.UserInputType.MouseButton1
        or input.UserInputType == Enum.UserInputType.Touch then
        vertical = 0
    end
end)

-- Buttons
local function makeButton(name, text, size, position, color)
    local button = Instance.new("TextButton")
    button.Name = name
    button.Size = size
    button.Position = position
    button.BackgroundColor3 = color
    button.BorderSizePixel = 0
    button.Text = text
    button.TextColor3 = Color3.fromRGB(245, 245, 245)
    button.TextSize = 14
    button.Font = Enum.Font.GothamMedium
    button.AutoButtonColor = false
    button.ZIndex = 3
    button.Parent = frame

    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0, 6)
    corner.Parent = button

    button.MouseEnter:Connect(function()
        TweenService:Create(button, TweenInfo.new(0.12), {
            BackgroundColor3 = color:Lerp(
                Color3.new(1, 1, 1), 0.08
            )
        }):Play()
    end)

    button.MouseLeave:Connect(function()
        TweenService:Create(button, TweenInfo.new(0.12), {
            BackgroundColor3 = color
        }):Play()
    end)

    return button
end

local flyButton = makeButton(
    "FlyButton", "Fly",
    UDim2.fromOffset(166, 36),
    UDim2.fromOffset(13, 51),
    Color3.fromRGB(48, 135, 91)
)

local stopButton = makeButton(
    "StopButton", "Stop",
    UDim2.fromOffset(166, 36),
    UDim2.fromOffset(13, 95),
    Color3.fromRGB(160, 60, 65)
)

-- Speed input
local speedLabel = Instance.new("TextLabel")
speedLabel.Size = UDim2.fromOffset(166, 18)
speedLabel.Position = UDim2.fromOffset(13, 140)
speedLabel.BackgroundTransparency = 1
speedLabel.Text = "FLIGHT SPEED"
speedLabel.TextColor3 = Color3.fromRGB(165, 168, 180)
speedLabel.TextSize = 11
speedLabel.Font = Enum.Font.GothamMedium
speedLabel.TextXAlignment = Enum.TextXAlignment.Left
speedLabel.ZIndex = 3
speedLabel.Parent = frame

local speedBox = Instance.new("TextBox")
speedBox.Name = "SpeedBox"
speedBox.Size = UDim2.fromOffset(166, 34)
speedBox.Position = UDim2.fromOffset(13, 161)
speedBox.BackgroundColor3 = Color3.fromRGB(37, 38, 44)
speedBox.BorderSizePixel = 0
speedBox.Text = "60"
speedBox.PlaceholderText = "Enter speed"
speedBox.TextColor3 = Color3.fromRGB(245, 245, 245)
speedBox.PlaceholderColor3 = Color3.fromRGB(135, 138, 150)
speedBox.TextSize = 14
speedBox.Font = Enum.Font.Gotham
speedBox.ClearTextOnFocus = false
speedBox.ZIndex = 3
speedBox.Parent = frame

Instance.new("UICorner", speedBox).CornerRadius =
    UDim.new(0, 6)

local speedStroke = Instance.new("UIStroke")
speedStroke.Color = Color3.fromRGB(60, 62, 72)
speedStroke.Thickness = 1
speedStroke.Parent = speedBox

local function updateSpeed()
    local value = tonumber(speedBox.Text)

    if value then
        speed = math.clamp(math.floor(value), 1, 500)
    end

    speedBox.Text = tostring(speed)
end

speedBox.FocusLost:Connect(updateSpeed)

-- Up / Down buttons
local upButton = makeButton(
    "UpButton", "▲\nUP",
    UDim2.fromOffset(82, 54),
    UDim2.fromOffset(199, 65),
    Color3.fromRGB(65, 95, 145)
)

local downButton = makeButton(
    "DownButton", "▼\nDOWN",
    UDim2.fromOffset(82, 54),
    UDim2.fromOffset(199, 130),
    Color3.fromRGB(95, 75, 130)
)

-- Flight cleanup
local function stopFlying()
    flying = false
    vertical = 0

    if flyConnection then
        flyConnection:Disconnect()
        flyConnection = nil
    end

    if bodyVelocity then
        bodyVelocity:Destroy()
        bodyVelocity = nil
    end

    if bodyGyro then
        bodyGyro:Destroy()
        bodyGyro = nil
    end

    if humanoid and humanoid.Parent then
        humanoid.AutoRotate =
            oldAutoRotate == nil and true or oldAutoRotate

        if humanoid.Health > 0 then
            humanoid:ChangeState(
                Enum.HumanoidStateType.GettingUp
            )
        end
    end
end

-- Start flying
local function startFlying()
    if flying or destroyed then return end

    updateSpeed()

    local character = player.Character
    if not character then return end

    humanoid = character:FindFirstChildOfClass("Humanoid")
    local root = character:FindFirstChild("HumanoidRootPart")

    if not humanoid or not root or humanoid.Health <= 0 then
        return
    end

    oldAutoRotate = humanoid.AutoRotate
    flying = true
    vertical = 0

    bodyVelocity = Instance.new("BodyVelocity")
    bodyVelocity.Name = "EpicFlyVelocity"
    bodyVelocity.MaxForce = Vector3.new(1e6, 1e6, 1e6)
    bodyVelocity.P = 15000
    bodyVelocity.Velocity = Vector3.zero
    bodyVelocity.Parent = root

    bodyGyro = Instance.new("BodyGyro")
    bodyGyro.Name = "EpicFlyGyro"
    bodyGyro.MaxTorque = Vector3.new(1e6, 1e6, 1e6)
    bodyGyro.P = 12000
    bodyGyro.D = 800
    bodyGyro.CFrame = root.CFrame
    bodyGyro.Parent = root

    humanoid.AutoRotate = false
    humanoid:ChangeState(Enum.HumanoidStateType.Physics)

    flyConnection = RunService.RenderStepped:Connect(function()
        if not flying or not root.Parent
            or not humanoid.Parent or humanoid.Health <= 0 then
            stopFlying()
            return
        end

        local camera = workspace.CurrentCamera
        if not camera then return end

        local move = Vector3.zero
        local look = camera.CFrame.LookVector
        local right = camera.CFrame.RightVector

        if UIS:IsKeyDown(Enum.KeyCode.W) then
            move += look
        end

        if UIS:IsKeyDown(Enum.KeyCode.S) then
            move -= look
        end

        if UIS:IsKeyDown(Enum.KeyCode.D) then
            move += right
        end

        if UIS:IsKeyDown(Enum.KeyCode.A) then
            move -= right
        end

        if UIS:IsKeyDown(Enum.KeyCode.Space) then
            move += Vector3.new(0, 1, 0)
        end

        if UIS:IsKeyDown(Enum.KeyCode.LeftControl) then
            move -= Vector3.new(0, 1, 0)
        end

        move += Vector3.new(0, vertical, 0)

        if move.Magnitude > 1 then
            move = move.Unit
        end

        bodyVelocity.Velocity = move * speed
        bodyGyro.CFrame = camera.CFrame
    end)
end

-- Hold Up / Down to move vertically
upButton.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1
        or input.UserInputType == Enum.UserInputType.Touch then
        vertical = 1
    end
end)

downButton.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1
        or input.UserInputType == Enum.UserInputType.Touch then
        vertical = -1
    end
end)

flyButton.Activated:Connect(startFlying)
stopButton.Activated:Connect(stopFlying)

-- Close button stops flight and destroys GUI
closeButton.Activated:Connect(function()
    if destroyed then return end
    destroyed = true

    stopFlying()

    if dragTween then
        dragTween:Cancel()
    end

    gui:Destroy()
end)

-- Clean up on respawn
player.CharacterAdded:Connect(function()
    stopFlying()
end)

Features

  • . Fly button
  • . Stop fly button
  • . Speed changer
  • . Up and down button