Camera module gives warning and error 'ActiveCameraController did not select a module'

Hi! I’m trying to create a module to create a Tween between two parts & the players camera, but I receive a warning ‘ActiveCameraController did not select a module’, and ‘Unable to cast to Dictionary’.

I’m not sure what these mean, but would be appreciative if anybody could help me out! :slight_smile:
image

Module
local Module = {}
local Camera = workspace.Camera
local TweenService = game:GetService("TweenService")
Camera.CameraType = Enum.CameraType.Scriptable

function Module:CreateTween(Camera, Time, Part1, Part2)
	if Camera and Time and Part1 and Part2 then
		TweenService:Create(Camera, TweenInfo.new(Time), {CFrame = Part1.CFrame, Part2.CFrame}):Play()
	end
end

return Module
1 Like

ActiveCameraController is a bug, it’s been around for forever. AFAIK not anything you can do to fix it without forking core scripts, dw about that.

For the second thing, you’re passing two CFrames to your table argument, the camera can only have one CFrame.

{CFrame = Part1.CFrame}

or

{CFrame = Part2.CFrame}
1 Like

So to fix this, should I by default set the Camera’s CFrame to Part1.CFrame and then have it tween to Part2.CFrame?

Yeah, try setting the camera’s CFrame to part1.CFrame without a tween, then apply the tween after setting the CFrame.

1 Like

Alright, I may have misunderstood the instructions, but here’s what my ModuleScript looks like now.
The tween is created, but instead of going from Part1 to Part2, it goes from the Player to Part2.

ModuleScript
local Module = {}
local Camera = workspace.Camera
local TweenService = game:GetService("TweenService")
Camera.CameraType = Enum.CameraType.Scriptable

function Module:CreateTween(Camera, Time, Part1, Part2)
	if Camera and Time and Part1 and Part2 then
		Camera.CFrame = Part1.CFrame
		TweenService:Create(Camera, TweenInfo.new(Time), {CFrame = Part2.CFrame}):Play()
	end
end

return Module
Script that requires the module
local Module = require(game.ReplicatedStorage.Modules.CameraTweening)
local Camera = workspace.Camera

wait(3)
Module:CreateTween(Camera, 5, workspace.Cat, workspace.Dog)

Hmm.

Try setting the cameratype to scriptable.

function Module:CreateTween(Camera, Time, Part1, Part2)
	if Camera and Time and Part1 and Part2 then
        Camera.CameraType = Enum.CameraType.Scriptable
		Camera.CFrame = Part1.CFrame
		TweenService:Create(Camera, TweenInfo.new(Time), {CFrame = Part2.CFrame}):Play()
	end
end
3 Likes

Yep, works as it should now! Thank you so much for your help! :yum:

1 Like