How do I fill in placeholders with a PowerShell array?

I am working on filling in placeholders on another ps1 file with an array of data. I get the content from my template and try to fill in the appropriate placeholders ({0}, {1}, {2}, etc.) and I keep getting an error saying “Input string was not in a correct format.” The data in the array is in the correct index to match the placeholders, so $FormatArray[0] fills in placeholder {0}.

    $FormatArray = @(

    #creating new package with PSADT files  
    Copy-Item -Force -Recurse $TemplateDirectory -Destination $Destination
    #populating new package placeholders
    $Template = Get-Content -Path ($Destination + "Deploy-Application.ps1") -Raw #Preferably a relative path so it's not hard-coded
    $Formatted = $Template -f $FormatArray
    Out-File -FilePath $Destination -InputObject $Formatted -Force

I am new to PowerShell and cant find anything on Google about filling in placeholders with an array. What am I doing wrong?

Go to Source
Author: NateyBee