I made a camera tween, and I’m making it so that multiple cameras from different areas have a tween. However, during camera transitions, the camera goes to the player for a split second, how would I avoid this?
Code:
local TweenService = game:GetService("TweenService")
local cams = game.Workspace.Cameras
local done = false
local camera = game.Workspace.Camera
local sceneTime = 20
local tweeninfo = TweenInfo.new(
sceneTime,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
function tween(camera1, camera2)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = camera1.CFrame
local tween = TweenService:Create(camera, tweeninfo, {CFrame = camera2.CFrame})
tween:Play()
wait(sceneTime)
camera.CameraType = Enum.CameraType.Custom
end
tween(cams.Camera1, cams.Camera2)
tween(cams.Camera3, cams.Camera4)
tween(cams.Camera5, cams.Camera6)
tween(cams.Camera7, cams.Camera8)
tween(cams.Camera9, cams.Camera10)
The glitch only occurs after the first tween, it doesn’t occur for any of the others, even though they are using the exact same script.
I am getting this error: ActivateCameraController did not select a module. (x2) - Client - CameraModule:362
But that only happens at the start of the game, and somebody said that it’s a glitch.
If you happen to have a solution that would be great.
I assume the reason this happens is because you aren’t waiting for the tween to finish. You’re calling the functions right after each other, without waiting or each of the tweens to complete.
The only times that I’ve seen a tween glitch out when it comes to camera movements is when another script could be manipulating the camera at the same time. Are there any other scripts that could be setting the camera to the player’s Character during those first few tweens?