Changing models primarypartcframe moves the model into the void (Y = -3.4028234663852886e+38)

I have this simple script that makes the rig look at the waypoint in pathfinding, but that doesn’t happen

local primPart = model.PrimaryPart
local lookatVector =, primPart.Position.Y, v.Position.Z)

print(CFrame.lookAt(primPart.Position, lookatVector))
model:SetPrimaryPartCFrame(CFrame.lookAt(primPart.Position, lookatVector) * CFrame.Angles(0,math.pi,0))

This is the output:

And then after setting it, the Y coordinate goes to this


This will happen if you try to make a CFrame look at itself with lookAt, make sure that isn’t what’s happening.

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