Allign Position And Allign Orientation Not working

Hey! So, I am trying to set up a pet follow script, I know there are many of them on the dev forum, and I have looked at all of them but I have not been able to fix my issue. So the issue im having is the script works perfectly for 15 seconds, Then out of no where it breaks as shown in the video below, The Dragon Pet, Just randomly stops following me and will instead be locked in place.

https://gyazo.com/ba6cb1f467f05963ad9c022ef532f8b8

	
			local CurrentPet = PetFolder:WaitForChild("Dragon"):Clone()
			CurrentPet.Parent = workspace
			CurrentPet:SetPrimaryPartCFrame(Character.PrimaryPart.CFrame)			
			Character.Humanoid.Died:Connect(function()
				CurrentPet:Destroy()
			end)
			local Orien1 = Instance.new("Attachment")
			Orien1.Parent = Character.HumanoidRootPart
			local Orien0 = Instance.new("Attachment")
			Orien0.Parent = CurrentPet.HumanoidRootPart
			Orien0.Orientation = Vector3.new(0,90,0) 
			local attach1 = Instance.new("Attachment")
			attach1.Parent = Character.HumanoidRootPart
			local attach0 = Instance.new("Attachment")
			attach0.Parent = CurrentPet.HumanoidRootPart
			attach0.Position = Vector3.new(0,-3,-3)
			
			local allign = Instance.new("AlignPosition")
			allign.MaxForce = 30000
			allign.Responsiveness = 40
			allign.Attachment0 = attach0
						allign.Attachment1 = attach1
			allign.Parent = CurrentPet.HumanoidRootPart
			local Ori = Instance.new("AlignOrientation")
			Ori.Responsiveness = 40
			Ori.Attachment0 = Orien0
			Ori.Attachment1 = Orien1
			Ori.Parent = CurrentPet.HumanoidRootPart
1 Like

I made a following magic type thing, which uses “Body position” and CFrame, like this…

local follow = Instance.new("BodyPosition",  part)
part.follow = part.Position + Vector3.new(3, 3, 0)
while true do
      part.CFrame = CFrame.new(part.Position, Target.Position)
      wait()
end

hope this helps!

I would use this, but Im really against the idea of having that many while true do loops in 1 game, It can cause a lot of lag, and Id rather find a solution to the actual problem but thank you!

you don’t need to it’s an example. I’m sure there’s a better way