fly hd admin
Key RequiredUniversal

fly hd admin

Universal Scripttheblacktheblack 435 views 7.6K executesUpdated Oct 2, 2026
Unrated
00
Lua Script•818 lines (25836 chars)
-- HD Admin Fly Mobile - Slider de Velocidade Arrastável
-- Baseado no código-fonte oficial do HD Admin v2 (nanoblox/hd-admin)

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera

local function getSafeParent()
    local ok, hui = pcall(function() return gethui and gethui() or nil end)
    if ok and hui then return hui end
    local ok2, cg = pcall(function() return game:GetService("CoreGui") end)
    if ok2 and cg then return cg end
    return LocalPlayer:WaitForChild("PlayerGui")
end

local GuiParent = getSafeParent()

-- Configurações
local MIN_SPEED = 25
local MAX_SPEED = 200
local DEFAULT_SPEED = 50
local TILT_MAX = 25
local TILT_INCREMENT = 1
local FLY_HEIGHT_OFFSET = 4

local C = {
    Bg = Color3.fromRGB(16, 16, 22),
    Surface = Color3.fromRGB(24, 24, 32),
    SurfaceHi = Color3.fromRGB(34, 34, 46),
    Primary = Color3.fromRGB(0, 170, 255),
    PrimaryDark = Color3.fromRGB(0, 110, 190),
    Success = Color3.fromRGB(0, 200, 120),
    SuccessDark = Color3.fromRGB(0, 150, 90),
    Danger = Color3.fromRGB(240, 70, 90),
    DangerDark = Color3.fromRGB(190, 50, 70),
    TextMain = Color3.fromRGB(240, 242, 250),
    TextSub = Color3.fromRGB(150, 155, 175),
    Border = Color3.fromRGB(48, 48, 62),
}

local flying = false
local speed = DEFAULT_SPEED
local flyForce, bodyGyro
local flyConnection
local upPressed, downPressed = false, false
local tiltAmount = 0
local flyMode = 1 -- 1 = fly, 2 = fly2 (sentado)

pcall(function()
    local old = GuiParent:FindFirstChild("HDAdminFlyMobile")
    if old then old:Destroy() end
end)

local function round(obj, r)
    local c = Instance.new("UICorner")
    c.CornerRadius = UDim.new(0, r or 8)
    c.Parent = obj
    return c
end

local function circle(obj)
    local c = Instance.new("UICorner")
    c.CornerRadius = UDim.new(1, 0)
    c.Parent = obj
    return c
end

local function addStroke(obj, color, thickness, transparency)
    local s = Instance.new("UIStroke")
    s.Color = color or C.Border
    s.Thickness = thickness or 1
    s.Transparency = transparency or 0.3
    s.Parent = obj
    return s
end

local function addGradient(obj, c1, c2, rot)
    local g = Instance.new("UIGradient")
    g.Color = ColorSequence.new(c1, c2)
    g.Rotation = rot or 90
    g.Parent = obj
    return g
end

local function tw(obj, time, props, style, dir)
    local info = TweenInfo.new(time or 0.25, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out)
    local t = TweenService:Create(obj, info, props)
    t:Play()
    return t
end

-- GUI
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "HDAdminFlyMobile"
ScreenGui.ResetOnSpawn = false
ScreenGui.IgnoreGuiInset = true
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.Parent = GuiParent

-- Botão flutuante
local ToggleBtn = Instance.new("TextButton")
ToggleBtn.Name = "ToggleBtn"
ToggleBtn.Size = UDim2.new(0, 58, 0, 58)
ToggleBtn.Position = UDim2.new(0, 18, 0.5, -29)
ToggleBtn.BackgroundColor3 = C.Surface
ToggleBtn.BorderSizePixel = 0
ToggleBtn.Text = ""
ToggleBtn.AutoButtonColor = false
ToggleBtn.Parent = ScreenGui
circle(ToggleBtn)
addStroke(ToggleBtn, C.Primary, 1.5, 0.2)
addGradient(ToggleBtn, C.SurfaceHi, C.Surface, 45)

