Camera Tween Issue

Does anyone know a solution to fixing this tween issue where it snaps when tweening the CFrame back to initial camera CFrame? It seems to be an issue with setting CameraType back to custom. Thanks in advance!

https://gyazo.com/da7c32d6cdafc4f8b9e3828441a8a1e5

local DefaultCF = Camera.CFrame
local Portal = GetPortal(tonumber(part.Name))
part:Destroy()
Camera.CameraType = Enum.CameraType.Scriptable

local TweenService = game:GetService('TweenService')
local Tween = TweenService:Create(Camera,TweenInfo.new(2),{CFrame = PortalData.CameraCF})
Tween:Play()
task.wait(2)
local Tween = TweenService:Create(Portal.Toucher,TweenInfo.new(1),{Transparency = .4})
Tween:Play()
task.wait(1)

local Tween = TweenService:Create(Camera,TweenInfo.new(1),{CFrame = DefaultCF})
Tween:Play()
task.wait(1)
Camera.CameraType = Enum.CameraType.Custom

Sadly I have had the same problem a while back…
You should try disabling any camera movement, I think UserInputService maybe used somehow

Instead of having race conditions with task.wait() you can use Tween.Completed:Wait(), it might be that its a little late starting.

1 Like

Yeah, I’ll be rewriting a bit of the logic on this – just temporarily set this as a base to test. Thanks for reminding me! :slight_smile:

Bummer. Not sure if that would have any play in the issue as the CameraType is set to Scriptable? :thinking:

Follow up – unfortunately, that didn’t appear to fix it. I appreciate the suggestion though! :slight_smile: Not sure why setting CameraType back to custom would do this when everything else is kept the same.

create a Part with the CFrame of the portal and change the CameraSubject to it.

Have you tried anchoring the players HumanoidRootPart during the cutscene then unanchoring the HumanoidRootPart after the cutscene ends?

1 Like

Made a quick script. Here you go:

local function Cutscene()
	Camera.CameraType = Enum.CameraType.Scriptable
	local cf = Camera.CFrame
	HumanoidRootPart.Anchored = true
	Tween(2,{CFrame = CFrame.new(0,10,0)})
	task.wait(4)
	Tween(2,{CFrame = cf})
	task.wait(2)
	HumanoidRootPart.Anchored = false
	Camera.CameraType = Enum.CameraType.Custom
end

Result:

2 Likes

Thank you!! That was what the issue was – I feel dumb not having thought of that. Much appreciated! Have a great day. :slight_smile:

1 Like

Very nice, like in your code, the issue was not anchoring the HumanoidRootPart. I appreciate your contribution! :slight_smile:

1 Like

Please dont feel dumb :frowning_face:
If it makes you feel better I got stuck on the same issue for like 4 hours before.

Also, I appreciate @iicloudsforeveriii sharing some code and an example video. You were very helpful.

1 Like

Haha, all good. You’re quite kind!

Thankful that your 4 hours of suffering before saved me some time today. :joy: Much appreciated again.

1 Like

No worries. Happy scripting.

Thank you.

2 Likes

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