You didn't describe your problem.
What I noticed:
writestring:=writestring+scores+#13+#10;
Since scores in an array:
writestring:=writestring+scores[i]+#13+#10;
I don't know how ixsplit works, but you might need to change for loop limit to ArrayHigh(scores)-1, too.