Why is there a noticeable delay when sending CFrame data from one player’s camera to another if the camera type is set to Scriptable? When the camera type isn’t Scriptable, there’s no delay. I’m trying to sync one player’s camera view to another player’s screen in real time.
Script for the player that receives the CFrame data
local Players = game:GetService("Players")
local Camera = workspace.CurrentCamera
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SyncCameraEvent = ReplicatedStorage:WaitForChild("SyncCamera")
if Players.LocalPlayer.Name == "Player1" then
local player1 = Players.Player1
Camera.CameraType = Enum.CameraType.Scriptable
SyncCameraEvent.OnClientEvent:Connect(function(cameraData)
Camera.CFrame = cameraData.CFrame
end)
end
Script for the player that sends the data
local Players = game:GetService("Players")
local Camera = workspace.CurrentCamera
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SyncCameraEvent = ReplicatedStorage:WaitForChild("SyncCamera")
task.wait(3)
if Players.LocalPlayer.Name == "Player2" then
local player1 = Players.Player1
game:GetService("RunService").RenderStepped:Connect(function()
Camera.CameraSubject = player1.Character.Head
local cameraData = {
Distance = (Camera.CFrame.Position - Camera.Focus.Position).Magnitude,
CFrame = Camera.CFrame,
FieldOfView = Camera.FieldOfView
}
SyncCameraEvent:FireServer(cameraData)
end)
end