need help with a simple script

So I’m trying to wright a script that i can apply to anything in my scene that will make the object just move left a certain amount and then move right a certain amount continuously so far i have this:

problem is i have to change it for every object in my scene… is there a simpler way to do this?

After looking at your code it looked similar to the one this guy is working on Casey Jones

http://forum.unity3d.com/viewtopic.php?t=28433

he is on the teach section of Unity and did a proof of concept of a space shooter really really helpful to me helped me get a jumpstart at working on my game

hope this helps.

yeah i actually got my start in unity from that very tutorial! unfortunatly though, he doesnt have anything that could really help with this particular script. see i don’t want them to teleport, just kind of slide left and right. thanks for post though xD

what he says to do doesn’t make the box teleport it actually makes it slide back and forth on the x axis or " Horizontal" Inputs…

But hope you find your answer if this isn’t it…

he actually uses the same script i do for moving, but when it gets to the bottom of the scene it teleports back to the top, i need mine to stop moving that way and start going the other way, then when reaching a certain point go back the other way again…