local ToggleIcon = Instance.new("TextLabel")
ToggleIcon.Size = UDim2.new(1, 0, 1, 0)
ToggleIcon.BackgroundTransparency = 1
ToggleIcon.Text = "FLY"
ToggleIcon.TextColor3 = C.Primary
ToggleIcon.TextSize = 15
ToggleIcon.Font = Enum.Font.GothamBold
ToggleIcon.Parent = ToggleBtn

-- Painel principal (retangular)
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(0, 300, 0, 240)
MainFrame.Position = UDim2.new(0.5, -150, 0.5, -120)
MainFrame.BackgroundColor3 = C.Bg
MainFrame.BorderSizePixel = 0
MainFrame.Visible = false
MainFrame.ClipsDescendants = true
MainFrame.Parent = ScreenGui
round(MainFrame, 12)
addStroke(MainFrame, C.Primary, 1.5, 0.55)
addGradient(MainFrame, C.Surface, C.Bg, 90)

-- Cabeçalho
local Header = Instance.new("Frame")
Header.Name = "Header"
Header.Size = UDim2.new(1, 0, 0, 40)
Header.BackgroundColor3 = C.Primary
Header.BorderSizePixel = 0
Header.Parent = MainFrame
round(Header, 12)
addGradient(Header, C.Primary, C.PrimaryDark, 90)

local HeaderFix = Instance.new("Frame")
HeaderFix.Size = UDim2.new(1, 0, 0, 12)
HeaderFix.Position = UDim2.new(0, 0, 1, -12)
HeaderFix.BackgroundColor3 = C.PrimaryDark
HeaderFix.BorderSizePixel = 0
HeaderFix.ZIndex = 0
HeaderFix.Parent = Header

local HeaderTitle = Instance.new("TextLabel")
HeaderTitle.Size = UDim2.new(1, -110, 1, 0)
HeaderTitle.Position = UDim2.new(0, 14, 0, 0)
HeaderTitle.BackgroundTransparency = 1
HeaderTitle.Text = "HD ADMIN | FLY"
HeaderTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
HeaderTitle.TextSize = 15
HeaderTitle.Font = Enum.Font.GothamBold
HeaderTitle.TextXAlignment = Enum.TextXAlignment.Left
HeaderTitle.ZIndex = 2
HeaderTitle.Parent = Header

local MinBtn = Instance.new("TextButton")
MinBtn.Size = UDim2.new(0, 26, 0, 26)
MinBtn.Position = UDim2.new(1, -62, 0, 7)
MinBtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
MinBtn.BackgroundTransparency = 0.85
MinBtn.BorderSizePixel = 0
MinBtn.Text = "-"
MinBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
MinBtn.TextSize = 18
MinBtn.Font = Enum.Font.GothamBold
MinBtn.AutoButtonColor = false
MinBtn.ZIndex = 3
MinBtn.Parent = Header
circle(MinBtn)

local CloseBtn = Instance.new("TextButton")
CloseBtn.Size = UDim2.new(0, 26, 0, 26)
CloseBtn.Position = UDim2.new(1, -32, 0, 7)
CloseBtn.BackgroundColor3 = C.Danger
CloseBtn.BorderSizePixel = 0
CloseBtn.Text = "X"
CloseBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
CloseBtn.TextSize = 14
CloseBtn.Font = Enum.Font.GothamBold
CloseBtn.AutoButtonColor = false
CloseBtn.ZIndex = 3
CloseBtn.Parent = Header
circle(CloseBtn)

-- ============================================================
-- CARD DE VELOCIDADE COM SLIDER ARRASTÁVEL
-- ============================================================
local SpeedCard = Instance.new("Frame")
SpeedCard.Size = UDim2.new(1, -20, 0, 62)
SpeedCard.Position = UDim2.new(0, 10, 0, 48)
SpeedCard.BackgroundColor3 = C.Surface
SpeedCard.BorderSizePixel = 0
SpeedCard.Parent = MainFrame
round(SpeedCard, 8)
addStroke(SpeedCard, C.Border, 1, 0.5)

