Camera Script not Working

So I am making an among us type game, and the camera is not working. So, basically, I eject the player by setting his primary part cframe to a part outside of the baseplate, and I make the camera’s cframe to a part where we can see the player getting ejected. However, after the player dies, the other player that DOESN’T die , his camera goes back to normal. However, the other player that DOES die , his camera is stuck.


Here’s the script:

game.ReplicatedStorage.Camera.OnClientEvent:Connect(function(plr)
	local camera = game.Workspace.CurrentCamera
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = workspace.Cam.CFrame
	statuslabel.Visible = true
	Type(statuslabel, game.ReplicatedStorage.Winner.Value.." was ejected.")
	task.wait(3)
	statuslabel.Visible = false
	camera.CameraType = Enum.CameraType.Custom
end)

There must be something yielding the thread from the last line that changes the camera. Did you try printing something below that line to see if your code gets there? Are there any errors? The only thing I could think of is your Type function not returning or since the player died, the gui resets, and the statuslabel.Visible = true errors.

Nope, no errors at all. When the player gets chosen to be ejected, a string in the ReplicatedStorage named Winner gets updated. It changes the Winner value to the player’s name. At the start of every single new emergency meeting, it sets it back to Nobody.

Try This.

game.ReplicatedStorage.Camera.OnClientEvent:Connect(function(plr)
	local camera = workspace.CurrentCamera

repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until
Enum.CameraType.Scriptable
Camera.CFrame = game.Workspace.Cam.CFrame
	statuslabel.Visible = true
	Type(statuslabel, game.ReplicatedStorage.Winner.Value.." was ejected.")
	task.wait(3)
	statuslabel.Visible = false
	camera.CameraType = "Custom"
end)