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.
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.