CameraPart Not Working

local target = workspace.CameraPart
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target

My code is simple yet it doesn’t work.

It is in a local script in StarterPlayerScripts. My character spawns but the Camera doesn’t attach to the camerapart.

Please help me, I’ve read other posts and I have no idea what to do.

Update: I disabled the script and that’s why it wasn’t working…

but…it does this now.

You need to set the CFrame property of the camera. Also are you sure your CameraPart is anchored?
camera.CFrame = target.CFrame

Have you waited for the character before firing the script?

local character = plr.Character or plr.CharacterAdded:Wait()

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