How do I make the head follows the player more smoothly?

Here’s the video about how unsmooth it is:
robloxapp-20231128-1335300.wmv (6.7 MB)
ANd here’s the code:

repeat wait() until script.Parent.Parent:IsA("Model")
local head = script.Parent
local char = head.Parent
local IsIdle = false
local floatingoffset = 0
local humanoid = char.Humanoid
local root = char.HumanoidRootPart
local ts = game:GetService("TweenService")
spawn(function()
	while wait() do
		if humanoid.MoveDirection.Magnitude > 0 then
			   floatingoffset = 0
			   local ani = ts:Create(head,TweenInfo.new(0.3,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0),{CFrame = root.CFrame*CFrame.new(0,4,5)})
			   ani:Play()
			else
			
		end
	end
end)
local ani
humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
	if humanoid.MoveDirection > 0 then
        repeat
		floatingoffset = 0
	    ani = ts:Create(head,TweenInfo.new(0.3,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0),{CFrame = root.CFrame*CFrame.new(0,4,5)})
		ani:Play()
		wait(.2)
		until humanoid:GetPropertyChangedSignal("MoveDirection"):Wait()
	else
		ani.Completed:Connect(function()
			IsIdle = true
		end)
	end
end)

It looks pretty smooth to me, do you want it to follow the player more quickly? And if so, you should just lower the wait time. Also, instead of using spawn(function()) use task.spawn(function()) and instead of using wait() use task.wait()

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.