local SpeedTitle = Instance.new("TextLabel")
SpeedTitle.Size = UDim2.new(0, 100, 0, 16)
SpeedTitle.Position = UDim2.new(0, 10, 0, 6)
SpeedTitle.BackgroundTransparency = 1
SpeedTitle.Text = "VELOCIDADE"
SpeedTitle.TextColor3 = C.TextSub
SpeedTitle.TextSize = 10
SpeedTitle.Font = Enum.Font.GothamBold
SpeedTitle.TextXAlignment = Enum.TextXAlignment.Left
SpeedTitle.Parent = SpeedCard

local SpeedValue = Instance.new("TextLabel")
SpeedValue.Size = UDim2.new(0, 80, 0, 20)
SpeedValue.Position = UDim2.new(1, -90, 0, 4)
SpeedValue.BackgroundTransparency = 1
SpeedValue.Text = tostring(DEFAULT_SPEED)
SpeedValue.TextColor3 = C.Primary
SpeedValue.TextSize = 18
SpeedValue.Font = Enum.Font.GothamBold
SpeedValue.TextXAlignment = Enum.TextXAlignment.Right
SpeedValue.Parent = SpeedCard

-- Slider track
local SliderBg = Instance.new("Frame")
SliderBg.Size = UDim2.new(1, -20, 0, 8)
SliderBg.Position = UDim2.new(0, 10, 0, 40)
SliderBg.BackgroundColor3 = C.SurfaceHi
SliderBg.BorderSizePixel = 0
SliderBg.Parent = SpeedCard
round(SliderBg, 4)

-- Preenchimento do slider
local SliderFill = Instance.new("Frame")
SliderFill.Size = UDim2.new((DEFAULT_SPEED - MIN_SPEED) / (MAX_SPEED - MIN_SPEED), 0, 1, 0)
SliderFill.BackgroundColor3 = C.Primary
SliderFill.BorderSizePixel = 0
SliderFill.Parent = SliderBg
round(SliderFill, 4)
addGradient(SliderFill, C.Primary, Color3.fromRGB(120, 220, 255), 0)

-- Botão (thumb) do slider
local SliderThumb = Instance.new("TextButton")
SliderThumb.Size = UDim2.new(0, 18, 0, 18)
SliderThumb.Position = UDim2.new((DEFAULT_SPEED - MIN_SPEED) / (MAX_SPEED - MIN_SPEED), -9, 0.5, -9)
SliderThumb.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
SliderThumb.BorderSizePixel = 0
SliderThumb.Text = ""
SliderThumb.AutoButtonColor = false
SliderThumb.Parent = SliderBg
circle(SliderThumb)
addStroke(SliderThumb, C.Primary, 2, 0)

-- Área de toque estendida (para facilitar o arrasto)
local SliderTouch = Instance.new("TextButton")
SliderTouch.Size = UDim2.new(1, 0, 0, 40)
SliderTouch.Position = UDim2.new(0, 0, 0.5, -20)
SliderTouch.BackgroundTransparency = 1
SliderTouch.Text = ""
SliderTouch.Parent = SliderBg

-- Labels min/max
local MinLabel = Instance.new("TextLabel")
MinLabel.Size = UDim2.new(0, 30, 0, 12)
MinLabel.Position = UDim2.new(0, 10, 0, 48)
MinLabel.BackgroundTransparency = 1
MinLabel.Text = tostring(MIN_SPEED)
MinLabel.TextColor3 = C.TextSub
MinLabel.TextSize = 9
MinLabel.Font = Enum.Font.GothamBold
MinLabel.TextXAlignment = Enum.TextXAlignment.Left
MinLabel.Parent = SpeedCard

