Teleporting the player does not update the attachment instantly

Just as the title says. When the player is teleported, the attachement of the pet doesn’t update instantly, which is annoying in my opinion.

Here is the code:

local function equipPet(player,pet)
	local character = player.Character
	if pet ~= nil and character ~= nil then
		if character:FindFirstChild(player.Name.."'s Pet") then character[player.Name.."'s Pet"]:Destroy() end
		if character.HumanoidRootPart:FindFirstChild("attachmentCharacter") then
		pet.Name = player.Name.."'s Pet"
		local modelSize = pet.PrimaryPart.Size
		local attachmentCharacter ="Attachment")
		attachmentCharacter.Visible = false
		attachmentCharacter.Name = "attachmentCharacter"
		attachmentCharacter.Parent = character.HumanoidRootPart
		attachmentCharacter.Position =,-3.8,0) + modelSize
		local attachmentPet ="Attachment")
		attachmentPet.Visible = false
		attachmentPet.Parent = pet.PrimaryPart
		local alignPosition ="AlignPosition")
		alignPosition.MaxForce = 25_000
		alignPosition.Attachment0 = attachmentPet
		alignPosition.Attachment1 = attachmentCharacter
		alignPosition.Responsiveness = 200
		alignPosition.Parent = pet
		local alignOrientation ="AlignOrientation")
		alignOrientation.MaxTorque = 25_000
		alignOrientation.Attachment0 = attachmentPet
		alignOrientation.Attachment1 = attachmentCharacter
		alignOrientation.Responsiveness = 200
		alignOrientation.Parent = pet
		pet.Parent = character

Help is appreciated!

1 Like

If the pet’s position should always be the attachment position, I suggest looking for solutions that always keep it this way such as setting the position or maybe using welds.

I already am using welds and the pet’s attachment’s position is always the same as the character’s attachment’s position. It works perfectly fine but when the player gets teleported there is a little delay.