This is an example of a looping script to make a sprite move back and forth. Click on the green flag. Download the code if you would like.