local MaxLabel = Instance.new("TextLabel")
MaxLabel.Size = UDim2.new(0, 30, 0, 12)
MaxLabel.Position = UDim2.new(1, -40, 0, 48)
MaxLabel.BackgroundTransparency = 1
MaxLabel.Text = tostring(MAX_SPEED)
MaxLabel.TextColor3 = C.TextSub
MaxLabel.TextSize = 9
MaxLabel.Font = Enum.Font.GothamBold
MaxLabel.TextXAlignment = Enum.TextXAlignment.Right
MaxLabel.Parent = SpeedCard

-- ============================================================
-- LÓGICA DO SLIDER
-- ============================================================
local draggingSlider = false

local function updateSpeedFromPosition(inputX)
    local trackAbsolutePos = SliderBg.AbsolutePosition.X
    local trackAbsoluteSize = SliderBg.AbsoluteSize.X
    if trackAbsoluteSize <= 0 then return end

    local relativeX = math.clamp((inputX - trackAbsolutePos) / trackAbsoluteSize, 0, 1)
    local newSpeed = math.floor(MIN_SPEED + relativeX * (MAX_SPEED - MIN_SPEED) + 0.5)
    newSpeed = math.clamp(newSpeed, MIN_SPEED, MAX_SPEED)

    speed = newSpeed
    SpeedValue.Text = tostring(newSpeed)
    local fillScale = (newSpeed - MIN_SPEED) / (MAX_SPEED - MIN_SPEED)
    SliderFill.Size = UDim2.new(fillScale, 0, 1, 0)
    SliderThumb.Position = UDim2.new(fillScale, -9, 0.5, -9)
end

-- Toque/clique na área do slider
SliderTouch.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch
       or input.UserInputType == Enum.UserInputType.MouseButton1 then
        draggingSlider = true
        updateSpeedFromPosition(input.Position.X)
    end
end)

SliderTouch.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch
       or input.UserInputType == Enum.UserInputType.MouseButton1 then
        draggingSlider = false
    end
end)

-- Thumb também arrasta
SliderThumb.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch
       or input.UserInputType == Enum.UserInputType.MouseButton1 then
        draggingSlider = true
    end
end)

SliderThumb.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch
       or input.UserInputType == Enum.UserInputType.MouseButton1 then
        draggingSlider = false
    end
end)

-- Movimento global (touch e mouse)
UserInputService.InputChanged:Connect(function(input)
    if draggingSlider then
        if input.UserInputType == Enum.UserInputType.Touch
           or input.UserInputType == Enum.UserInputType.MouseMovement then
            updateSpeedFromPosition(input.Position.X)
        end
    end
end)

UserInputService.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch
       or input.UserInputType == Enum.UserInputType.MouseButton1 then
        draggingSlider = false
    end
end)

-- ============================================================
-- BOTÃO ATIVAR / DESATIVAR
-- ============================================================
local FlyBtn = Instance.new("TextButton")
FlyBtn.Size = UDim2.new(1, -20, 0, 40)
FlyBtn.Position = UDim2.new(0, 10, 0, 118)
FlyBtn.BackgroundColor3 = C.Success
FlyBtn.BorderSizePixel = 0
FlyBtn.Text = "ATIVAR FLY"
FlyBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
FlyBtn.TextSize = 14
FlyBtn.Font = Enum.Font.GothamBold
FlyBtn.AutoButtonColor = false
FlyBtn.Parent = MainFrame
round(FlyBtn, 8)
local FlyGradient = addGradient(FlyBtn, C.Success, C.SuccessDark, 90)

-- Seletor de modo
local ModeLabel = Instance.new("TextLabel")
ModeLabel.Size = UDim2.new(0, 40, 0, 14)
ModeLabel.Position = UDim2.new(0, 10, 0, 164)
ModeLabel.BackgroundTransparency = 1
ModeLabel.Text = "MODO"
ModeLabel.TextColor3 = C.TextSub
ModeLabel.TextSize = 9
ModeLabel.Font = Enum.Font.GothamBold
ModeLabel.TextXAlignment = Enum.TextXAlignment.Left
ModeLabel.Parent = MainFrame

