How to make pet face toward character direction?

Currently, the pets are facing inward towards the character. How would I make them face the same direction as the character? So far I have tried using LookVector but that had weird outcomes. Here is the code:

local Angle = Count * (FullCircle / PetTableLength)
local X, Z = getXAndZPositions(Angle, Settings.Radius + (PetTableLength / 2))
local Position = (HumanoidRootPart.CFrame * CFrame.new(X, YPoint, Z)).p
local LookAt = HumanoidRootPart.CFrame.LookVector
local TargetCFrame = CFrame.lookAt(Position, LookAt)

local NewCFrame = Pet.PrimaryPart.CFrame:Lerp(TargetCFrame, Settings.Responsivness)
Pet:SetPrimaryPartCFrame(NewCFrame)

lookAt with CFrame I believe makes the front face look towards the thing you want to be looked at, just put the face on the front of them model. If it’s set up in a different way where the model is rotated 90 degrees you could create an offset

I don’t understand what you mean. Would you care to demonstrate an example?

hold on, with CFrame.lookAt you can edit the CFrame cant you?

Yes, it is possible to edit the cframe. My problem is that whenever I use the HumanoidRootPart LookVector with the CFrame.lookAt, the pet doesn’t face the player but instead faces one specific direction and doesn’t change afterwards.

1 Like

try multiplying it by an offset?

1 Like

The player can equip multiple pets so the pets end up facing different directions.

Fixed it using this. I figured out that I can use the character’s HumanoidRootPart CFrame + an offset. Thanks for the help.

No problem, sorry if I confused you cause I havent used lookat in a while!