Camera manipulation error

So I am creating a camera that sets the players camera to a part.

The issue is that it is not doing it, but the rest of the script runs fine.
Another issue is that I added a wait so the script has time to find the camera, and the script does not yield and wait 3 seconds, it just ignores it.

game.Players.PlayerAdded:Connect(function(player)
	print("Missile event has began")
	
	wait(3)
	local currentCamera = workspace.CurrentCamera
	local camera = script.Parent:WaitForChild("Camera")
	
	currentCamera.CameraType = Enum.CameraType.Scriptable
	currentCamera.CameraSubject = camera
	currentCamera.CFrame = camera.CFrame
	
	print("Camera set to position")
	
	script.BackgroundMusic:Play()
	
	local messageGui = player:WaitForChild("PlayerGui"):WaitForChild("Message")
	local displayMessage = messageGui:WaitForChild("MessageToDisplay")
	
	local message1 = "Multiple hostile missiles have been spotted, please activate appropriate proticols"
	local message2 = "C-RAM have failed to destroy the missiles, please prepare for impact"
	
	local function typewriteMessage(message)
		for i = 1, #message, 1 do
			displayMessage.Text = string.sub(message, 1 ,i)
			wait()
		end
	end
	
	wait(0.5)
	typewriteMessage(message1)
	
	wait(10)
	typewriteMessage(message2)
	wait(2.5)
	displayMessage.Text = ""
end)

There are multiple problems here

  1. This is a Server Script, you can’t set the camera of a local player from a server script because each machine has it’s own camera. (the servers camera is not the same as Player1’s camera and Player1’s camera is not the same as Player2’s camera)

  2. Even if this was a LocalScript, camera Instances don’t replicate. So if you put a camera in ReplicatedStorage (or any replicated container) and try to access it on the client it won’t be there. What you would have to do is save the CFrame and any other camera properties in ObjectValues (or in the local script), then in a LocalScript construct a camera using Instance.new("Camera")