Camera Larping - Camera not moving properly

Hello,
So my plan that I’m trying to do is animate the camera so it moves between parts when a GUI button is clicked. I made the parts and watched a couple of tutorial’s on how to use larp and the camera but the camera would not want to move.

Before:

After:

Bird Eye:

Output:

Camera Script(Loc in StarterPlayer)

local run = game:GetService("RunService")
local part = workspace.HEADPART1
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = part
local players = game:GetService("Players")
local plr = players.LocalPlayer
local char = plr.Character
local function onchanged()
	camera.CFrame = part.CFrame
	wait()
end
run.RenderStepped:Connect(onchanged)
task.wait(20)

GUI Handler (Loc StarterGUI)

--main--

local afkframe = main.AFK

local creditsframe = main.CreditsFrame

local settingsframe = main.SettngsFrame

local playframe = main.PlayFrame

--play--

local playframe1 = playframe.ScrollingFrame

local startbutton = playframe.start

local CurrentID = playframe.ID

--credits--

local credleft = creditsframe.Left

local credright = creditsframe.Right

local current = creditsframe.Current

local credgoal = {}

credgoal.a = workspace.HEADPART1

credgoal.b = workspace.HEADPARTWEAPONS

credgoal.c = workspace.HEADPARTLOCKER

credgoal.d = workspace.HEADPARTMAPS

credright.MouseButton1Click:Connect(function()
	print("Hi")
	if creditsframe.Visible == true then
		print("Hello")
		--[[
		1start 
		2weapons
		3locker
		4maps
		]]
		if current.Value == 0 then
			print("ello")
			current.Value = 1
			for i = 0,1,0.1 do
				print("hi")
				wait()
				camera.CFrame = camera.CFrame:Lerp(credgoal.b.CFrame, i)
			end
			
		end
	else
	end
end)

(Not all the script, I can show the whole script if needed)

The issue:
The camera script works showing the before image. The problem is when I go to run the function that moves the camera the function runs but doesn’t move the camera it just stays in place.

Tried removing the renderstepped in the camera script but that just made the camera not lock onto the part.

(Also sorry for the messy script)

I don’t really understand your issue.

Can’t you just tween the camera?

Also can you send the full script?

sorry for the very late responce.

I have a tween script and when I run it, the printed messages shown in output show that it tweened bit the camera doesnt actually move

I ended up using another method.
Locking the camera to a new local part and move the part around instead of the camera itself