Camera CFrame clearly setting, but uses the default CFrame instead

  1. What do you want to achieve? Keep it simple and clear!

I want to make a camera script, which looks at an NPC for a few seconds. The player will then fight them.

  1. What is the issue? Include screenshots / videos if possible!

It looks at the main SpawnLocation, despite many tests showing that it sets the location of the camera.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Nothing matches my problem. This problem went on for a few months now, and has made me lose motivation. I quit several projects due to this.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

My code:

local Camera = workspace.CurrentCamera


Camera.CameraType = Enum.CameraType.Scriptable --Scriptable1837848642 mode
workspace.CurrentCamera.CFrame = CFrame.new(workspace.SpawnLocation.Position + Vector3.new(0, 4, 5), Vector3.new(workspace.SpawnLocation.Position + Vector3.new(0, 4, 6)))
workspace.Music.Played:Wait()
Camera.CFrame = CFrame.new()
Camera.CameraType = Enum.CameraType.Custom

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

If you want to wait until a song ends used .Ended:Wait() after playing the sound,

Camera.CFrame = CFrame.new()

is unnecessary after the sound ends just set camera back to custom and it will be back to normal,

also for setting the camera to a set position create an invisible part and position it to where you want the camera to be and then set camera CFrame to that of the part CFrame its a lot easier

1 Like

I will try this, thank you! (also the music STARTS when the cutscene ends.)

Edit: IT WORKED! Apparently you can’t use a cframe without a part.

You don’t need a part for CFrame,

Vector3.new here is not needed, it breaks the position and sets it to (0,0,0)

(workspace.SpawnLocation.Position + Vector3.new(0, 4, 6))

Works fine.
Code below is the same except I’ve removed the vector3.new() and it should work.

local Camera = workspace.CurrentCamera


Camera.CameraType = Enum.CameraType.Scriptable --Scriptable1837848642 mode
workspace.CurrentCamera.CFrame = CFrame.new(workspace.SpawnLocation.Position + Vector3.new(0, 4, 5), (workspace.SpawnLocation.Position + Vector3.new(0, 4, 6)))
workspace.Music.Played:Wait()
Camera.CFrame = CFrame.new()
Camera.CameraType = Enum.CameraType.Custom
1 Like