Pet Following Issue

Hi guys, well, I just finished my egg hatching system but the problem is that the way the pet follows the player is really odd. I just noticed that it looks like the pet is attached to a specific point to the player and I want it to be following it instead. Well, I borrowed my script from alvin_blox, and then I noticed that this is a script for attachment, I will put the script below but I really need a script that will allow the pet to follow the player. Thanks

" local function equipPet(player,pet)
local character = player.Character

if pet ~= nil and player ~= nil then
	
	if character:FindFirstChild(player.Name.."'s Pet") then character[player.Name.."'s Pet"]:Destroy() end
	
	if character:FindFirstChild("attachmentCharacter") then
		character:FindFirstChild("attachmentCharacter"):Destroy()
	end
	pet.Name = player.Name.."'s Pet"
	
	pet:SetPrimaryPartCFrame(character.HumanoidRootPart.CFrame)
	
	local modelSize = pet.PrimaryPart.Size
	
	local attachmentCharacter = Instance.new("Attachment")
	attachmentCharacter.Visible = false
	attachmentCharacter.Name = "attachmentCharacter"
	attachmentCharacter.Parent = character.HumanoidRootPart
	attachmentCharacter.Position = Vector3.new(1,1,0) + modelSize
	
	local attachmentPet = Instance.new("Attachment")
	attachmentPet.Visible = false
	attachmentPet.Parent = pet.PrimaryPart
	
	local alignPosition = Instance.new("AlignPosition")
	alignPosition.MaxForce = 20000
	alignPosition.Attachment0 = attachmentPet
	alignPosition.Attachment1 = attachmentCharacter
	alignPosition.Responsiveness = 25
	alignPosition.Parent = pet
	
	local alignOrientation = Instance.new("AlignOrientation")
	alignOrientation.MaxTorque = 20000
	alignOrientation.Attachment0 = attachmentPet
	alignOrientation.Attachment1 = attachmentCharacter
	alignOrientation.Responsiveness = 25
	alignOrientation.Parent = pet
	
	pet.Parent = character
end

end

game.Players.PlayerAdded:Connect(function(player)
local inventory = Instance.new(“Folder”)
inventory.Name = “Inventory”
inventory.Parent = player

local equipedPet = Instance.new("StringValue")
equipedPet.Name = "EquippedPet"
equipedPet.Parent = player

player.CharacterAdded:Connect(function(char)
	if game.ReplicatedStorage:WaitForChild("Pets1"):FindFirstChild(equipedPet.Value) then
		equipedPet(player, game.ReplicatedStorage:WaitForChild("Pets1"):FindFirstChild(equipedPet.Value):Clone())
	end
end)

equipedPet.Changed:Connect(function()
	if equipedPet.Value ~= nil then
		if game.ReplicatedStorage:WaitForChild("Pets1"):FindFirstChild(equipedPet.Value) then
			equipPet(player,game.ReplicatedStorage:WaitForChild("Pets1"):FindFirstChild(equipedPet.Value):Clone())
			
		end 
	end
end)

end)

game.ReplicatedStorage.EquipPet.onServerEvent:Connect(function(player,petName)

local pet = game.ReplicatedStorage.Pets1:FindFirstChild(petName)

if pet and player.Inventory:FindFirstChild(petName) then
	player.EquippedPet.Value = petName
end

end)

game.ReplicatedStorage.UnequipPet.onServerEvent:Connect(function(player,petName)
player.EquippedPet.Value = “”
if player.Character:FindFirstChild(player.Name…“'s Pet”) then
player.Character[player.Name…“'s Pet”]:Destroy()
end
if player.Character.HumanoidRootPart:FindFirstChild(“attachmentCharacter”) then
player.Character.HumanoidRootPart:FindFirstChild(“attachmentCharacter”):Destroy()
end
end)"

Hey there, I would suggest you use BodyMovers for Pet System it will be very smooth. Here is what I made Kapwing — Create more content in less time