Camera manipulate the Ending CFrame but doesn't Focus on the CFrame block using TweenService

  1. What do you want to achieve?

I want that after you trigger the proximity prompt, the camera is manipulated to a specific block and focuses on another block using TweenService

Like this:

  1. What is the issue?

The CFrame works but it doesn’t focus on the part that i want it to focus on.

Here is the code:

local TweenService = game:GetService("TweenService")
local ProximityPrompt = game:GetService("ProximityPromptService")
local camera = workspace.CurrentCamera
local focusing = workspace.Focusing
local ending = workspace.Ending
local Moving = workspace.Moving
local clicker = workspace.ClicktoCFrame
local Player = game.Players.LocalPlayer

local InfoMoving = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
local InfoInterpolate = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)

local PTMoving = {
	["Position"] = Moving.Position
}
local PTInterpolate = {
	["CFrame"] = ending.CFrame,
	["Focus"] = focusing.CFrame
}

local TweenMoving = TweenService:Create(ending, InfoMoving, PTMoving)
local TweenInterpolate = TweenService:Create(camera, InfoInterpolate, PTInterpolate)

local function onPromptTriggered()
	camera.CameraType = Enum.CameraType.Scriptable
	TweenInterpolate:Play()

	wait(3)

	TweenMoving:Play()
end

ProximityPrompt.PromptTriggered:Connect(onPromptTriggered)

Note: The moving part thing isn’t related to this bug.

Thé Focus property of the camera will not be updated when the camera mode is Scriptable according to the developer hub.

https://developer.roblox.com/en-us/api-reference/property/Camera/Focus

The best you can do is to just use the CFrame.lookAt() function where you position the camera to the part’s location, and then give it another position to make the camera look at that part.

1 Like

Okay, another thing.

When i changed the camera mode to Fixed, the camera did this:

why did it do that?

Why are you changing it to fixed? It should be Scriptable when you’re manipulating the CFrame of the camera.

Oh I didn’t know that, I’m new to camera manipulation.

I’m now gonna look at the answer you gave me and see if it will work, thanks!

Keep in mind, whenever you’re manipulating the CFrame of the camera, always make sure its mode is Scriptable.

You can learn more about manipulating camera CFrame here:

This actually worked, Thank you!!