Model (Pets) won't look at player

Hi, I’m trying to make a pet system. You can buy or equip pets, when they’re equipped they should start looking at the player that bought the pet.

But the problem is that CFrame.lookAt does not turn Pet or Pet Attachment.
I have tried just rotating normally with CFrame.Angles or Orientation that works fine on the attachment, but CFrame.lookAt doesn’t work on the attachment.

Is there any other way, I could use to make the pets look at the player without using CFrame.lookAt?

This is my script :

		local ClonePet = rep.Pets:FindFirstChild(pet.Name):Clone()
		ClonePet:SetPrimaryPartCFrame(HRP.CFrame)
		ClonePet.Parent = player.Character


		local ac = Instance.new("Attachment",HRP)
		ac.Position = Vector3.new(math.sin(math.rad(spacing)) * 6, 0, math.cos(math.rad(spacing)) * 6)
		ac.Visible = false
		ac.Name = "ACharacter"


		local ap = Instance.new("Attachment",ClonePet.PrimaryPart)
		ap.CFrame = CFrame.lookAt(ap.Position, HRP.Position) --> This doesn't work for some reason
		ap.Visible = false
		ap.Name = "APet"

		
		
		local alignPosition = Instance.new("AlignPosition")
		alignPosition.MaxForce = 25000
		alignPosition.Attachment0 = ap
		alignPosition.Attachment1 = ac
		alignPosition.Responsiveness = 25
		alignPosition.Parent = ClonePet

		
		local alignOrientation = Instance.new("AlignOrientation")
		alignOrientation.MaxTorque = 2500
		alignOrientation.Attachment0 = ap
		alignOrientation.Attachment1 = ac
		alignOrientation.Responsiveness = 25
		alignOrientation.Parent = ClonePet

2 Likes

Check which way the object is facing. Is the front face pointing where you want it to look from?

2 Likes

Its facing correct(they all face the same direction), i’ve tried putting it in a loop but it goes back to the original position(i think).

1 Like

I think i have kinda fixed the issue. I just gave up on the pets looking at the player because they just wouldn’t rotate at all.
So i made them all look forward and that works fine.

Thanks for the support!