Camera go back to the player

I’m currently making a cutscene but I don’t know how to make the camera go back to the player. Does anyone know how to tween it back?

may we see the script?

Make sure at the end of the cutscene, parent the camera back to the player’s camera/

That’s what I want it to be able to do. I want the line of code to tween it back to the player camera

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.Camera

local cutsceneTime = 5 -- How long the cutscene lasts

local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Quad,  -- How it will animate
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

function tween(part1,part2)
	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(6)-- When it start? 2 makes it start when player spawns

script.Parent.ScreenGui.Loading.Visible = false
script.Parent.Intro.Playing = true
script.Parent.ScreenGui.Dialog.Text = "Will: What is that outside???"
tween(game.Workspace.cam1,game.Workspace.cam1)
script.Parent.ScreenGui.Dialog.Text = game.Players.LocalPlayer.DisplayName.. ": Oh no. We need to get out of here!"
tween(game.Workspace.cam1,game.Workspace.cam2)
cutsceneTime = 0.05
tween(game.Workspace.cam2,game.Workspace.cam2)
wait(0.1)
script.Parent.ScreenGui.Black.BackgroundTransparency = 0.9
tween(game.Workspace.cam2,game.Workspace.cam2)
script.Parent.ScreenGui.Black.BackgroundTransparency = 0.8
tween(game.Workspace.cam2,game.Workspace.cam2)
script.Parent.ScreenGui.Black.BackgroundTransparency = 0.7
tween(game.Workspace.cam2,game.Workspace.cam2)
script.Parent.ScreenGui.Black.BackgroundTransparency = 0.6
tween(game.Workspace.cam2,game.Workspace.cam2)
script.Parent.ScreenGui.Black.BackgroundTransparency = 0.5
tween(game.Workspace.cam2,game.Workspace.cam2)
script.Parent.ScreenGui.Black.BackgroundTransparency = 0.4
tween(game.Workspace.cam2,game.Workspace.cam2)
script.Parent.ScreenGui.Black.BackgroundTransparency = 0.3
tween(game.Workspace.cam2,game.Workspace.cam2)
script.Parent.ScreenGui.Black.BackgroundTransparency = 0.2
tween(game.Workspace.cam2,game.Workspace.cam2)
script.Parent.ScreenGui.Black.BackgroundTransparency = 0.1
tween(game.Workspace.cam2,game.Workspace.cam2)
script.Parent.ScreenGui.Black.BackgroundTransparency = 0
script.Parent.Intro.Playing = false
script.Parent.Gameplay.Playing = true
script.Parent.ScreenGui.Dialog.Text = game.Players.LocalPlayer.DisplayName.. ": There doesn't seem to be anyone else here but us. Looks like we are going to need to find keys to escape"
wait(0.5)
script.Parent.ScreenGui.Black.BackgroundTransparency = 1
wait(5)
script.Parent.ScreenGui.Dialog.Text = ""

robloxapp-20221218-2300555.wmv (935.2 KB)

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.CurrentCamera

local plr = game:GetService("Players").LocalPlayer

local cutsceneTime = 5 -- How long the cutscene lasts

local tweenInfo = TweenInfo.new(

cutsceneTime,

Enum.EasingStyle.Quad, -- How it will animate

Enum.EasingDirection.Out,

0,

false,

0

)

function tween(part1,part2)

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(6)-- When it start? 2 makes it start when player spawns

script.Parent.ScreenGui.Loading.Visible = false

script.Parent.Intro.Playing = true

script.Parent.ScreenGui.Dialog.Text = "Will: What is that outside???"

tween(game.Workspace.cam1,game.Workspace.cam1)

script.Parent.ScreenGui.Dialog.Text = game.Players.LocalPlayer.DisplayName.. ": Oh no. We need to get out of here!"

tween(game.Workspace.cam1,game.Workspace.cam2)

cutsceneTime = 0.05

tween(game.Workspace.cam2,game.Workspace.cam2)

wait(0.1)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.9

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.8

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.7

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.6

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.5

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.4

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.3

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.2

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.1

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0

script.Parent.Intro.Playing = false

script.Parent.Gameplay.Playing = true

script.Parent.ScreenGui.Dialog.Text = game.Players.LocalPlayer.DisplayName.. ": There doesn't seem to be anyone else here but us. Looks like we are going to need to find keys to escape"

wait(0.5)

