Camera CFrame change not tweening properly

I’m tweening the CFrame of the player’s camera to look at a model, but the CFrame isn’t working properly.

script:

local camera = game.Workspace.CurrentCamera
local event = game.ReplicatedStorage.Events.SpiritBoardCamera
local TweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local cutsceneModel = game.Workspace:WaitForChild("SpiritBoardCutscene")

event.OnClientEvent:Connect(function(board, camPart, pointer, num)
	camera.CameraType = Enum.CameraType.Scriptable
	local tweeninfo = TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
	local cutsceneBoardPos = cutsceneModel.Board.Position
	local cutsceneCamPos = cutsceneModel.Board.cameraPart.Position
	local cutscenePointerPos = cutsceneModel.Pointer.MeshPart.Position
	
	camera.CameraSubject = player.Character.Head
	TweenService:Create(camera, tweeninfo, {CFrame = CFrame.new(board.cameraPart.Position, board.Position)}):Play()
	if (num == 1) then
		print("ghost not summoned")
	else
		print("summoned ghost")
		TweenService:Create(camera, tweeninfo, {CFrame = CFrame.new(board.cameraPart.Position, board.Position)}):Play()
		task.wait(0.75)
		TweenService:Create(game.Lighting.SpellColour, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In), {TintColor = Color3.fromRGB(0,0,0)}):Play()
		task.wait(1.2)
		TweenService:Create(camera, tweeninfo, {CFrame = CFrame.new(cutsceneCamPos, cutsceneBoardPos)}):Play()
		wait(1.95)
		TweenService:Create(game.Lighting.SpellColour, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {TintColor = Color3.fromRGB(255,255,255)}):Play()
		print("starting pointer movement")
	end

	camera.CameraSubject = player.Character.Humanoid
	camera.CameraType = Enum.CameraType.Custom
end)

The camera looks at it from the wrong angle, but the part is facing the right way.
image
image
image

I tried rotating the camera but it doesn’t rotate at all.

you need to rotate the block 90 degree’s the side

Have you tried applying a rotation to the CFrame?

CFrame = CFrame.new(cutsceneCamPos, cutsceneBoardPos) * CFrame.Angles(math.pi / 2, 0, 0)

i managed to fix it by replacing this line

TweenService:Create(camera, tweeninfo, {CFrame = CFrame.new(cutsceneCamPos, cutsceneBoardPos)}):Play()

with this

local cf = cutsceneModel.Board.cameraPart.CFrame
TweenService:Create(camera, tweeninfo, {CFrame = cf}):Play()

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.