When teleporting the player the camera is not facing the correct direction.
Player is facing the correct direction(that is the Front of the part) but the camera itself is not facing the correct direction:
How it should look like:
Code:
--Server Side
--Services
local players = game:GetService("Players")
function TeleportPlayerToCheckpoint(player)
local Character = player.Character
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
HumanoidRootPart.CFrame = workspace.TestPart.CFrame + Vector3.new(0,1,0)
end
players.PlayerAdded:Connect(function(player)
wait(3)
TeleportPlayerToCheckpoint(player)
end)
Do I have to manipulate the camera to fix this?
.
Edit
Done more testing and I am a bit confused as
When I run it Client Side in the StarterCharacter it teleport the player and the camera orientation is correct but there will be one off’s that it won’t be orientated correctly.
local player = game.Players.LocalPlayer
function TeleportPlayerToCheckpoint(player)
local Character = player.Character
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
HumanoidRootPart.CFrame = workspace.TestPart.CFrame + Vector3.new(0,1,0)
local camera = workspace.CurrentCamera
end
TeleportPlayerToCheckpoint(player)
To test it further on the client I added a wait(1) when I done so the orientation of the camera was incorrect
local player = game.Players.LocalPlayer
function TeleportPlayerToCheckpoint(player)
local Character = player.Character
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
HumanoidRootPart.CFrame = workspace.TestPart.CFrame + Vector3.new(0,1,0)
local camera = workspace.CurrentCamera
end
wait(1) --When the wait is here the camera orientation will be incorrect
TeleportPlayerToCheckpoint(player)
And with the Server having a delay it will act as if it is acting on the client side with the wait(1) leading the orientation incorrectly. On the server at times the orientation is correct but 9 times out of 10 it will be incorrect
I am not sure if this is because of the axes being set for the camera before teleporting or if it is Engine Bug.
Place to test it out yourself:
NotFacingRightDirection.rbxl (27.3 KB)