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 = Vector3.new(v.Position.X, primPart.Position.Y, v.Position.Z)
print(lookatVector)

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

This is the output:
image

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

image

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.