local ModeRow = Instance.new("Frame")
ModeRow.Size = UDim2.new(1, -20, 0, 28)
ModeRow.Position = UDim2.new(0, 10, 0, 178)
ModeRow.BackgroundTransparency = 1
ModeRow.Parent = MainFrame

local ModeLayout = Instance.new("UIListLayout")
ModeLayout.FillDirection = Enum.FillDirection.Horizontal
ModeLayout.Padding = UDim.new(0, 6)
ModeLayout.HorizontalAlignment = Enum.HorizontalAlignment.Left
ModeLayout.Parent = ModeRow

local ModeBtn1 = Instance.new("TextButton")
ModeBtn1.Size = UDim2.new(0, 90, 1, 0)
ModeBtn1.BackgroundColor3 = C.Primary
ModeBtn1.BorderSizePixel = 0
ModeBtn1.Text = "FLY"
ModeBtn1.TextColor3 = Color3.fromRGB(255, 255, 255)
ModeBtn1.TextSize = 12
ModeBtn1.Font = Enum.Font.GothamBold
ModeBtn1.AutoButtonColor = false
ModeBtn1.Parent = ModeRow
round(ModeBtn1, 6)
addStroke(ModeBtn1, C.Border, 1, 0.5)

local ModeBtn2 = Instance.new("TextButton")
ModeBtn2.Size = UDim2.new(0, 90, 1, 0)
ModeBtn2.BackgroundColor3 = C.SurfaceHi
ModeBtn2.BorderSizePixel = 0
ModeBtn2.Text = "FLY2 (sentado)"
ModeBtn2.TextColor3 = C.TextSub
ModeBtn2.TextSize = 12
ModeBtn2.Font = Enum.Font.GothamBold
ModeBtn2.AutoButtonColor = false
ModeBtn2.Parent = ModeRow
round(ModeBtn2, 6)
addStroke(ModeBtn2, C.Border, 1, 0.5)

-- Presets rápidos
local PresetsRow = Instance.new("Frame")
PresetsRow.Size = UDim2.new(1, -20, 0, 22)
PresetsRow.Position = UDim2.new(0, 10, 0, 210)
PresetsRow.BackgroundTransparency = 1
PresetsRow.Parent = MainFrame

local PresetsLayout = Instance.new("UIListLayout")
PresetsLayout.FillDirection = Enum.FillDirection.Horizontal
PresetsLayout.Padding = UDim.new(0, 4)
PresetsLayout.HorizontalAlignment = Enum.HorizontalAlignment.Left
PresetsLayout.Parent = PresetsRow

local presetValues = {25, 50, 100, 150, 200}
local presetBtns = {}

for _, spd in ipairs(presetValues) do
    local btn = Instance.new("TextButton")
    btn.Size = UDim2.new(0, 52, 1, 0)
    btn.BackgroundColor3 = C.SurfaceHi
    btn.BorderSizePixel = 0
    btn.Text = tostring(spd)
    btn.TextColor3 = C.TextSub
    btn.TextSize = 11
    btn.Font = Enum.Font.GothamBold
    btn.AutoButtonColor = false
    btn.Parent = PresetsRow
    round(btn, 6)
    addStroke(btn, C.Border, 1, 0.5)

    btn.MouseButton1Click:Connect(function()
        speed = spd
        SpeedValue.Text = tostring(spd)
        local fillScale = (spd - MIN_SPEED) / (MAX_SPEED - MIN_SPEED)
        SliderFill.Size = UDim2.new(fillScale, 0, 1, 0)
        SliderThumb.Position = UDim2.new(fillScale, -9, 0.5, -9)
    end)
    table.insert(presetBtns, btn)
end

