Problem with Camera cframe going to previous cframe

Hello, Im making a shop for my game and i cant seem to get the camera cframe go back to the previous cframe when clicked? [Script]: local button = game:GetService(“Players”).LocalPlayer.PlayerGui.StoreNPC.Frame.Back
local cam = game.Workspace.Camera
local Cameras = { – cameras
[“partCFrame”] = game.Workspace.ShopCFrame.CFrame1,
[“partCFrame2”] = game.Workspace.ShopCFrame.CFrame2,
[“partCFrame3”] = game.Workspace.ShopCFrame.CFrame3,
[“partCFrame4”] = game.Workspace.ShopCFrame.CFrame4,

}
local PCFrame = nil – suppose to be the previous cframe
button.MouseButton1Click:Connect(function()
cam.CameraType = Enum.CameraType.Scriptable
for i, v in pairs(Cameras) do – going thru the cameras
if cam.CFrame == v.CFrame and PCFrame ~= cam.CFrame then
PCFrame = cam.CFrame
cam.CFrame = PCFrame
print(v)
end
end
end)

while wait(0.1) do
if cam.CFrame == Cameras.partCFrame.CFrame then
– checking if cam.cframe is equal to the first cframe(partCFrame)
button.Visible = false
else
button.Visible = true
end
end

try this, see if this works script:

local button = game:GetService("Players").LocalPlayer.PlayerGui.StoreNPC.Frame.Back
local cam = game.Workspace.Camera
local Cameras = {
	["partCFrame"] = game.Workspace.ShopCFrame.CFrame1,
	["partCFrame2"] = game.Workspace.ShopCFrame.CFrame2,
	["partCFrame3"] = game.Workspace.ShopCFrame.CFrame3,
	["partCFrame4"] = game.Workspace.ShopCFrame.CFrame4,
}
local PCFrame = nil

button.MouseButton1Click:Connect(function()
	cam.CameraType = Enum.CameraType.Scriptable
	for i, v in pairs(Cameras) do
		if cam.CFrame == v and PCFrame ~= v then
			PCFrame = cam.CFrame
			cam.CFrame = v
			print(v)
		end
	end
end)

while wait(0.1) do
	if cam.CFrame == Cameras.partCFrame then
		button.Visible = false
	else
		button.Visible = true
	end
end

Nope, doesn’t work. it wont even move one bit.

well, it does move it’s just going to the current camera’s cframe.