The gotoframe function was throwing an error because of .toprecision so I used a different method of rounding to 5 decimal places. Now it wourks