-- Botões subir/descer (compactos, canto inferior direito)
local UpBtn = Instance.new("TextButton")
UpBtn.Size = UDim2.new(0, 40, 0, 40)
UpBtn.Position = UDim2.new(1, -56, 1, -100)
UpBtn.BackgroundColor3 = C.Primary
UpBtn.BackgroundTransparency = 0.15
UpBtn.BorderSizePixel = 0
UpBtn.Text = "▲"
UpBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
UpBtn.TextSize = 16
UpBtn.Font = Enum.Font.GothamBold
UpBtn.AutoButtonColor = false
UpBtn.Visible = false
UpBtn.Parent = ScreenGui
circle(UpBtn)
addStroke(UpBtn, C.Primary, 2, 0.3)

local DownBtn = Instance.new("TextButton")
DownBtn.Size = UDim2.new(0, 40, 0, 40)
DownBtn.Position = UDim2.new(1, -56, 1, -56)
DownBtn.BackgroundColor3 = C.Primary
DownBtn.BackgroundTransparency = 0.15
DownBtn.BorderSizePixel = 0
DownBtn.Text = "▼"
DownBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
DownBtn.TextSize = 16
DownBtn.Font = Enum.Font.GothamBold
DownBtn.AutoButtonColor = false
DownBtn.Visible = false
DownBtn.Parent = ScreenGui
circle(DownBtn)
addStroke(DownBtn, C.Primary, 2, 0.3)

-- Mecânica de voo
local function getHRP()
    local char = LocalPlayer.Character
    return char and char:FindFirstChild("HumanoidRootPart")
end

local function getHumanoid()
    local char = LocalPlayer.Character
    return char and char:FindFirstChildOfClass("Humanoid")
end

local DIRECTIONS = {
    Left = Vector3.new(-1, 0, 0),
    Right = Vector3.new(1, 0, 0),
    Forwards = Vector3.new(0, 0, -1),
    Backwards = Vector3.new(0, 0, 1),
    Up = Vector3.new(0, 1, 0),
    Down = Vector3.new(0, -1, 0)
}

local function getCF(part, isFor)
    local cframe = part.CFrame
    local noRot = CFrame.new(cframe.p)
    local x, y, z = (Camera.CFrame - Camera.CFrame.p):toEulerAnglesXYZ()
    return noRot * CFrame.Angles(isFor and z or x, y, z)
end

local function getNextMovement(deltaTime, spd)
    local nextMove = Vector3.new()
    local humanoid = getHumanoid()
    local hrp = getHRP()
    if not humanoid or not hrp then return CFrame.new(), nextMove end

    local md = humanoid.MoveDirection

    for dirName, vector in pairs(DIRECTIONS) do
        local isFor = (dirName == "Forwards" or dirName == "Backwards")
        local worldVector = ((getCF(hrp, isFor) * CFrame.new(vector)) - hrp.CFrame.p).p
        if (worldVector - md).magnitude <= 1.05 and md ~= Vector3.new(0, 0, 0) then
            nextMove = nextMove + vector
        end
    end

    if upPressed then nextMove = nextMove + Vector3.new(0, 1, 0) end
    if downPressed then nextMove = nextMove + Vector3.new(0, -1, 0) end

    return CFrame.new(nextMove * spd * deltaTime), nextMove
end

local function applySitAnim(humanoid)
    if not humanoid then return end
    humanoid.Sit = true
    humanoid.PlatformStand = false
end

local function removeSitAnim(humanoid)
    if not humanoid then return end
    humanoid.Sit = false
end

