Camera moving on cutscene

So I was making a test of a door 100 cutscene when I stumbled on an issue. I can still move my camera. Here is the video.

Any ideas that can improve the cutscene?

This is my script.

local ts = game:GetService("TweenService")
local part = workspace:WaitForChild("LookCam")
local parttarget = workspace:WaitForChild("LookCamTarget")
local camera = workspace.CurrentCamera

local tweeninfo = TweenInfo.new(
	4,
	Enum.EasingStyle.Cubic,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)
--moves to the lookcam target
local tween = ts:Create(part, tweeninfo, {CFrame = parttarget.CFrame})

local event = game.ReplicatedStorage.Events:WaitForChild("GateOpen")
event.OnClientEvent:Connect(function(player: Player)
	camera.CameraType = Enum.CameraType.Attach --camera settings
	camera.CameraSubject = part
	player.Character.HumanoidRootPart.Anchored = true
	local c = player.Character
	--player becomes invisible smoothly
	local tweeninfo2 = TweenInfo.new(
		0.5,
		Enum.EasingStyle.Cubic,
		Enum.EasingDirection.InOut,
		0,
		false,
		0
	)
	--variable that detects every part in the player
	for i, v in pairs(c:GetDescendants()) do
		if v:IsA("MeshPart") then
			local tween2 = ts:Create(v, tweeninfo2, {Transparency = 1})
			tween2:Play()
			tween:Play()
		end
	end
end)
1 Like

Hello!

I’d recommend using the Scriptable Enum camera type to tween your camera, which may solve your issue. Additionally if you want your cutscene to look more cinematic, you can interpolate the camera’s CFrame in between two parts (set its CFrame to part A and tween it to part B’s CFrame).

Edit: If you want to make it even more cinematic, you can add some “cinematic bars” as a UI with two black frames.

Always make sure to set the camera type back to Custom after, and hope this helps :D!

2 Likes


I don’t know how to control the camera tho…

Can I see your modified code please?

1 Like
local ts = game:GetService("TweenService")
local part = workspace:WaitForChild("LookCam")
local parttarget = workspace:WaitForChild("LookCamTarget")
local camera = workspace.CurrentCamera

local tweeninfo = TweenInfo.new(
	4,
	Enum.EasingStyle.Cubic,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)
--moves to the lookcam target
local tween = ts:Create(part, tweeninfo, {CFrame = parttarget.CFrame})

local event = game.ReplicatedStorage.Events:WaitForChild("GateOpen")
event.OnClientEvent:Connect(function(player: Player)
	camera.CameraType = Enum.CameraType.Scriptable --camera settings
	camera.CFrame = part.CFrame
	player.Character.HumanoidRootPart.Anchored = true
	local c = player.Character
	--player becomes invisible smoothly
	local tweeninfo2 = TweenInfo.new(
		0.5,
		Enum.EasingStyle.Cubic,
		Enum.EasingDirection.InOut,
		0,
		false,
		0
	)
	--variable that detects every part in the player
	for i, v in pairs(c:GetDescendants()) do
		if v:IsA("MeshPart") then
			local tween2 = ts:Create(v, tweeninfo2, {Transparency = 1})
			tween2:Play()
			tween:Play()
		end
	end
end)
1 Like

What’s going on in your current code is that you’re tweening one part to move to another, and doing that for every part within your character (since you incorporated it in the loop at the end).

I suggest making these changes:

  • delete the tween:Play() at the end
  • add this after camera.CFrame = part.CFrame:
ts:Create(camera, tweeninfo, {CFrame = parttarget.CFrame}):Play()

This should create and play the tween you need.

2 Likes

alright im going to playtest it

2 Likes


It works! Well that took long to discover!

2 Likes

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