a friend told me about cFrame but i didnt understood him
while true do
if waitTime == 0 then waitTime = 1 end if sec >= maxSec then right = not right sec = 0 end for key,value in pairs(table) do if right then value.Position = value.Position + Vector3.new(0.5, 0, 0) else value.Position = value.Position - Vector3.new(0.5, 0, 0) end end sec = sec + (1 * waitTime) wait (waitTime)
end
Check out the wiki.
Also you can use this :)
while wait(0.01) do local ver = 100 -- Distance / How many times it takes to move for i = 0, ver do script.Parent.CFrame = script.Parent.CFrame+Vector3.new(0, 0, 1) wait() end wait(0.5) -- Time to return for i = 0, ver do script.Parent.CFrame = script.Parent.CFrame+Vector3.new(0, 0, -1) wait() end end