local CFspeed = 50
local CFloop
local isRunning = false

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local head = character:WaitForChild("Head")
local runService = game:GetService("RunService")

local function startFly()
    if isRunning then return end
    isRunning = true
    humanoid.PlatformStand = true
    head.Anchored = true
    CFloop = runService.Heartbeat:Connect(function(deltaTime)
        local moveDirection = humanoid.MoveDirection * (CFspeed * deltaTime)
        local cameraCFrame = workspace.CurrentCamera.CFrame
        local newPos = head.Position + (cameraCFrame.LookVector * moveDirection.Magnitude)
        head.CFrame = CFrame.new(newPos, newPos + cameraCFrame.LookVector)
    end)
end

local function stopFly()
    if not isRunning then return end
    isRunning = false
    humanoid.PlatformStand = false
    head.Anchored = false
    if CFloop then
        CFloop:Disconnect()
        CFloop = nil
    end
end

Rayfield:CreateToggle({
    Name = "CFrame Fly",
    CurrentValue = false,
    Callback = function(Value)
        if Value then
            startFly()
        else
            stopFly()
        end
    end
})

Rayfield:CreateSlider({
    Name = "Fly Speed",
    Range = {10, 150},
    Increment = 5,
    Suffix = "Speed",
    CurrentValue = CFspeed,
    Callback = function(Value)
        CFspeed = Value
    end
})

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: