Tween on Camera while player is spawning never completes

I am attempting to create a loading screen which tweens a player’s camera while they’re loading, so they can see the game being loaded in. The way it works is

  • Tween steps are added to a table with the following values

    1. Tween Time
    2. Easing Style
    3. Easing Direction
    4. CFrame table with Start and End values
    5. Optional FOV table with Start and End values
  • The camera’s original state is stored in a table

  • Each step is looped through, and if the Cutscene is playable (implying that :Stop() or :Pause() has not been called, it will go to the next cutscene (Code below).

self.Playable = true
local CurrentCamera = workspace.CurrentCamera
self.OriginalState = {
	FieldOfView = CurrentCamera.FieldOfView,
	CFrame = CurrentCamera.CFrame,
	CameraSubject = CurrentCamera.CameraSubject,
	CameraType = CurrentCamera.CameraType,
for Index, Step in ipairs(self.Steps) do
	if self.Playable then
		CurrentCamera.CameraType = Enum.CameraType.Scriptable
		local CameraData = self.Steps[Index]
		local TweenData = {
			CFrame = CameraData.CFrame.End

		if CameraData.FOV then
			CurrentCamera.FieldOfView = CameraData.FOV.Start
			TweenData.FieldOfView = CameraData.FOV.End

		CurrentCamera.CFrame = CameraData.CFrame.Start

		self.ActiveTween = TweenService:Create(CurrentCamera,
			CameraData.EasingDirection), TweenData)


Expected Behavior: The loop should wait for the tween to be completed, and then continue to the next tween if playable.

However, the tween never finishes, or the Completed event is not emitted. I have attempted to connect to .Completed before the tween is played, to see if the event is being emitted as the tween is played, but the event is never emitted. I have the script in ReplicatedFirst so the actual loading portion of the script can pre-load assets in the game.

Any help is appreciated, Thanks!

1 Like


I tried the code below with what was given and it seems to work for me just fine. Are you sure your loading sequence isn’t yielding the camera tween? Try printing in near the for loop to see if it runs at all.

I added prints after each break, including after ActiveTween:Play(), and it prints fine until it gets to self.ActiveTween.Completed:Wait(), and sometimes the Camera’s CFrame doesn’t get set, it starts at 0,0,0 and tweens to it’s final position. It’s probably because it’s running too quickly, before the character / client loaded in, but the camera has already loaded in. It works perfectly fine running it manually, like in a script that waits, or in the command bar.

Yeah, it is probably because you are executing the script at ReplicatedFirst, you can always keep loading on the client there but in StarterGui or wherever else you’d like for the camera. I recommend using global variables to have communication between both of those scripts so you know when to stop the camera. I tried your code in ReplicatedFirst and it seems fine but it would make sense if any other scripts load directly after it (like the CameraModule)

The CameraModule being the ROBLOX Built-In Camera Controller, in which case would there be a way to wait for that to load (or whatever else the camera would need), then to run the tween? I also tried the tweening with the UI in StarterGui, which also did not work.

I think the best thing you can do is wait until the character has loaded before starting the camera manipulation. This seemed to work good for me. I had your script inside of a module and just awaited for the character if there wasn’t one before requiring it.


local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()


The script runs pretty early when put in ReplicatedFirst, so I recommend putting that camera work in StarterGui. You can always still handle loading in a seperate script in ReplicatedFirst if that’s comfortable with you.

1 Like

Gotcha, I’ll play around with it. Thanks!