Moving Part



Where to put this script

Moving Brick:


local part = script.Parent

local dir = 1

while true do
    part.Position = part.Position + Vector3.new(1*dir,0,0)
    wait(.1)

    if (part.Position.X > 100) then
        dir = -1
    end

    if (part.Position.X < -100) then
        dir = 1
    end
end

Line by Line


local part = script.Parent


local dir = 1


while true do


    part.Position = part.Position + Vector3.new(1*dir,0,0)


    wait(.1)


    if (part.Position.X > 100) then
        dir = -1
    end


    if (part.Position.X < -100) then
        dir = 1
    end

end

Modifications