NPC randomly glitch after setting PivotTo()

This happens randomly, sometimes the NPC glitches through the air while at other times it stays still. Any idea what I can do to fix this issue?

https://i.gyazo.com/9c46822bceb59a827b78b190fbb269e6.mp4

HumanoidRootPart.CFrame = HumanoidRootPart.CFrame * CFrame.Angles(0, math.rad(180), 0)

local currentPivot1 = Character:GetPivot()
TargetCharacter:PivotTo(currentPivot1 * CFrame.new(0, 0.1, -5))
	
TargetHumanoidRootPart.Orientation = HumanoidRootPart.Orientation
	
task.wait(.1)
	
TargetHumanoidRootPart.Anchored = false
HumanoidRootPart.Anchored = false
1 Like

Try changing TargetCharacter:PivotTo(currentPivot1 * CFrame.new(0, 0.1, -5)) to TargetCharacter:PivotTo(currentPivot1 * CFrame.new(0, 3, -5))

https://i.gyazo.com/10b51e7bd596a62fd7e861b3ea39bae6.mp4

Instead of glitching through the ground, it glitches in the air. From my observations, it happens more each time I use the move. They glide further the more times I use the move. I really don’t understand how this happens.

It may just need some fine tuning on the y value, sorry if I’m not being very helpful, this is all I can think of off the top of my head

All good, but fine tuning the Y value isn’t going to help as I have tested it multiple times using different Y values.

I don’t know much about pivot functions. So maybe it’s worthless advice, but if it works, I’ll give you some advice. Try pivoting it on the arm or hand. Also, maybe you can try pivotting on top of character head.

Ekran Alıııııntısı
It goes directly into the HumanoidRootPart