Cleaner BodyGyro and BodyPosition movement

I’m trying to get my pet to have a smoother movement to follow the player. At the moment, it feels more like it’s ‘floating’ rather than ‘walking’

What I mean by floating is the pet kinda flies towards the player, instead of having a more smooth, gradual walk up to the player.

The goal is to have the pet basically stay in place, unless the player walks away. If the player passes a certain distance, the pet should run after the player. The pet should also stay to the RIGHT of the player

Render = RunService.RenderStepped:Connect(function()
	local Character = Player.Character
	if not Character then return end
		
	-- Get HumanoidRootPart
	local HumanoidRootPart = Character.HumanoidRootPart
		
	-- Check if player is 15 studs away from pet
	local Distance = (HumanoidRootPart.Position - PetHumanoidRootPart.Position).Magnitude
	if Distance < 15 then return end
		
	-- Play walk animation
	Idle:Stop()
	Walk:Play()
		
	-- If so, we want to keep moving the pet, until the player has come to a complete stop
	while Character.Humanoid.MoveDirection ~= Vector3.new(0, 0, 0) do
		local RotatedOffset = HumanoidRootPart.Position + (((HumanoidRootPart.CFrame - HumanoidRootPart.CFrame.Position) * CFrame.Angles(0, math.rad(90), 0)).LookVector * -6)
		local ToFloor = Ray.new(RotatedOffset, Vector3.new(0, -20, 0))
		local Floor, FloorPos = workspace:FindPartOnRayWithIgnoreList(ToFloor, {CurrentPet})
		
		local _, BoundSize = CurrentPet:GetBoundingBox()
		
		local YPos = FloorPos.Y + (BoundSize.Y / 2) + 0.5
		
		-- Set Body's
		BodyGyro.CFrame = HumanoidRootPart.CFrame
		BodyPosition.Position = Vector3.new(RotatedOffset.X, YPos, RotatedOffset.Z)
		
		wait()
	end

    -- Play idle animation
	Walk:Stop()
	Idle:Play()
end)

Another problem I get is the pet spawning in and flying away from my character, then coming back to my character

Im good at writtin scripts… Im very bad at reading others people scripts xDD
The only way for me to help you is using ur script and find the error…

I usually use many BodyMovers for things like AirCrafts, Boats and stuff like that.
For Pets and Creatures, I usually use a Humanoid into the Creature and use MoveTo
So its easy to make it to walk, load animations, actions and stuff.

Impossible for me to find the error without testing it myself… and I would probably delete it all and start as simpler as possible with the BodyPosition and a simple Part. After making it work, adding the extra stuff.