script.Parent.ScreenGui.Black.BackgroundTransparency = 1

wait(5)

script.Parent.ScreenGui.Dialog.Text = ""

camera.CameraSubject = plr.Humanoid -- sets the camera back to the player

camera.CameraType = Enum.CameraType.Custom

if anything does not work tell me!

image

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.CurrentCamera

local plr = game:GetService("Players").LocalPlayer

local cutsceneTime = 5 -- How long the cutscene lasts

local tweenInfo = TweenInfo.new(

cutsceneTime,

Enum.EasingStyle.Quad, -- How it will animate

Enum.EasingDirection.Out,

0,

false,

0

)

function tween(part1,part2)

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(6)-- When it start? 2 makes it start when player spawns

script.Parent.ScreenGui.Loading.Visible = false

script.Parent.Intro.Playing = true

script.Parent.ScreenGui.Dialog.Text = "Will: What is that outside???"

tween(game.Workspace.cam1,game.Workspace.cam1)

script.Parent.ScreenGui.Dialog.Text = game.Players.LocalPlayer.DisplayName.. ": Oh no. We need to get out of here!"

tween(game.Workspace.cam1,game.Workspace.cam2)

cutsceneTime = 0.05

tween(game.Workspace.cam2,game.Workspace.cam2)

wait(0.1)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.9

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.8

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.7

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.6

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.5

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.4

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.3

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.2

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.1

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0

script.Parent.Intro.Playing = false

script.Parent.Gameplay.Playing = true

script.Parent.ScreenGui.Dialog.Text = game.Players.LocalPlayer.DisplayName.. ": There doesn't seem to be anyone else here but us. Looks like we are going to need to find keys to escape"

wait(0.5)

script.Parent.ScreenGui.Black.BackgroundTransparency = 1

wait(5)

script.Parent.ScreenGui.Dialog.Text = ""

camera.CameraSubject = plr.Character:WaitForChild("Humanoid") -- set the camera back to the player

camera.CameraType = Enum.CameraType.Custom

this should fix it?

This time there is no error but it still does the same thing

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.CurrentCamera

local plr = game:GetService("Players").LocalPlayer

local cutsceneTime = 5 -- How long the cutscene lasts

local tweenInfo = TweenInfo.new(

cutsceneTime,

Enum.EasingStyle.Quad, -- How it will animate

Enum.EasingDirection.Out,

0,

false,

0

)

function tween(part1,part2)

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(6)-- When it start? 2 makes it start when player spawns

script.Parent.ScreenGui.Loading.Visible = false

script.Parent.Intro.Playing = true

script.Parent.ScreenGui.Dialog.Text = "Will: What is that outside???"

tween(game.Workspace.cam1,game.Workspace.cam1)

script.Parent.ScreenGui.Dialog.Text = game.Players.LocalPlayer.DisplayName.. ": Oh no. We need to get out of here!"

tween(game.Workspace.cam1,game.Workspace.cam2)

cutsceneTime = 0.05

tween(game.Workspace.cam2,game.Workspace.cam2)

wait(0.1)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.9

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.8

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.7

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.6

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.5

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.4

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.3

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.2

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0.1

tween(game.Workspace.cam2,game.Workspace.cam2)

script.Parent.ScreenGui.Black.BackgroundTransparency = 0

script.Parent.Intro.Playing = false

script.Parent.Gameplay.Playing = true

script.Parent.ScreenGui.Dialog.Text = game.Players.LocalPlayer.DisplayName.. ": There doesn't seem to be anyone else here but us. Looks like we are going to need to find keys to escape"

wait(0.5)

script.Parent.ScreenGui.Black.BackgroundTransparency = 1

wait(5)

script.Parent.ScreenGui.Dialog.Text = ""


camera.CameraType = Enum.CameraType.Custom

Still having the same issue as last time

Try look at the answer here

Here, you have tried to declare Humanoid inside the player, not player’s character though

Here, do CurrentCamera, not Camera

What I think is, for the cutscene time, tween it to other part, remove the CameraSubject as character, then once cutscene time is over, just tween it to HumanoidRootPart or Head or wherever you want and then set the CameraSubject to the player’s character

Nothing seems to be working so I’m putting this as self solved

I tried my solution and it worked perfectly but anyways, that’s good you solved on your own !

It does work for me, but anyways, you can use your way.

How did you solve it??? Unless you got nothing to work.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.