I made a pet model that will follow the player as a test. It uses this code right here:
local function SetPetCFrame()
local pos = Vector3.new(Hroot.Position.X + 2, Hroot.Position.Y + 3,Hroot.Position.Z + 2)
Pet:SetPrimaryPartCFrame(CFrame.new(pos,Hroot.Position))
end
game:GetService("RunService").RenderStepped:Connect(SetPetCFrame)
The pet does follow the player, but it doesn’t really turn to the player.
It’s primarypart is called “Handle” and it’s FrontSurface is the same angle as the head.
It looks like it should work, because the LookAt parameter of the CFrame is correct. This may not be a fix, but it may look nicer if you set the CFrame before applying it as a parameter to the SetPrimaryPartCFrame. So inside the function:
local characterPosition = Hroot.Position local teleportPosition = characterPosition + Vector3.new(2,3,2)
local cframe = CFrame.new(teleportPosition, characterPosition) Pet:SetPrimaryPartCFrame(cframe)
This may not do anything, but now you can output characterPosition and teleportPosition to see if they actually exist.
I’d also suggest making game:GetService(‘RunService’) a variable. I think it has very little impact on performance but I think it’s bad practice, as it’s running every render.
I hope this helps a bit. What do the output variables print?