It appears to be quite choppy and definitely is more client and server intensive when there are multiple players in the game. Right now I’m gonna try rewriting the code to use the TweenService instead of lerping.
Client:
runService.Heartbeat:connect(function(d)
if canContinue then
local CFNew, CFAng, CFtoObjectSpace = CFrame.new, CFrame.Angles, CFrame.new( ).toObjectSpace
local asin, pi, hpi = math.asin, math.pi, math.pi / 2
local primaryPartCFrame = character:GetPrimaryPartCFrame()
local new = primaryPartCFrame
if keys.w then
new = new + camera.CFrame.lookVector * speed
end
if keys.s then
new = new - camera.CFrame.lookVector * speed
end
if keys.a then
new = new * CFrame.new(speed, 0, 0)
end
if keys.d then
new = new * CFrame.new(-speed, 0, 0)
end
if speed < 1.25 then
speed = speed + 0.02
end
local CameraDirection = CFtoObjectSpace(new, camera.CFrame).lookVector.unit
game.ReplicatedStorage.Position:FireServer(primaryPartCFrame:lerp(new * CFAng(0, asin(CameraDirection.x), 0), speed))
wait()
end
end)
Server:
game.ReplicatedStorage.Position.OnServerEvent:connect(function(player, position)
if player.Character then
local character = player.Character
character:SetPrimaryPartCFrame(position)
end
end)
That’s not a good idea because TweenService will ignore parts that have the CanCollide property enabled, and it can cause them to go through any buildings or the map, etc.