local function startFly()
    local hrp = getHRP()
    local humanoid = getHumanoid()
    if not hrp or not humanoid then return end

    flying = true
    tiltAmount = 0

    flyForce = Instance.new("BodyPosition")
    flyForce.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
    flyForce.Position = hrp.Position + Vector3.new(0, FLY_HEIGHT_OFFSET, 0)
    flyForce.Name = "HDAdminFlyForce"
    flyForce.Parent = hrp

    bodyGyro = Instance.new("BodyGyro")
    bodyGyro.D = 50
    bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
    bodyGyro.P = 200
    bodyGyro.Name = "HDAdminFlyGyro"
    bodyGyro.CFrame = hrp.CFrame
    bodyGyro.Parent = hrp

    if flyMode == 2 then
        applySitAnim(humanoid)
    end

    local lastUpdate = tick()
    local lastPosition = hrp.Position
    local static = 0

    flyConnection = RunService.RenderStepped:Connect(function()
        if not flying then return end

        local currentHrp = getHRP()
        local currentHumanoid = getHumanoid()
        if not currentHrp or not currentHumanoid then return end

        local delta = tick() - lastUpdate
        local look = (Camera.Focus.p - Camera.CFrame.p).unit
        local move, directionalVector = getNextMovement(delta, speed * 10)

        local pos = currentHrp.Position
        local targetCFrame = CFrame.new(pos, pos + look) * move
        local targetD = 750 + (speed * 0.2)

        if move.p ~= Vector3.new() then
            static = 0
            flyForce.D = targetD
            tiltAmount = tiltAmount + TILT_INCREMENT
            flyForce.Position = targetCFrame.p
        else
            static = static + 1
            tiltAmount = 1
            local mag = (currentHrp.Position - lastPosition).magnitude
            if mag > 6 and static >= 4 then
                flyForce.Position = currentHrp.Position
            end
        end

        if math.abs(tiltAmount) > TILT_MAX then
            tiltAmount = TILT_MAX
        end

        if flyForce.D == targetD then
            local tiltZ = tiltAmount * directionalVector.Z
            bodyGyro.CFrame = targetCFrame * CFrame.Angles(math.rad(tiltZ), 0, 0)
        end

        lastUpdate = tick()
        lastPosition = currentHrp.Position

        if flyMode == 2 then
            if not currentHumanoid.Sit then
                currentHumanoid.Sit = true
            end
            currentHumanoid.PlatformStand = false
        else
            currentHumanoid.PlatformStand = true
            currentHumanoid.Sit = false
        end
    end)
end

local function stopFly()
    flying = false

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

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

    local humanoid = getHumanoid()
    if humanoid then
        humanoid.PlatformStand = false
        humanoid.Sit = false
        removeSitAnim(humanoid)
    end

    upPressed = false
    downPressed = false
end

FlyBtn.MouseButton1Click:Connect(function()
    if flying then
        stopFly()
        FlyBtn.Text = "ATIVAR FLY"
        FlyGradient.Color = ColorSequence.new(C.Success, C.SuccessDark)
        tw(FlyBtn, 0.2, {BackgroundColor3 = C.Success})
        UpBtn.Visible = false
        DownBtn.Visible = false
    else
        startFly()
        FlyBtn.Text = "DESATIVAR FLY"
        FlyGradient.Color = ColorSequence.new(C.Danger, C.DangerDark)
        tw(FlyBtn, 0.2, {BackgroundColor3 = C.Danger})
        UpBtn.Visible = true
        DownBtn.Visible = true
    end
end)

FlyBtn.MouseEnter:Connect(function()
    tw(FlyBtn, 0.15, {BackgroundTransparency = 0.1})
end)
FlyBtn.MouseLeave:Connect(function()
    tw(FlyBtn, 0.15, {BackgroundTransparency = 0})
end)

UpBtn.MouseButton1Down:Connect(function()
    upPressed = true
    tw(UpBtn, 0.1, {BackgroundTransparency = 0})
end)
UpBtn.MouseButton1Up:Connect(function()
    upPressed = false
    tw(UpBtn, 0.15, {BackgroundTransparency = 0.15})
end)
UpBtn.MouseLeave:Connect(function()
    upPressed = false
    tw(UpBtn, 0.15, {BackgroundTransparency = 0.15})
end)

