How to make an NPC follow a player a few studs away from them

So I am trying to make a pet and I want it to follow the player but not too close to the player just a few studs away.

Example of problem:

And my script is

while true do
	wait()
	script.Parent.Pet:MoveTo(script.Parent.Parent.HumanoidRootPart.Position)
end

So can someone please help.

Use the Pet.Humanoid.WalkTo = Vector3 (position)

although this has no pathfinding so it would walk straight into walls, etc

"WalkTo is not a valid member of Humanoid “Workspace.iiSt3veii.Pet.Pet”

while true do
	wait()
	script.Parent.Pet:WalkTo(script.Parent.Parent.HumanoidRootPart.Position)
end

Thats the script

Nvm I fixed it by changing the script to this

while true do
	wait()
	script.Parent.Pet:MoveTo(script.Parent.Parent.HumanoidRootPart.Position + Vector3.new(2, 2, 3))
end