Hey! When I started out learning Roblox and what it could offer, I found CFrames to be a rather difficult concept to grasp when not exposed to a similar concept. Here are some resources that helped me understand what CFrames are and how it works.
For this particular case, you could use TweenService or CFrame:Lerp.
Here’s an example for you using TweenService:
local TweenService = game:GetService("TweenService")
local TweenInfo = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
-- More can be found here: https://developer.roblox.com/en-us/api-reference/function/TweenService/Create
local Part = -- Part that you want to animate
local goal = {} -- Contains all properties that you want your tween to change
goal.Position = Vector3.new(x,y,z) -- x (left, right), y (up, down), z (forwards, backwards) -- A property (can also use CFrames but, I don't think you wanted rotation)
local Tween = TweenService:Create(Part, TweenInfo, goal) -- creates a tween with 'part' using TweenInfo that reaches 'goal.Position'
Tween:Play() -- Plays tween you created above
Hope this helps!