How could I always make the camera face the player's orientation?

I know this issue can be fixed with a local script that always does it after the player loads in but I prefer using the server sided method unless it’s the only way.

There’s this issue I am facing right now with the camera which sometimes ends up facing the forward angle of the SpawnPoint from where the player spawns at and it’s infuriating. Let me explain.

I am making an obby game with a checkpoint system. The system teleports the player using PivotTo() and uses the checkpoint’s CFrame so the player always faces the checkpoint’s forward angle when they spawn. The issue is that sometimes, the camera doesn’t do it and it happens at random which what I want to fix.

Here’s what I mean by this video below.

The reason why I am making this post is that I don’t want players to constantly turn their cameras around which can be annoying to them. Mind you, the checkpoints are Parts, not SpawnLocations.

Here’s a snippet of the code I use to execute it.

player.CharacterAdded:Connect(function(char) --teleport player to checkpoint when they respawn (if theyve achieved a checkpoint)
		if currentcheckpoint.Value ~= 0 then
			char:PivotTo(checkpoints[currentcheckpoint.Value].CFrame*CFrame.new(0,4.5,0))
		end
end)

I’m not sure if I have to do some sort of extra step in order to guarantee it or it’s Roblox’s end causing it but is there a server sided way to always make sure the camera’s orientation is properly facing?

I an slightly confused as the code snippet you provided has nothing to do with the camera, unless I misunderstood what you were trying to say, however everything that is related to the client should, when possible, be done on the client. Doing these things on the server introduces a lot of problems, most of which can be tracked down to latency. Latency is also what I believe to be the problem right now. If I understand correctly, every time the player spawns in, the server rotates them and their camera, which then takes some time to reach the client and so, you see that split second when the changes made on the server weren’t applied on the client yet.

-- You cannot control the player’s camera from the server. If you want to make it so the server still triggers the event, use a RemoteEvent that’s fired by the server whenever the character is teleported back to the checkpoint. Then, in a LocalScript, hook the function you’re talking about to that RemoteEvent.

Normally when you spawn from a SpawnPoint, your camera automatically orients itself towards the back of the player’s head. This is true for all cases of SpawnPoints.

However in the video above, The only SpawnPoint in the game is the spawn itself, which is 180 degree from the checkpoint where the player spawns on. This is why sometimes, the camera is facing directly infront of the player, not from the back.

Then you could manually set it on the client if you can’t rotate the spawnpoint

1 Like