i'm making an intro cut-scene that shows the map the player will be working with, and when the cut-scene is done I want the camera to tween back to the player... but everything i try, it doesn't work...

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.Camera

local cutsceneTime = 6

local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

function tween(part1,part2,part3,part4,part5)
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame
	
	local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
	tween:Play()
	
	wait(cutsceneTime)
	
	camera.CameraType = Enum.CameraType.Custom
end

wait()
tween(game.Workspace.Mountain1.CutSceneParts.Intro.Part1,game.Workspace.Mountain1.CutSceneParts.Intro.Part2)
tween(game.Workspace.Mountain1.CutSceneParts.Intro.Part2,game.Workspace.Mountain1.CutSceneParts.Intro.Part3)
tween(game.Workspace.Mountain1.CutSceneParts.Intro.Part3,game.Workspace.Mountain1.CutSceneParts.Intro.Part4)
tween(game.Workspace.Mountain1.CutSceneParts.Intro.Part4,game.Workspace.Mountain1.CutSceneParts.Intro.Part5)

3 comments

0

instead of saying (game.Workspace.Camera) you should use (game.Workspace.CurrentCamera)

0

There's no point in having the last three parameters in your tween() function. Also, are there any errors?

0

everything works as intended, but i cant find a way for the camera to tween back to the original camera