How to run cutscene animation sequence with first person camera

  1. What do you want to achieve? Keep it simple and clear!
    So i need to run my animation which is cutscene with few different objects and a rig
  2. What is the issue? Include screenshots / videos if possible!
    Idk how to run camera keyframes normally. Some internet solutions don’t really work
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Looked in internet

Here is current code:

ChangeCameraObject.OnClientEvent:Connect(function(AnimName)
	local FirstPersonRig = game:GetService("ReplicatedStorage").FirstPersonRig
	local rigClone = FirstPersonRig:Clone()
	rigClone.Parent = workspace.FirstMap.Map.SecretRoom1
	
	local Animations = game:GetService("ReplicatedStorage").Animations
	local ValidAnimation = Animations:FindFirstChild(AnimName) or print("Animation Name is incorrect")
	local CameraKeyframes = ValidAnimation.CameraKeyframes or nil
	local MovementKeyframes = ValidAnimation.MovementKeyframes or nil
	
	local plrRig = Player.Character
	local Camera = workspace.CurrentCamera
	--update character
	for _,playerAppearance in pairs(rigClone:GetChildren())do
		if playerAppearance:IsA("BodyColors") or playerAppearance:IsA("Shirt") or playerAppearance:IsA("Pants") or playerAppearance:IsA("Accessory") then
			local clone = playerAppearance:Clone()
			clone.Parent =  rigClone
		end
	end
	
	Camera.CameraSubject = rigClone.Head
	Player.CameraMode = Enum.CameraMode.LockFirstPerson
	
	local Animator = rigClone.Humanoid.Animator
	local AnimationTrack = Animator:LoadAnimation(MovementKeyframes)
	AnimationTrack:Play()
	local function Cinematic()

		local CurrentCameraCFrame = workspace.CurrentCamera.CFrame
		local FrameTime = 0
		local Connection

		plrRig.Humanoid.AutoRotate = false
		Camera.CameraType = Enum.CameraType.Scriptable
		
		

		Connection = RunService.RenderStepped:Connect(function(DT)
			FrameTime += (DT * 60) 

			local NeededFrame = CameraKeyframes.Frames:FindFirstChild(tonumber(math.ceil(FrameTime)))

			if NeededFrame then
				Camera.CFrame = rigClone.HumanoidRootPart.CFrame * NeededFrame.Value
			else
				Connection:Disconnect()
				rigClone.Humanoid.AutoRotate = true
				Camera.CameraType = Enum.CameraType.Custom
				Camera.CFrame = CurrentCameraCFrame	
			end
		end)
	end
	
	Cinematic()
end)

But happens this lol: 2023-12-03 18-34-54.mp4 - Google Drive

3 Likes

Bump because no answers (30 letters)

Bump, still not solved (30 lettersssssssssssssssssssssssssssssssssss)