How to make cutscene for all players

  1. What do you want to achieve? I wanna make a cutscene that fades a black screen, and changes the camera angle while making the players move through an opening door. It should but in sync on all clients but…

  2. What is the issue? It will fade out on one screen but not on the other, one screen will be black and the other would be clear.

  3. What solutions have you tried so far? I don’t know where to start trying to solve it

Here is the scripts and asset locations.

Server Script

local function EnterScene()
	local doorL = game.Workspace.DoorL
	local doorR = game.Workspace.DoorR

	SceneEvent:FireAllClients()

	for i, plr in pairs(game.Players:GetPlayers()) do
		local ts = game:GetService("TweenService")
		local ti = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
		local p = {
			BackgroundTransparency = 1
		}

		ts:Create(plr.PlayerGui.GameGui.SceneFade, ti, p):Play()

		for i = 1, #game.Players:GetPlayers() do
			game.Workspace:FindFirstChild(game.Players:GetPlayers()[i].Name).HumanoidRootPart.CFrame = game.Workspace.TPLocations:FindFirstChild("TPL" .. game.Workspace:FindFirstChild(game.Players:GetPlayers()[i].Name).GameOrder.Value).CFrame
		end

		wait(2)

		local tiL = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
		local pL = {
			Position = Vector3.new(-27.877, 108.494, -11.603),
			Orientation = Vector3.new(0, -107.54, 0)
		}

		ts:Create(doorL, tiL, pL):Play()

		local tiR = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
		local pR = {
			Position = Vector3.new(-14.017, 108.494, -11.802),
			Orientation = Vector3.new(0, 113.65, 0)
		}

		ts:Create(doorR, tiR, pR):Play()

		wait(2)

		for i = 1, #game.Players:GetPlayers() do
			game.Workspace:FindFirstChild(game.Players:GetPlayers()[i].Name).Humanoid:MoveTo(game.Workspace.WalkLocations:FindFirstChild("WL" .. game.Workspace:FindFirstChild(game.Players:GetPlayers()[i].Name).GameOrder.Value).Position)	
		end

		wait(5)

		local ticL = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
		local pcL = {
			Position = Vector3.new(-24.005, 108.494, -14.313),
			Orientation = Vector3.new(0, 0, 0)
		}

		ts:Create(doorL, ticL, pcL):Play()

		local ticR = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
		local pcR = {
			Position = Vector3.new(-18.255, 108.494, -14.313),
			Orientation = Vector3.new(0, 0, 0)
		}

		ts:Create(doorR, ticR, pcR):Play()

		wait(1)

		SceneEvent:FireAllClients()
	end
end
wait(10)
EnterScene()

Local Script

local SceneEvent = game.ReplicatedStorage.CutScene
local cc = workspace.CurrentCamera
local view = false
local deb = false

SceneEvent.OnClientEvent:Connect(function()
	if view == false then
		view = true
		cc.CameraType = Enum.CameraType.Scriptable
		cc.CFrame = game.Workspace.CamPart.CFrame
	else
		view = false
		cc.CameraType = Enum.CameraType.Custom
	end
end)

.

.

image

image

image

Of course it doesn’t work because you only run that function once. If you want every new players that joined the game to see that cutscene, you should connect the function to Players.PlayerAdded event and run that cutscene for that specific player.

No no, I want it to run when its triggered, not when a player starts. And I want it to be in SYNC with all other players. The problem I’m seeing is that it runs on one client, finishes, then runs on the others. It may be the order of the script but I don’t know where to start fixing lol

It is, this is because you used a for loop, and when that loop has any yielding (in this case is the cutscene time), the players would have to wait until their cutscene finishes playing, so you should just use task.spawn or task.defer to spawn a new thread which handles the client.

The other way is to just switch the cutscene logic to the client, let the client do their job.