Hello! It’s been a while since I got this problem. Basically, when teleporting the player to a part and using custom camera, the player flicks out on client but is totally fine on the server. Underneath are the codes I use for the system.
Where I initialize the custom camera:
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CameraPartClone = ReplicatedStorage:WaitForChild("CameraPartCharCreation"):Clone()
CameraPartClone.Parent = workspace
local CameraPart = workspace:WaitForChild("CameraPartCharCreation")
local RE = ReplicatedStorage.Events:WaitForChild("CharCustomizationTeleport")
local CurrentCamera = workspace.CurrentCamera
local player = Players.LocalPlayer
local char = player.Character
local hum = char.Humanoid
local PlayerGui = player.PlayerGui
local CharacterCreationGUI = PlayerGui.CharacterCreation.CharacterCreation:WaitForChild("CharacterCreation")
local mouse = player:GetMouse()
local GUI = script.Parent
local MOVE_SPEED = 150
local CharacterCreated = player.Data.CharacterCreated
RunService.RenderStepped:Connect(function()
if CharacterCreationGUI.Visible == true then
if CharacterCreated.Value == false then
RE:FireServer()
task.wait(2)
local function UpdateCamera()
local center = CameraPart.CFrame
local MoveVector = Vector3.new((mouse.X - center.X) / MOVE_SPEED, (mouse.Y - center.Y) / MOVE_SPEED, 0)
CurrentCamera.CFrame = CameraPart.CFrame * CFrame.Angles(math.rad(-(mouse.Y - center.Y) / MOVE_SPEED), math.rad(-(mouse.X - center.X) / MOVE_SPEED), 0)
end
local Connection = RunService.RenderStepped:Connect(UpdateCamera)
while GUI.Visible == true do
hum.WalkSpeed = 0
hum.JumpPower = 0
UpdateCamera()
task.wait(1)
end
end
end
end)
Where I teleport the player:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RE = ReplicatedStorage.Events:WaitForChild("CharCustomizationTeleport")
local TeleportPart = workspace.CharacterCustomizationMap:WaitForChild("TeleportPart")
RE.OnServerEvent:Connect(function(plr)
local char = plr.Character
local HRP = char:WaitForChild("HumanoidRootPart")
HRP.CFrame = CFrame.new(TeleportPart.Position) * CFrame.Angles(0, math.rad(80), 0)
end)
Vide that shows the problem: