Camera manipulation for Intro Cutscene, but

game.ReplicatedStorage.cutsceneEvents.introCutscene.OnClientEvent:Connect(function()
	
	-- Change sky
	local startTime = game.Lighting.ClockTime
	
	local sky = game.ReplicatedStorage.cutsceneStuff.intro.introSky:Clone()
	local atmo = game.ReplicatedStorage.cutsceneStuff.intro.introAtmosphere:Clone()
	game.Lighting.ClockTime = 18
	sky.Parent = game.Lighting
	atmo.Parent = game.Lighting
	
	-- Manipulate camera to carrot
	local scene = game.Workspace.carrotScene
	
	local cam = game.Workspace.CurrentCamera
	cam.CameraType = Enum.CameraType.Scriptable
	cam.CFrame = scene:WaitForChild("cam1").CFrame
	
end)

This is the beginnings of the script for an intro cutscene I’m making. This remote event is triggered by the server on PlayerAdded.
The camera does not change to where I want it to be. However, I’ve noticed that if I give a delay (like wait(1)), it works fine. I’m guessing this is an issue of loading. However, like when parts don’t load, it’s bad practice to just wait some amount and hope it works, and is better to use a more universal solution like WaitForChild(). I don’t think I can really apply that to CurrentCamera though…
How do I go about fixing this problem? Is there a way I can wait? Do I just have to add a loading screen or something before hand? What can I do?

1 Like

I think you can use a WaitForChild on workspace.Camera. If you would rather use CurrentCamera, I think a simple wait() at the top of your script should work fine.