universal fly script by SharkCreepy
Key RequiredUniversal

universal fly script by SharkCreepy

Universal ScriptSharkCreepySharkCreepy 1.3K views 5K executesUpdated Mar 20, 2026
0.0/ 5(1 votes)
010% Positive
Lua Script•194 lines (5952 chars)
-- SharkFly LocalScript (fly only)
-- Place in StarterPlayerScripts

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

local Player = Players.LocalPlayer
if not Player then
    warn("Script must run as a LocalScript (place in StarterPlayerScripts or StarterGui).")
    return
end

local playerGui = Player:WaitForChild("PlayerGui", 5)
if not playerGui then
    warn("PlayerGui not found.")
    return
end

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

local function makeFrame(props)
    local f = Instance.new("Frame")
    f.Size = props.Size or UDim2.new(0,300,0,200)
    f.Position = props.Position or UDim2.new(0.02,0,0.02,0)
    f.BackgroundColor3 = props.BackgroundColor3 or Color3.fromRGB(30,30,30)
    f.BorderSizePixel = 0
    f.Parent = gui
    return f
end

local main = makeFrame({Size=UDim2.new(0,320,0,200)})
local title = Instance.new("TextLabel", main)
title.Size = UDim2.new(1,0,0,28)
title.BackgroundTransparency = 1
title.Text = "Fly Script — E to toggle"
title.TextColor3 = Color3.fromRGB(255,255,255)
title.TextScaled = true

local status = Instance.new("TextLabel", main)
status.Size = UDim2.new(1,0,0,22)
status.Position = UDim2.new(0,0,0,28)
status.BackgroundTransparency = 1
status.Text = "Status: OFF"
status.TextColor3 = Color3.fromRGB(200,200,200)
status.TextScaled = true

local speedLabel = Instance.new("TextLabel", main)
speedLabel.Size = UDim2.new(0.5, -10, 0, 20)
speedLabel.Position = UDim2.new(0, 8, 0, 52)
speedLabel.BackgroundTransparency = 1
speedLabel.Text = "Speed:"
speedLabel.TextColor3 = Color3.fromRGB(200,200,200)
speedLabel.TextXAlignment = Enum.TextXAlignment.Left

local speedBox = Instance.new("TextBox", main)
speedBox.Size = UDim2.new(0.5, -16, 0, 24)
speedBox.Position = UDim2.new(0.5, 0, 0, 50)
speedBox.Text = "50"
speedBox.ClearTextOnFocus = false
speedBox.TextScaled = true
speedBox.TextColor3 = Color3.fromRGB(0,0,0)
speedBox.BackgroundColor3 = Color3.fromRGB(230,230,230)
speedBox.BorderSizePixel = 0
speedBox.PlaceholderText = "positive number"

local toggleBtn = Instance.new("TextButton", main)
toggleBtn.Size = UDim2.new(0,110,0,34)
toggleBtn.Position = UDim2.new(0.05,0,1,-48)
toggleBtn.Text = "Enable"
toggleBtn.BackgroundColor3 = Color3.fromRGB(50,120,50)
toggleBtn.TextColor3 = Color3.fromRGB(255,255,255)
toggleBtn.BorderSizePixel = 0

local unloadBtn = Instance.new("TextButton", main)
unloadBtn.Size = UDim2.new(0,110,0,34)
unloadBtn.Position = UDim2.new(0.5,0,1,-48)
unloadBtn.Text = "Unload"
unloadBtn.BackgroundColor3 = Color3.fromRGB(120,40,40)
unloadBtn.TextColor3 = Color3.fromRGB(255,255,255)
unloadBtn.BorderSizePixel = 0

main.Active = true
main.Draggable = true

-- state
local flySpeed = 50
local flying = false
local bv, bg, renderConn

local function setStatus()
    status.Text = "Status: " .. (flying and "ON" or "OFF")
    speedBox.Text = tostring(math.floor(flySpeed))
    toggleBtn.Text = (flying and "Disable" or "Enable")
    toggleBtn.BackgroundColor3 = (flying and Color3.fromRGB(140,40,40) or Color3.fromRGB(50,120,50))
end

local function enableFly(enable)
    local char = Player and Player.Character
    if not char or not char:FindFirstChild("HumanoidRootPart") then return end
    local hrp = char.HumanoidRootPart

    if enable then
        if bv and bv.Parent then bv:Destroy() end
        if bg and bg.Parent then bg:Destroy() end
        if renderConn then renderConn:Disconnect() renderConn = nil end

        bv = Instance.new("BodyVelocity")
        bv.MaxForce = Vector3.new(9e9,9e9,9e9)
        bv.Velocity = Vector3.new(0,0,0)
        bv.Parent = hrp

        bg = Instance.new("BodyGyro")
        bg.MaxTorque = Vector3.new(9e9,9e9,9e9)
        bg.P = 9e4
        bg.Parent = hrp

        renderConn = RunService.RenderStepped:Connect(function()
            if not flying then return end
            local cam = workspace.CurrentCamera
            if not cam then return end
            local look = cam.CFrame.LookVector
            local dir = look
            if dir.Magnitude > 0 then dir = dir.Unit end
            local target = dir * flySpeed
            if target ~= target then target = Vector3.new(0,0,0) end
            bv.Velocity = target
            bg.CFrame = CFrame.new(hrp.Position, hrp.Position + cam.CFrame.LookVector)
        end)
    else
        if renderConn then renderConn:Disconnect() renderConn = nil end
        if bv and bv.Parent then bv:Destroy() end
        if bg and bg.Parent then bg:Destroy() end
        bv, bg = nil, nil
    end
end

toggleBtn.MouseButton1Click:Connect(function()
    flying = not flying
    enableFly(flying)
    setStatus()
end)

unloadBtn.MouseButton1Click:Connect(function()
    flying = false
    enableFly(false)
    if gui and gui.Parent then gui:Destroy() end
end)

local function parseAndSetSpeed(text)
    local n = tonumber(text)
    if not n or n <= 0 then
        speedBox.Text = tostring(math.floor(math.max(1, flySpeed)))
        return
    end
    if n > 1e8 then n = 1e8 end
    flySpeed = n
    setStatus()
end

speedBox.FocusLost:Connect(function(enterPressed)
    parseAndSetSpeed(speedBox.Text)
end)

speedBox:GetPropertyChangedSignal("Text"):Connect(function()
    local n = tonumber(speedBox.Text)
    if n and n > 0 then
        flySpeed = n
    end
end)

local keyConn = UserInputService.InputBegan:Connect(function(input, gp)
    if gp then return end
    if input.KeyCode == Enum.KeyCode.E then
        flying = not flying
        enableFly(flying)
        setStatus()
    end
end)

Players.PlayerRemoving:Connect(function(p)
    if p == Player then
        if renderConn then renderConn:Disconnect() end
        if bv and bv.Parent then bv:Destroy() end
        if bg and bg.Parent then bg:Destroy() end
        if gui and gui.Parent then gui:Destroy() end
    end
end)

setStatus()

Features & Information

Universal Fly script
#Universal#dly#universal fly

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts