Why don't you show what you have tried?
The following should work fine:
set terminal gif animate delay 100
set output 'foobar.gif'
stats 'datafile' nooutput
set xrange [-0.5:1.5]
set yrange [-0.5:5.5]
do for [i=1:int(STATS_blocks)] {
plot 'datafile' index (i-1) with circles
}
with the file datafile
:
0
1
2
3
4
5
gives