Cutscene Script Not Working

  1. What do you want to achieve?
    When you load in, it plays a cutscene.

  2. What is the issue? Include screenshots / videos if possible!
    The cutscene goes to the first blocks (the first line at the bottom) and then doesn’t do the 2nd line at the bottom

local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
local cutsceneTime = 3
local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

function tween(part1,part2,cutsceneTime)
	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(2)

tween(game.Workspace.Test1,game.Workspace.Test2)
tween(game.Workspace.Test2,game.Workspace.Test3)

I think you should change

Camera to CurrentCamera

Which one? There’s multiple times the word camera is stated.

local camera = game.Workspace.Camera to local camera = game.Workspace.CurrentCamera

Still have the same issue.

It does the first 2 bricks. Doesn’t do the 3rd.

Why did you make it so the function tween receives a cutscene time parameter? It was already addressed. There’s no need for it.

Also, you can just do TweenObject.Completed, instead of waiting the a time.

I think both tweened at the same time

You may want to add

tween(game.Workspace.Test1,game.Workspace.Test2)
wait(cutscenetime)
tween(game.Workspace.Test2,game.Workspace.Test3)

1 Like

What would I need to do to fix this?

I think this should fix everything

local TweenService = game:GetService("TweenService")
local camera = game.Workspace.CurrentCamera
local cutsceneTime = 3
local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

function tween(part1,part2,cutsceneTime)
	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(2)

tween(game.Workspace.Test1,game.Workspace.Test2)
wait(cutsceneTime)
tween(game.Workspace.Test2,game.Workspace.Test3)

This works however it’s weirdly jumpy.
It pauses and then it starts moving.

If you want to make it work when a player joined well add

repeat wait() until game.Players.LocalPlayer.Character

also add a localscript inside the replicatedfirst and put your code and the code above this message it SHOULD work and i cant understand what do you mean its jumpy and pauses then starts moving

No. Stop sharing bad practice. You don’t need to do that. Especially because he’s tweening the camera, not the player’s character.

@UniqueGamingReed, that might be happening because of the EasingStyle of the TweenInfo. You can change to something else and see the result. The DevHub has an little recording of how each EasingStyles and EasingDirections work with eachother, here is the page that shows it:

EasingStyle (roblox.com)

I read what you said and I am honestly extremely confused. Sorry!

I’m not very good with scripting and I just about put the script above together.