How can you save all user-defined functions to txt files on your local hard drive?
The easiest way I can think of is the following:


Right-click on your database -> Tasks -> Generate Scripts...
Select specific database objects
Select the checkbox User-Defined Functions
Save to file and just name your text file whatever you'd like


This will generate and save the scripts for your UDFs to your desired file.  You could use PowerShell (off the top of my head) to generate scripts for each UDF and save them to a separate text file (one text file per UDF).

Edit:  Below is some PowerShell to do what you want to do.  This script will get all of the User Defined Functions in your database (set the variables to your appropriate environment) and write the definition of each of them to their own file, naming the file what the function is named.

$serverName = "YourServerName"          # example: "YourServer" or "YourServer\YourNamedInstance"
$databaseName = "YourDatabaseName"
$outputDirectory = "C:\Dir1\YourUDFs"   # the dir you want these files saved in

[Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null

$server = New-Object Microsoft.SqlServer.Management.Smo.Server($serverName)
$database = $server.Databases.Item($databaseName)
$udfCol = $database.UserDefinedFunctions | Where-Object {$_.Schema -ne "sys"}
foreach ($udf in $udfCol) {
    $udfName = $udf.Name
    ($udf.TextHeader + $udf.TextBody) | 
        Out-File -FilePath $outputDirectory\$udfName".txt"
}