DownBtn.MouseButton1Down:Connect(function()
    downPressed = true
    tw(DownBtn, 0.1, {BackgroundTransparency = 0})
end)
DownBtn.MouseButton1Up:Connect(function()
    downPressed = false
    tw(DownBtn, 0.15, {BackgroundTransparency = 0.15})
end)
DownBtn.MouseLeave:Connect(function()
    downPressed = false
    tw(DownBtn, 0.15, {BackgroundTransparency = 0.15})
end)

ModeBtn1.MouseButton1Click:Connect(function()
    if flying then stopFly() end
    flyMode = 1
    tw(ModeBtn1, 0.15, {BackgroundColor3 = C.Primary, TextColor3 = Color3.fromRGB(255,255,255)})
    tw(ModeBtn2, 0.15, {BackgroundColor3 = C.SurfaceHi, TextColor3 = C.TextSub})
end)

ModeBtn2.MouseButton1Click:Connect(function()
    if flying then stopFly() end
    flyMode = 2
    tw(ModeBtn2, 0.15, {BackgroundColor3 = C.Primary, TextColor3 = Color3.fromRGB(255,255,255)})
    tw(ModeBtn1, 0.15, {BackgroundColor3 = C.SurfaceHi, TextColor3 = C.TextSub})
end)

local function openPanel()
    MainFrame.Visible = true
    MainFrame.Size = UDim2.new(0, 0, 0, 0)
    MainFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
    MainFrame.BackgroundTransparency = 1
    tw(MainFrame, 0.35, {
        Size = UDim2.new(0, 300, 0, 240),
        Position = UDim2.new(0.5, -150, 0.5, -120),
        BackgroundTransparency = 0
    }, Enum.EasingStyle.Back, Enum.EasingDirection.Out)
end

local function closePanel()
    local t = tw(MainFrame, 0.25, {
        Size = UDim2.new(0, 0, 0, 0),
        Position = UDim2.new(0.5, 0, 0.5, 0),
        BackgroundTransparency = 1
    }, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
    t.Completed:Connect(function()
        MainFrame.Visible = false
    end)
end

ToggleBtn.MouseButton1Click:Connect(function()
    if MainFrame.Visible then
        closePanel()
    else
        openPanel()
    end
    tw(ToggleBtn, 0.15, {Size = UDim2.new(0, 50, 0, 50)})
    task.delay(0.15, function()
        tw(ToggleBtn, 0.15, {Size = UDim2.new(0, 58, 0, 58)}, Enum.EasingStyle.Back, Enum.EasingDirection.Out)
    end)
end)

MinBtn.MouseButton1Click:Connect(function()
    closePanel()
end)

CloseBtn.MouseButton1Click:Connect(function()
    if flying then stopFly() end
    tw(CloseBtn, 0.1, {BackgroundColor3 = C.DangerDark})
    task.wait(0.1)
    ScreenGui:Destroy()
end)

local dragging, dragStart, startPos
Header.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
        dragging = true
        dragStart = input.Position
        startPos = MainFrame.Position
    end
end)

UserInputService.InputChanged:Connect(function(input)
    if dragging and (input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseMovement) then
        local delta = input.Position - dragStart
        MainFrame.Position = UDim2.new(
            startPos.X.Scale, startPos.X.Offset + delta.X,
            startPos.Y.Scale, startPos.Y.Offset + delta.Y
        )
    end
end)

UserInputService.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
        dragging = false
    end
end)

LocalPlayer.CharacterAdded:Connect(function()
    if flying then
        stopFly()
        FlyBtn.Text = "ATIVAR FLY"
        FlyGradient.Color = ColorSequence.new(C.Success, C.SuccessDark)
        tw(FlyBtn, 0.2, {BackgroundColor3 = C.Success})
        UpBtn.Visible = false
        DownBtn.Visible = false
    end
end)

task.wait(0.3)
openPanel()

print("[HD Admin Fly] Carregado! Slider de velocidade 25-200 ativo.")

Features & Information

Fly igualzinho ao Fly HD admin Espero que gostem

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts