How do I make the camera go back to the player after a cutscene?

This is the camera cutscene function I made for this:

local function PlayCameraCutscene()
local OriginalCameraType = Camera.CameraType
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = InitialPositionPart.CFrame

local CutsceneTweenInfo = TweenInfo.new(5, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)
local Goal = { CFrame = EndPositionPart.CFrame }
local cameraTween = TweenServicee:Create(Camera, CutsceneTweenInfo, Goal)

cameraTween:Play()
cameraTween.Completed:Wait()

end

And this is one of the attempts at fixing this:

Camera.CameraSubject = LocalPlayer.Character:FindFirstChildOfClass(“Humanoid”)
Camera.CFrame = OriginalCameraPosition
Camera.CameraType = OriginalCameraType

I’m not good at this, so please explain things with detail

I believe you can fix it by quickly setting camera type to custom. Lmk if this does or does not work

Save it’s CFrame before the cutscene, after the cutscene change it back and change the cameratype to custom

It didn’t work and I saw this solution in another topic about this same problem, so I’m starting to think the problem might be at the trigger for the camera to go back maybe?

It might help to share the full code of every script that may interact with this system. Or you could even try publishing the scripts to a new roblox baseplate so we can go in and experiement on it

For some reason the notification is not popping up, so I’m late to your reply but this is the full code (I put the old one before, sorry, I updated the variable names now):

local StartText = script.Parent
local StartTextInfo = TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1, true)
local StartTextGoal = {TextTransparency = 1}
local StartTextTween = game:GetService(“TweenService”):Create(StartText, StartTextInfo, StartTextGoal)
local Debounce = false
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local StarterGui = game:GetService(“StarterGui”)
StarterGui:SetCore(“ResetButtonCallback”, false)

local Module = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild(“PlayerModule”))
Controls = Module:GetControls()
local function Disable()
Controls:Disable()
end
local function Enable()
Controls:Enable()
end
Disable()

local ReplicatedFirst = game:GetService(“ReplicatedFirst”)
local LoadingScreenModule = ReplicatedFirst:WaitForChild(“LoadingScreenModule”)
local Sucess, Module = pcall(require, LoadingScreenModule)
local Players = game:GetService(“Players”)
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild(“PlayerGui”)
local StartText = script.Parent
local TitleScreenGui = StartText.Parent
local TextLabel1 = StartText.Parent.Title1
local Smite = TitleScreenGui:WaitForChild(“Smite”)
local SmiteSound = ReplicatedStorage:WaitForChild(“SmiteSound”)
local SmiteOriginalSize = Smite.Size
local SmiteOriginalPosition = Smite.Position
local SmiteTween = game:GetService(“TweenService”):Create(Smite, TweenInfo.new(.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0), {Size = UDim2.new(4, 0, 1142, 0)})

TextLabel1.Text = “”
TextLabel1.Parent.BackgroundTitle.Visible = true
TextLabel1.Parent.BackgroundTitle2.Visible = true

if Sucess and Module then
Module.start()
else
warn(“Failed to load LoadingScreenModule:”, Module)
end

local ViewFrame = StartText.Parent.Test:FindFirstChild(“ViewportScreenshot”)

task.wait(3)
Smite.Visible = true
TextLabel1.Visible = true
local function MenuAnimation()
local FrameInstance = TitleScreenGui:WaitForChild(“Frame”)
local Title1UIGradient = TextLabel1:WaitForChild(“UIGradient”)
local Title2TextLabel = TitleScreenGui:WaitForChild(“Title2”)
local ImageLabelInstance = TitleScreenGui:WaitForChild(“ImageLabel”)

Smite:TweenSize(UDim2.new(0.002, 0, 1142, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .5, true)
SmiteSound:Play()
TextLabel1.Text = "C----------"
task.wait(.5)
Smite.Size = SmiteOriginalSize
Smite.Position = Smite.Parent.Smite2.Position -- Corrected Y offset from -0 to 0 as it's likely not intended

Smite:TweenSize(UDim2.new(0.002, 0, 1142, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .5, true)
SmiteSound:Play()
TextLabel1.Text = "CO---------"
task.wait(.5)
Smite.Size = SmiteOriginalSize
Smite.Position = Smite.Parent.Smite3.Position

Smite:TweenSize(UDim2.new(0.002, 0, 1142, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .5, true)
SmiteSound:Play()
TextLabel1.Text = "COL--------"
task.wait(.5)
Smite.Size = SmiteOriginalSize
Smite.Position = Smite.Parent.Smite4.Position

Smite:TweenSize(UDim2.new(0.002, 0, 1142, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .5, true)
SmiteSound:Play()
TextLabel1.Text = "COLL-------"
task.wait(.5)
Smite.Size = SmiteOriginalSize
Smite.Position = Smite.Parent.Smite5.Position

Smite:TweenSize(UDim2.new(0.002, 0, 1142, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .5, true)
SmiteSound:Play()
TextLabel1.Text = "COLLE------"
task.wait(.5)
Smite.Size = SmiteOriginalSize
Smite.Position = Smite.Parent.Smite6.Position

Smite:TweenSize(UDim2.new(0.002, 0, 1142, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .5, true)
SmiteSound:Play()
TextLabel1.Text = "COLLEC-----"
task.wait(.5)
Smite.Size = SmiteOriginalSize
Smite.Position = Smite.Parent.Smite7.Position

Smite:TweenSize(UDim2.new(0.002, 0, 1142, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, .5, true)
SmiteSound:Play()
TextLabel1.Text = "COLLECT----" -- Corrected spacing
task.wait(.5)
Smite.Size = SmiteOriginalSize
Smite.Position = Smite.Parent.SmiteFinal.Position


Smite.Size += UDim2.new(0.10, 0)
Smite:TweenSize(-UDim2.new(0.20, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 1.5, true)
SmiteSound.Volume = 1.5
SmiteSound:Play()
TextLabel1.Text = "COLLECT THE"
task.wait(.5)


Smite.Visible = false
Smite.Position = SmiteOriginalPosition
Smite.Size = SmiteOriginalSize


task.delay(1, function()
	FrameInstance.Visible = true
	FrameInstance.BackgroundTransparency = 0
	
	task.spawn(function()
		while FrameInstance.BackgroundTransparency < 1 do
		FrameInstance.BackgroundTransparency += 0.05
		task.wait()
		end
	end)
	FrameInstance.BackgroundTransparency = 1

	ReplicatedStorage.Shine:Play()
	Title1UIGradient.Enabled = true
	Title1UIGradient.Parent.UIStroke.Enabled = true
	Title2TextLabel.Visible = true
	Title2TextLabel.UIGradient.Enabled = true
	Title2TextLabel.UIStroke.Enabled = true
	ImageLabelInstance.Visible = true
	ViewFrame.Visible = true
	StartText.Visible = true
	StartTextTween:Play()
end)

end

MenuAnimation()

local Camera = workspace.CurrentCamera
local InitialPositionPart = workspace.InitialPositionPart
local EndPositionPart = workspace.EndPositionPart
local TweenService = game:GetService(“TweenService”)
local OriginalCameraType = Camera.CameraType
local OriginalCameraPosition = Camera.CFrame
local OriginalCameraSubject = Camera.CameraSubject
local function PlayCameraCutscene()
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = InitialPositionPart.CFrame

local CutsceneTweenInfo = TweenInfo.new(5, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)
local Goal = { CFrame = EndPositionPart.CFrame }
local CameraTween = TweenService:Create(Camera, CutsceneTweenInfo, Goal)

CameraTween:Play()
CameraTween.Completed:Wait()

end

local UserInput = game:GetService(“UserInputService”)
local UserInputConnection
UserInputConnection = UserInput.InputBegan:Connect(function(Input, Typing)
if Typing then
return
end

if StartText.Visible == true then
	if Input.KeyCode == Enum.KeyCode.Space and not Debounce then
		Debounce = true
		task.spawn(function()
			while StartText.Transparency < 1 do
				StartText.Transparency += 0.1
			task.wait()
			end
		end)
		StartText.Visible = false
		task.spawn(function()
			while StartText.Parent.BackgroundTitle.ImageTransparency < 1 do
				StartText.Parent.BackgroundTitle.ImageTransparency += 0.1
				task.wait()
			end
		end)
		task.spawn(function()
			while StartText.Parent.BackgroundTitle2.ImageTransparency < 1 do
				StartText.Parent.BackgroundTitle2.ImageTransparency += 0.1
				task.wait()
			end
		end)
		StartText.Parent.ImageLabel.Visible = false
		StartText.Parent.Title1.Visible = false
		StartText.Parent.Title2.Visible = false
		ViewFrame.Visible = false
		StartTextTween:Cancel()
		ReplicatedStorage.Sounds.Play:Play()
		PlayCameraCutscene()
		
		UserInputConnection:Disconnect()
		Debounce = false
	end
end

end)

UserInput.InputEnded:Connect(function(input, typing)
if typing then
return
end

if input.KeyCode == Enum.KeyCode.Space then
	
end

end)

local CapsuleConnection
CapsuleConnection = ReplicatedStorage.Sounds.Play.Ended:Connect(function()
local CapsuleSpawn = game.Workspace.SpawnLocation
local FirstLayer = game.Workspace.LayerOne
local SecondLayer = game.Workspace.LayerTwo
local Spawning = ReplicatedStorage.Sounds.Teleport
local LayerInfo = TweenInfo.new(9, Enum.EasingStyle.Back)
local LayerGoal = {Transparency = 1}
local LayerOneTween = TweenService:Create(FirstLayer, LayerInfo, LayerGoal)
local LayerTwoTween = TweenService:Create(SecondLayer, LayerInfo, LayerGoal)
Spawning:Play()
LayerOneTween:Play()
LayerTwoTween:Play()

local Burst = ReplicatedStorage.Burst
Burst.Parent = FirstLayer
Burst.EmissionDirection = "Right"

task.wait(2.4)
Enable()
FirstLayer.Transparency = 1
SecondLayer.Transparency = 1
CapsuleSpawn.CanCollide = false

while Burst.Rate ~= 0 do
	Burst.Rate -= 15
	task.wait(.2)
end

if CapsuleSpawn.CanCollide == false then
	task.wait(2)
	Camera.CameraType = Enum.CameraType.Custom
	game.Workspace.Release.Transparency = 1
	ReplicatedStorage.Music.MainTheme:Play()
	ReplicatedStorage.Music.MainTheme.Looped = true
end

CapsuleConnection:Disconnect()

end)

1 Like

have you tried putting the

inside the

or is that not what you want?

1 Like

It’s not working, unless I did it wrong idk

Edit: I’m gonna try this in a new baseplate to see if it’s something interfering with the script
Update: Still did not work

Nevermind, the code worked now

Hey! Sorry im late, but im really good with camera manipulation! I notice you arent using the Camera.CameraType = Enum.CameraType.Custom
This will reset the camera to the player’s original camera type.

1 Like