Help with moving camera

So, I have a script for a loading screen that changes the character camera until a button is clicked. The camera position is based off the location of a part in workspace. I have a script that makes the part move back and fourth, but the camera doesn’t seem to follow the part as it moves. I am looking for some help on how to fix this issue, I will provide the code below.

local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local PlayButton = script.Parent.PlayButton

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraPart.CFrame

PlayButton.MouseButton1Click:Connect(function()
	Camera.CameraType = Enum.CameraType.Custom
end)

If you want it to dynamically follow the part, you must set the CFrame constantly such as in a RenderStepped connection

Can you change my code to do that? I am not very familiar with how this type of code works.

Usually I dont support this but its an easy fix so here you go.

local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local PlayButton = script.Parent.PlayButton

repeat wait()
    Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

local con = game:GetService("RunService").RenderStepped:Connect(function()
	Camera.CFrame = workspace.CameraPart.CFrame
end

PlayButton.MouseButton1Click:Connect(function()
    Camera.CameraType = Enum.CameraType.Custom
    con:Disconnect()
    con = nil
end)

You can use Camera | Roblox Creator Documentation to make the camera follow the part as it moves.

Camera.CameraSubject = workspace.CameraPart