The jittering and lag backing could be due to the constant updating of player2’s orientation to match player1’s. Instead of updating the orientation on every frame, you could try updating it at a set interval.
local updateInterval = 0.1 -- update every 0.1 seconds
local lastUpdate = 0
game:GetService("RunService").Heartbeat:Connect(function(deltaTime)
lastUpdate = lastUpdate + deltaTime
if lastUpdate >= updateInterval then
local player1 = game.Players:FindFirstChild(userString.Value)
local player2 = game.Players.LocalPlayer
if player1 and player1.Character and player2 and player2.Character then
player2.Character.HumanoidRootPart.CFrame = CFrame.new(player2.Character.HumanoidRootPart.Position) * player1.Character.HumanoidRootPart.CFrame.LookVector
end
lastUpdate = 0
end
end)
This script updates player2’s orientation to match player1’s every 0.1 seconds, which should reduce the jittering and lag backing. Adjust the updateInterval value to find a balance between what would work best for you.