Why do you transmit the Variable "lastpos" over the network if you only use it locally?
Why do you use setVariable on the player if you can simply use a local (or maybe global if used in other scripts) variable?
Just some thoughts I had when I looked over your code.
Also this code here:
_y= player getvariable"highscore"; player setvariable["highscore",[_y select 0,_y select 1,_y select 2,_y select 3,_y select 4,_y select 5,_y select 6, (_y select 7)+_distanceFoot],true];
Could be done that way:
_y = player getVariable "highscore";
_y set [7, ((_y select 7)+_distanceFoot)];
player setVariable["highscore", _y, true];
It's three lines of code, but provides a slightly better readability, resulting in less confusion and/or possible errors when editing that Code.
Hope I could help you a little bit with my post.