-
What do you want to achieve?
Pet Follows player -
What is the issue?
The Pet doesn’t move to the player. It’s just freezing there -
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)