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!
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
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)
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