How to make this smoother

I found this free model R15 torso camera movement script. It works great (iron sights track better than my older one), but I want to know how to make it run smoother, or at least less choppy. It has a script with “tweens” and from my understanding “tries” to make it run smoother, but doesn’t really work. I don’t know what tweens are or do, so help?

e

BodyMovementScript:

if not script.Parent:FindFirstChild("Humanoid") then 
	script.Parent = game.StarterPlayer.StarterCharacterScripts 
	return
end

local tweenService = game:GetService("TweenService")
local remote = Instance.new("RemoteEvent", script)
remote.Name = "Remote"

local enabled = script.Enabled

local debounce = tick()
local lastDirection = 0

remote.OnServerEvent:connect(function(player, mouseDirection, waist, waistPosition)
	if player then
		if tick()-debounce <= 0.1 then return end;
		debounce = tick();
		if enabled.Value then
			lastDirection = mouseDirection
			tweenService:Create(waist, TweenInfo.new(0.099), {C1=(CFrame.new(Vector3.new(-0, waistPosition, -0.000272244215)) * CFrame.Angles(mouseDirection, 0, 0))}):Play();
		elseif lastDirection ~= 0.054 then
			lastDirection = 0.054
			tweenService:Create(waist, TweenInfo.new(0.099), {C1=(CFrame.new(Vector3.new(-0, waistPosition, -0.000272244215)) * CFrame.Angles(0.054, 0, 0))}):Play();
		end		
	end
end)

BodyMovementLocal:

local player = game.Players.LocalPlayer;
local runService = game:GetService("RunService").Heartbeat;
local tweenService = game:GetService("TweenService");
local playerMouse = player:GetMouse();
local remote = script.Parent:WaitForChild("Remote");
wait(2)
local character = player.Character;
local humanoid = character:FindFirstChild("Humanoid");
local torso = character:FindFirstChild("UpperTorso");
local waist = torso ~= nil and torso:FindFirstChild("Waist") or nil;
local waistPosition = torso ~= nil and torso:FindFirstChild("WaistRigAttachment") or nil;
waistPosition = waistPosition.Position.Y

local lastMousePosition = playerMouse.UnitRay.Direction.unit;
local lastUpdate = tick();
runService:connect(function()
	if torso ~= nil then
		if waist ~= nil and lastMousePosition ~= playerMouse.UnitRay.Direction.unit then
			local mouseDirection = playerMouse.UnitRay.Direction.unit;
			if workspace.FilteringEnabled then
				if tick()-lastUpdate >= 0.1 then
					remote:FireServer(-math.asin(mouseDirection.y), waist, waistPosition);
				end
			end
			lastMousePosition = playerMouse.UnitRay.Direction.unit;
		else
			waist = torso ~= nil and torso:FindFirstChild("Waist") or nil;
		end
	else
		torso = character:FindFirstChild("UpperTorso");
	end
end)

It’s not smooth because the tweening is done in the server with an interval of 0.1 seconds which is very visible when the mouse moves very fast across the screen in micro seconds.

To make it smoother these steps will need to be applied

  1. Tween on the client with no 0.1 second interval, I have done an example here with creating a local Motor6D needed to disable automatic replication from server.

  2. Maintain the server tween, the 0.1 second interval is there in order to prevent network from increasing too fast and taking up too much bandwidth.

See tutorials online

  1. So i set the 0.1 on the BodyMovementScript to 0?

  2. I don’t really get that part