:PivotTo() freezing NPC for split second

Issue is written in the title! whenever I pivot my NPC to be behind the player, the NPC freezes for a moment, and doesn’t play the swing sound : /

here is the code if needed!

local mxf = Vector3.new(100000, 0, 100000)
local speed = 100
-- uses `events.poof` to leave an afterimage
function events.smokebomb(target: BasePart)
	local ff = Instance.new("ForceField")
	ff.Visible = false
	ff.Parent = chr
	
	local velocity = Instance.new("BodyVelocity")
	velocity.P = 1250
	velocity.MaxForce = mxf
	
	task.spawn(transparency)
	events.poof(false,2.3,.5)
	task.wait(.1)
	s_heavyprep.PlaybackSpeed = 0.5
	s_heavyprep:Play()
	tweenservice:Create(s_heavyprep,TweenInfo.new(1.5,Enum.EasingStyle.Exponential,Enum.EasingDirection.In),{PlaybackSpeed = 1.1}):Play()
	
	task.wait(1.5)
	s_heavyprep:Stop()
	chr:PivotTo(target.CFrame*CFrame.new(0,0,5))
	
	local str = (root.CFrame.LookVector * Vector3.new(1, 0, 1)).Unit * speed
	velocity.Velocity = str
	velocity.Parent = root
	debris:AddItem(velocity,.1)
	
	task.spawn(transparency)
	a_swing:Play(0)
	s_heavy:Play()
end
1 Like

bump! does any one have any idea on how to remedy this?

1 Like

fixed! it was because I was not properly handling events.poof(false,2.3,.5)