How do I move a player's camera to a part's position?

I’m trying to put the players camera at the position of a part however I can figure out how to get it to work. I don’t know what else to try, any ideas?:

Local Script in Starter Player Scripts:

local camera = workspace.CurrentCamera
local cameraPart = workspace:WaitForChild("Camera")

camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = cameraPart.CFrame

game:GetService("RunService").RenderStepped:Connect(function()
	camera.CFrame = cameraPart.CFrame
end)

Any ideas on how to do this or get it to work? Thanks!

camera type is not scriptable most likely and core script overrides it

local camera:Camera = workspace.CurrentCamera
local cameraPart = workspace:WaitForChild("Camera")::Part

camera.CameraType = Enum.CameraType.Scriptable
camera:GetPropertyChangedSignal("CameraType"):Wait()
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = cameraPart.CFrame

game:GetService("RunService").PreRender:Connect(function():()
	camera.CFrame = cameraPart.CFrame
end)

Maybe because there is already a camera named Camera in Workspace?

Try renaming your part to “CameraPart”.

The issue is most likely with your cameraPart variable since it’s probably trying to get the Camera instance. I had a go myself and this code works where CameraPart is an actual part, and not a Camera.

local CurrentCamera = workspace.CurrentCamera
local TestCamera = workspace:WaitForChild("CameraPart")

CurrentCamera.CameraType = Enum.CameraType.Scriptable
CurrentCamera.CFrame = TestCamera.CFrame