Pet Doesn't follow player

  1. What do you want to achieve?
    Pet Follows player

  2. What is the issue?
    The Pet doesn’t move to the player. It’s just freezing there

  3. What solutions have you tried so far?
    Tried to search on internet and tried some of it but doesn’t work. Tried to change position code but doesn’t work also

game.ReplicatedStorage:WaitForChild("Pets&EggFolder"):WaitForChild("Remotes").PetsSelectedRE.OnServerEvent:Connect(function(player, pet)

    local PetsFolder = game.ReplicatedStorage:WaitForChild("Pets&EggFolder"):WaitForChild("Pets")

	local character = player.Character
	local LimitationPets = player.Character:FindFirstChild("EquippedPetsFolder"):FindFirstChild("Limitation")
	local OwnedPetsFolder = player:FindFirstChild("OwnedPetsFolder")
	local EquippedPet = LimitationPets.Parent:FindFirstChild("EquippedPet")

	LimitationPets.Changed:Connect(function()
		if LimitationPets.Value > 3 then print("Maxed Limit") return end
	end)

	if OwnedPetsFolder:FindFirstChild(pet) then
		LimitationPets.Value += 1

		print("Equipped")
		
		local plrPet = PetsFolder[pet]:Clone()
		plrPet.Parent = character.EquippedPetsFolder
		
		plrPet:SetPrimaryPartCFrame(character:FindFirstChild("HumanoidRootPart").CFrame)
		local PetSize = plrPet.PrimaryPart.Size
		
		local AttachmentCharacter = Instance.new("Attachment")
		AttachmentCharacter.Visible = false
		AttachmentCharacter.Parent = character.HumanoidRootPart
		AttachmentCharacter.Position = Vector3.new(1,1,0) + PetSize
		
		local AttachmentPet = Instance.new("Attachment")
		AttachmentPet.Visible = false
		AttachmentPet.Parent = plrPet.PrimaryPart
		
		local alignPosition = Instance.new("AlignPosition")
		alignPosition.MaxForce = 25000
		alignPosition.Attachment0 = AttachmentPet
		alignPosition.Attachment1 = AttachmentCharacter
		alignPosition.Parent = plrPet
		alignPosition.Responsiveness = 25

		EquippedPet.Value = plrPet.Name

	end

end)
3 Likes

I guess instead of giving pet a follow script why don’t you make the pet a part of the player and give it an animation script such that when the player walks the pet will accompany him/her and when the player the pet will stop simultaneously.

Note: create the pet using the rig editor with all the bones and animation and then change its parent to player

2 Likes

I tried tho but it still doesn’t follow

Can you post a video i guess it will help to sort this problem

Have you checked whether it is anchored or not. If it is active then deactivate it

You can try to use this Module : https://devforum.roblox.com/t/pet-follow-module-simulator-style/901913
Is very cool and easy to learn from :slight_smile:

Yes @Humaidi_0 you can do that

Alright I will check it out and will inform any updates.

1 Like

@Humaidi_0 I Found this while I was browsing Dev Forum Have A Look At This:-

Hope this helps

Reply if it worked out @Humaidi_0

Hey good news, it’s working. Thank you very much for your help I’ve appreciated it.

1 Like

Sadly it doesn’t work the module that @hypocrisism gave working but thanks for assists me on solving this problem.

1 Like

Appreciate helping you, you can pm if you need another help.