So I'm making an obby, and I want the camera to face the next stage when you respawn. So I tried to add this in a local script in StarterCharacterScripts:
local Camera = game.Workspace.CurrentCamera
if game.Players.LocalPlayer.leaderstats.Stage.Value > 7 and game.Players.LocalPlayer.leaderstats.Stage.Value < 19 then
Camera.CFrame = script.Parent.HumanoidRootPart.CFrame * CFrame.Angles(math.rad(90),0,0)
print("success")
end
(The angle isn't the actual angle. I just tried a few random ones.) That did nothing, so I tried changing it to
local Camera = game.Workspace:WaitForChild("CurrentCamera")
if game.Players.LocalPlayer.leaderstats.Stage.Value > 7 and game.Players.LocalPlayer.leaderstats.Stage.Value < 19 then
Camera.CFrame = script.Parent.HumanoidRootPart.CFrame * CFrame.Angles(math.rad(90),0,0)
print("success")
end
But then it said "Infinite yield possible on 'Workspace:WaitForChild("CurrentCamera")'". Why can it not find CurrentCamera?

5 comments
CurrentCamera isn't an actual object, better try workspace.Camera
That fixes the infinite yield problem, but I still can't change the camera rotation.
Search on google CFrames roblox and look if something is helpful, you can also make a part for every stage and change camera CFrame to it
I have tried both of those things.
Then try using tween service