Hello everyone! I am currently coding a hatching system for my game but am I currently facing an issue with CFrame.lookAt().
How my system works: Whenever someone hatchs an egg, a model is copied into game.Workspace and a script changes the CFrame of its primary part.
Current code:
[Model]:SetPrimaryPartCFrame(Workspace.EggOpeningScreen.__CLIENT_CAM.CFrame * CFrame.new(0, 0, -5))
-- __CLIENT_CAM is a part
Result:
As you can see, the pet’s face is not facing the “CLIENT_CAMERA” part. Whenever I try to use CFrame.lookAt, the pet gets a total different position for some reasons. I do not understand why.
Code:
local newCFrame = CFrame.lookAt(
Workspace.EggOpeningScreen.__CLIENT_CAM.CFrame.Position * CFrame.new(0, 0, -5).Position,
Workspace.EggOpeningScreen.__CLIENT_CAM.CFrame.Position
)
[Model]:SetPrimaryPartCFrame(newCFrame)
