Camera.Focus not changing

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I have a script that is supposed to change your camera’s view to be above a table, but it won’t change.

  2. What is the issue? Include screenshots / videos if possible!
    The camera.Focus changes but what it is looking at doesn’t.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have not found any solutions.

LocalScript that is changing the camera:

local camera = workspace.CurrentCamera
game.ReplicatedStorage.TweenCameraOverTable.OnClientEvent:Connect(function(tableToUse)
	camera.Focus = CFrame.new(workspace.TableCameras[tableToUse .."Camera1"].Position, workspace.TableCameras[tableToUse .."Camera2"].Position)
	camera.CameraType = Enum.CameraType.Scriptable
end)

Script that is firing the event (It’s under a ProximityPrompt):

script.Parent.Triggered:Connect(function(player)
	local char = player.Character
	if char then
		char.Humanoid.PlatformStand = true
		char.HumanoidRootPart.Anchored = true
		char.HumanoidRootPart.CFrame = script.Parent.Parent.Parent.TPTo.CFrame
		script.Parent.Enabled = false
		script.Parent.Parent.Parent.JoinPad.BrickColor = BrickColor.new("Really red")
		char.HumanoidRootPart.Orientation = Vector3.new(0, 90, 0)
		script.Parent.Parent.Parent.Barrier.CanCollide = true
		game.ReplicatedStorage.TweenCameraOverTable:FireClient(player, script.Parent.Parent.Parent.Name)
	end
end)

Explorer:


I might be wrong, but I think the reason why what it’s looking at doesn’t change is that you’re not changing the CFrame of the camera. The Focus of a Camera is the 3D area that the graphics engine prioritizes. It is not the position and area of “focus” of the Camera, though you are probably right to set the camera’s Focus every time as the Focus will not change if its CameraType is set to Scriptable.

Turn this script into this:

local camera = workspace.CurrentCamera
game.ReplicatedStorage.TweenCameraOverTable.OnClientEvent:Connect(function(tableToUse)
    --NEW LINE BELOW
    camera.CFrame = CFrame.new(workspace.TableCameras[tableToUse .."Camera1"].Position, workspace.TableCameras[tableToUse .."Camera2"].Position)

	camera.Focus = CFrame.new(workspace.TableCameras[tableToUse .."Camera1"].Position, workspace.TableCameras[tableToUse .."Camera2"].Position)
	camera.CameraType = Enum.CameraType.Scriptable
end)
1 Like

That worked! Just a side question, how would I go about tweening it to the position?

Same as you’d tween anything else. Something like:

local TS = game:GetService("TweenService")
local cameraMoveInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0)
local cameraMove = TS:Create(camera, cameraMoveInfo, {CFrame = CFrame.new(workspace.TableCameras[tableToUse .."Camera1"].Position, workspace.TableCameras[tableToUse .."Camera2"].Position)})
cameraMove:Play()
1 Like