CFrame based NPC walking going crazy

Nope! Aside from it being teleported to the start position, Which is normal and does not happen more than once. (That’s where the NPC is supposed to Idle after completing a task, It does not teleport there more than once, But is supposed to walk over to it after restocking the store.)

It does not go crazy. (You cannot describe it with just a like button)

I have to be missing some information here. There shouldn’t be anything wrong with the CFrame calculations. Can you show me the variables where you getting the NPC model

local restockerNPC = script.RestockerNPC.Value

local restockerNPCHum = restockerNPC.Humanoid

local restockerNPCSize = restockerNPC:GetExtentsSize()

local restockerGrip = restockerNPC:FindFirstChild("Grip")

Is this a value object? Holding an instance?

Yes. (the chars limit won’t let me say yes or no)

Assuming the char model instance is parented to workspace and the HRP is anchored. There is no reason it shouldn’t work that I can see.

It’s a descendant of workspace and the HRP is anchored.

Hmm… odd.
Even if the calculations were off somehow the only effect would be that the character isn’t looking in the proper direction, because the calculated CFrame is using the position of the waypoint.

local calculatedCFrame = CFrame.lookAt(v.Position, lookAt)

If you remove the lookAt and use CFrame.new, It’ll actually walk

Super weird. Just for giggles, add the upvector to the lookAt constructor:

local calculatedCFrame = CFrame.lookAt(v.Position, lookAt, Vector3.new(0,1,0))
1 Like


Ignore the video, I’m watching something in picture in picture

I am absolutely stressed right now.

You got me man. I’m stumped. Just using CFrame.New(v.Position) in the tween works huh?

Yea, It does work (You can’t say that with just a like button)

What happens if you apply the rotation before the position tween?
Do a:

restockerNPCHum.RootPart.CFrame = CFrame.LookAt(restockerNPCHum.RootPart.CFrame.Position, v.Position)
if(true)then break end

Just turn him once. and break the loop.

I mean it still moves but, It like looks towards where it’s going then looks towards zero zero

It should only look toward the first way point position and then stop and do nothing else. What’s making it turn again?

Put a breakpoint on the line just after it rotates and then look at the character. The breakpoint should halt all scripts right at that moment.

Nothing else moves the NPC. (you cant just press the like button and make someone automatically know that nothing else moves the npc)