Why won't camera work

So I tried making this play button script and the play button works
BUT the camera will not work. I’m not sure why and I don’t see any errors

local camera = game.workspace.Camera 

local menucam = game.Workspace.MenuCamera 

local playbtn = script.Parent.PlayButton

repeat wait()  
	
	camera.CameraType = Enum.CameraType.Scriptable

until camera.CameraType == Enum.CameraType.Scriptable 

camera.CFrame = menucam.CFrame

playbtn.MouseButton1Click:Connect(function() 

	camera.CameraType = Enum.CameraType.Custom

	playbtn:Destroy()

end)

If you’re looking to apply effects on the camera then use workspace.CurrentCamera. Clients create a new camera so the one in Workspace isn’t necessarily the one you’re looking for, however the CurrentCamera variable holds a reference to the client’s currently active camera.

You mean this right?

local menucam = game.Workspace.MenuCamera 

No. I meant the first line where you’re defining the camera to be manipulated. MenuCamera is the reference part you’re using to position the camera so that doesn’t need to be changed.

I don’t get how this is fixing it. I’m defining the camera.

You’re welcome to re-read my posts as well as documentation: CurrentCamera. I welcome you to try the fix first and if it doesn’t work then you should probably explain with more context what the problem is and any debugging you’ve done to narrow down the problem.

The problem isn’t that you’re defining the camera, it’s that you’re using the wrong one.

local camera = game.workspace.CurrentCamera 

local menucam = game.Workspace.MenuCamera 

local playbtn = script.Parent.PlayButton

repeat wait()  
	
	camera.CameraType = Enum.CameraType.Scriptable

until camera.CameraType == Enum.CameraType.Scriptable 

camera.CFrame = menucam.CFrame

playbtn.MouseButton1Click:Connect(function() 

	camera.CameraType = Enum.CameraType.Custom

	playbtn:Destroy()

end)

This should work

(note: untested)