Camera CFrame only changes for a split second

Hey guys, I have a script that sets the camera cframe to a part’s cframe and it works but only for like a milisecond. I can see it slightly when it changes but it instantly changes back. I do not have any other scripts that plays with the camera settings, the issue was also made in this post and there is an example here but it was not solved,
Example:

Code:

local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer

Camera.CameraType = Enum.CameraType.Scriptable

local spawns = workspace.Levels.Spawns

local function cameraSet(attribute)
	if attribute == "Playing" then
		local PCheckpoint = Player:GetAttribute("Checkpoint")
		local CurrentSpawn = spawns:FindFirstChild(tostring(PCheckpoint), true)
		Camera.CFrame = CurrentSpawn.CFrame
	end
end

Player.AttributeChanged:Connect(cameraSet)

Is the camera.CameraType set to scriptable? The reason that the camera moves back to the player is because the CameraType is moving the camera back to the player. If you constantly set the camera to be at a new CFrame, that would also work.

1 Like

Did you even read the script I provided?

Oops, I glanced over it really quickly, let me find something else then.

Let me know when you do please

Alright, the issue is that the cameratype gets set by roblox a bit after the player loads, so you have to set it back to scriptable again. Tested this and it works.

https://devforum.roblox.com/t/camera-type-not-changing/509454/6?u=maxximuspower

My game waits for the player to load, let me test that out and I will let you know